We're updating the issue view to help you get more done. 

Agent can not be launched with the Java 9

Description

Starting the agent with Java 9 causes following error:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 2017-10-10 10:28:21,247: 972 [ main] ERROR spectit.agent.java.SpringAgent - inspectIT agent initialization failed. Agent will not be active. java.lang.ClassNotFoundException: java.sql.SQLException at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563) at rocks.inspectit.agent.java.javaagent.JavaAgent$InspectItClassLoader.loadClass(JavaAgent.java:533) at rocks.inspectit.agent.java.javaagent.JavaAgent$InspectItClassLoader.loadClass(JavaAgent.java:504) ... 26 common frames omitted Wrapped by: java.lang.NoClassDefFoundError: java/sql/SQLException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1032) ... 23 common frames omitted Wrapped by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: java/sql/SQLException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1039) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:985) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:441) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:629) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461) at rocks.inspectit.agent.java.SpringAgent.initSpring(SpringAgent.java:164) at rocks.inspectit.agent.java.SpringAgent.<init>(SpringAgent.java:118) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488) at rocks.inspectit.agent.java.javaagent.JavaAgent.premain(JavaAgent.java:104) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:500) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:512) 2017-10-10 10:31:23,898: 1086 [ main] ERROR spectit.agent.java.SpringAgent - inspectIT agent initialization failed. Agent will not be active.

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

None

Status

Assignee

Ivan Senic

Reporter

Ivan Senic

Labels

None

Pull Request

None

Integrator

Marius Oehler

Sprint

None

Fix versions

Affects versions

1.8.4

Priority

Highest