I’m getting below error when I run the above rule.
Exception running rule: BeanShell script error: bsh.EvalError: Sourced file: inline evaluation of: import java.util.List; import sailpoint.tools.Util; import java.io.Buffered . . . '' : Error in method invocation: Cannot access method setRequestMethod(java.lang.String) in 'class sun.net. www.protocol.https.HttpsURLConnectionImpl' :java.lang.IllegalAccessException: class bsh.Reflect cannot access class sun.net. www.protocol.https.HttpsURLConnectionImpl (in module java.base) because module java.base does not export sun.net. www.protocol.https to unnamed module @5e46ca49 : at Line: 75 : in file: inline evaluation of: import java.util.List; import sailpoint.tools.Util; import java.io.Buffered . . . ‘’ : connection .setRequestMethod ( “GET” )
I noticed this error when we upgraded Java JDK11 to Java JDK17. The same rule was working fine when we were using Java JDK11.
Any suggestion on this error will be very helpful. Thanks in advance.
Error you are seeing is mostly due to change in JDK’s module system. Java introduced a module system that restricts access to internal APIs. The class sun.net.www.protocol.https.HttpsURLConnectionImpl you’re trying to access is an internal API, hence the access restriction.
Check if above works with JDK17 and let me know if still any help needed.
I tried using the code you mentioned but no luck. But adding –add-opens=java.base/sun.net.www.protocol.https=ALL-UNNAMED to Tomcat Java options solved my issue.
Using --add-opens may work but that’s not recommended approach as you are bypassing the restrictions of the Java module system for sun.net.www.protocol.https. It’s subject to change without notice, and using it can result in your code breaking when you upgrade Java.
Anyhow glad it worked for you with this for now, if possible let me know the error you encountered with the code, will try to assist