Root cause of JavaScriptException: java.lang.IllegalAccessException

craig dawson
Tera Contributor

Good Morning all 

we have just updated to Washington 

i have come on this morning to find that one of the schulded jobs that run every two hours is now generating this error 

Import Error: Evaluation error: JavaScript evaluation error on:var remoteFileImport = new DTMIDServerRemoteFileImport(); remoteFileImport.getRemoteFileAndUplo
The following error occurred with the Remote File Import functionality that imports alerts into ServiceNow from the spreadsheet on the Mid Server:
Evaluation error: JavaScript evaluation error on:
var remoteFileImport = new DTMIDServerRemoteFileImport();
remoteFileImport.getRemoteFileAndUploadToInstance()
Root cause of JavaScriptException: java.lang.IllegalAccessException

is anyone able to advised or possible guide me what this could be doing 

these where all working yesterday just since the update to Washington 

9 REPLIES 9

Kieran Anson
Kilo Patron

DTMIDServerRemoteFileImport looks to be a custom created script include, you'll need to examine if there are any package calls being made ( a possible cause of the posted error ). Does the logs provide a line number that is causing the error? Does the same occur if you manually run the posted code in a background script?

EnriT
Tera Expert

Facing a similar issue as well, but have not found a solution yet.

I am guessing you are utilizing the below somewhere.

new Packages.java.net.URL("url").openConnection();

From my testing I found that the error appears if I try interracting with it.
For example:

var conn = new Packages.java.net.URL(url).openConnection();
conn.setRequestProperty("Authorization", basicAuth);




Good Morning All,

I see we're encountering an error after updating to Washington. The scheduled job that runs every two hours is now generating this error:

Import Error: Evaluation error: JavaScript evaluation error on:var remoteFileImport = new DTMIDServerRemoteFileImport(); remoteFileImport.getRemoteFileAndUplo
The following error occurred with the Remote File Import functionality that imports alerts into ServiceNow from the spreadsheet on the Mid Server:
Evaluation error: JavaScript evaluation error on:
var remoteFileImport = new DTMIDServerRemoteFileImport();
remoteFileImport.getRemoteFileAndUploadToInstance()
Root cause of JavaScriptException: java.lang.IllegalAccessException

 

Here’s a simplified solution to address the issue:

Possible Cause

The error "Root cause of JavaScriptException: java.lang.IllegalAccessException" suggests that the update to Washington may have altered access levels or configurations for certain classes or methods.

Solution Steps

  1. Check Recent Update Documentation: Review the Washington update documentation to identify any changes related to Java access permissions. Look for modifications in access levels for methods or classes used in your scheduled job.

  2. Update MidServer Configuration: The error might be due to a recent JRE update that affects the MidServer. You need to update the wrapper.cfg or wrapper-override.cfg files on your MidServer. Add the following entries:

# Java Additional Parameters from File
#wrapper.java.additional_file=
wrapper.java.additional.137=--add-opens=java.base/java.net=ALL-UNNAMED
wrapper.java.additional.138=--add-opens=java.base/javax.xml=ALL-UNNAMED
wrapper.java.additional.139=--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED
wrapper.java.additional.140=--add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED
wrapper.java.additional.141=--add-opens=java.base/sun.net.www.http=ALL-UNNAMED
wrapper.java.additional.142=--add-opens=java.base/java.lang.reflect=ALL-UNNAMED

 

 

  • Review Custom Scripts: If DTMIDServerRemoteFileImport is a custom script include, check if there are any package calls that might be causing the error. Look for the specific line number in the logs where the error occurs and test running the code manually in a background script.

  • Verify Package Interactions: Ensure that any interactions with Java packages are correctly handled. For example, if you're using code like:

var conn = new Packages.java.net.URL(url).openConnection();
conn.setRequestProperty("Authorization", basicAuth);

 

  1. Verify that these interactions are compliant with the new access levels.

 

If these steps don't resolve the issue, please reach out for further assistance or consult Impressico Business Solutions for expert guidance.

Thanks,

 

catherinewil
Mega Expert

Hey!

 

The error "Root cause of JavaScriptException: java.lang.IllegalAccessException" typically occurs when a method or class that is not accessible (private or protected) is being accessed. The recent update to Washington might have changed the access levels or configurations, causing this issue.

Here’s a simplified breakdown:

  1. Possible Cause: The update might have modified permissions or access levels for certain classes or methods, leading to this error when your scheduled job runs.
  2. Immediate Action: Review the recent update documentation for any changes related to access permissions. Check the code for any methods or classes that might have restricted access and adjust accordingly.

If the issue persists, consult the update documentation for any specific changes related to Java access or contact Impressico Business Solutions for further assistance.