简体   繁体   中英

Read zip file contents using ZipFile java class inside script

I have one requirement to read zip files content using a script. I wrote one script and tried to run it from my tool. I am using JAVA classes and it's giving the following error:

Security restricted: Attempted access to restricted class name java.util.zip.ZipFile
Evaluator: java.lang.SecurityException: Illegal attempt to access class 'java.util.zip.ZipFile' via script
Caused by error in script at line 21

 var zFile = new Packages.java.io.File(x);
 gs.print(zFile);

 var reading = new Packages.java.util.zip.ZipFile(zFile);// Error here
 gs.print(reading);

I had an issue similar but different. Had to open a Hi ticket.

We used to use new Packages.java.util.zip.ZipOutputStream(); for zipping files.

We started getting these in Helsinki, but it worked in Fuji. Service-now had to add these to the sys_whitelist_package and sys_whitelist_member list.

You could try opening up the ACL's on those tables to add the packages and member and see if that works. Or you could open a HI ticket about why you need this package, and member.

Depending on where the zip file is, you could pass this off to a midserver to unzip it, then pass the individual files up. It would be more complicated but you wouldn't have to get HI involved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM