With Java 17 it is not allowed to access internal parts of the JDK. It is not allowed by reflection nor by calling an internal API.
Access internals by deep reflection
Ivy Script Serialization / Deserialization and some libraries use (deep) reflection to access parts of the JDK that are meant for internal use only.
Since Java 9, illegal reflective access just reports a warning like this:
WARNING: An illegal reflective access operation has occurred
Since Java 17 an InaccessibleObjectException
is thrown.
Access internal API directly
If you must use an internal API that has been made inaccessible by default then an IllegalAccessError
is thrown with Java 17.
How to fix it with Axon Ivy
If it is your code, maybe there is another way to do the same without needing access to java internals.
If the problem comes from a library, maybe an update of the library helps.
If you cannot fix it, you have to figure out the correct command-line option and add it to the correct file. Please go ahead. But be aware that this internal API can change without further notice in future versions. So, this could give you trouble again and again.🐛
java.lang.reflect.InaccessibleObjectException
If you find a java.lang.reflect.InaccessibleObjectException
in your stack trace:
java.lang.reflect.InaccessibleObjectException:
Unable to make field protected java.lang.reflect.InvocationHandler java.lang.reflect.Proxy.h accessible:
module java.base does not "opens java.lang.reflect" to unnamed module @55fea615
This would be the correct command-line argument to add:
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED
java.lang.IllegalAccessError
If you find a java.lang.IllegalAccessError
in your stack trace:
java.lang.IllegalAccessError: superclass access check failed:
class com.jgoodies.looks.windows.WindowsLookAndFeel (in unnamed module @0x5cb2f9e7) cannot access class com.sun.java.swing.plaf.windows.WindowsLookAndFeel (in module java.desktop) because
module java.desktop does not export com.sun.java.swing.plaf.windows to unnamed module @0x5cb2f9e7
This would be the correct command-line argument to add:
--add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED
Where to add the --add-exports
/ --add-opens
Designer
Add the command-line option to the AxonIvyDesigner.ini
file in the root of the Axon Ivy Designer installation.
Engine
Add the command-line option to the jvm.options
file found in the configuration
folder of the Axon Ivy Engine installation.
Syntax of add-opens
and add-exports
--add-[exports|opens]=<source-module>/<package>=<target-module>(,<target-module>)*
Where <source-module>
and <target-module>
are module names and <package>
is the name of a package.
As a special case, if the <target-module>
is ALL-UNNAMED
, then the source package is exported to all unnamed modules. At the moment all Axon Ivy Code and your Code in the Axon Ivy Projects is not modularized in the sense of the java module system, so it counts in fact as an unnamed module.
Report findings
Please report your added add-opens
or add-exports
entries here below this blog post. This may help to improve the default settings.