Agent can not be launched with the Java 9
Description
Starting the agent with Java 9 causes following error:
The problem seams to be the changed API of the ClassLoader class empty constructor. From Eclipse forum:
Using the empty constructor ClassLoader() is not equivalent to what we have today on Java 8 because it will use a parent of the ClassLoader.getSystemClassLoader() which is not the boot class loader. Instead we will have to resort to calling the new Java 9 static method: ClassLoader.getPlatformClassLoader()
As we are on JDK6 we'll need to use reflection here.
Environment
Activity
SUCCESS: Integrated in
inspectIT - Integration #364
INSPECTIT-2544: updated agent to support java 9 (marius.oehler: 9d730bec2b7efa4f92669013a2db48cc0e69f677)
(edit) inspectit.shared.all/src/main/java/rocks/inspectit/shared/all/util/UnderlyingSystemInfo.java
(edit) resources/config/findbugs/findBugsExcludeFilter.xml
(edit) dependencies.gradle
(edit) inspectit.agent.java/src/test/java/rocks/inspectit/agent/java/util/ReflectionCacheTest.java
(edit) inspectit.agent.java/src/main/java/rocks/inspectit/agent/java/javaagent/JavaAgent.java
Important information about the changes:
As written in the ticket we need to have Platform class loader as parent of inspectIT class loader in java 9
The asm version is updated in order to support java 9
Annotations dependency is added because they are missing in java 9 and users would need to start the applications with --add-modules=java.xml.ws.annotation in order to include them. To avoid this I added directly the dependency
Test is changed because in Java 9 the String class stores byte[] array in value instead of char[]. To make it java independent I used Exception class.
I am available for questions.