Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassCastException with adoptopenjdk/openjdk11-openj9 #505

Closed
remmeier opened this issue Mar 1, 2019 · 2 comments · Fixed by #506
Closed

ClassCastException with adoptopenjdk/openjdk11-openj9 #505

remmeier opened this issue Mar 1, 2019 · 2 comments · Fixed by #506

Comments

@remmeier
Copy link

remmeier commented Mar 1, 2019

Hi

we upgrade to the current 1.4 version and got this error upon startup:

textPayload: "java.lang.reflect.InvocationTargetException
	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:566)
	at co.elastic.apm.agent.bci.AgentMain.init(AgentMain.java:78)
	at co.elastic.apm.agent.bci.AgentMain.premain(AgentMain.java:48)
	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:566)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.ExceptionInInitializerError
	at java.base/java.lang.J9VMInternals.ensureError(J9VMInternals.java:191)
	at java.base/java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:180)
	at java.base/java.lang.Class.forNameImpl(Native Method)
	at java.base/java.lang.Class.forName(Class.java:340)
	at co.elastic.apm.agent.metrics.builtin.JvmGcMetrics.bindTo(JvmGcMetrics.java:66)
	at co.elastic.apm.agent.metrics.builtin.JvmGcMetrics.start(JvmGcMetrics.java:41)
	at co.elastic.apm.agent.impl.ElasticApmTracer.<init>(ElasticApmTracer.java:157)
	at co.elastic.apm.agent.impl.ElasticApmTracerBuilder.build(ElasticApmTracerBuilder.java:108)
	at co.elastic.apm.agent.bci.ElasticApmAgent.initialize(ElasticApmAgent.java:90)
	... 12 more
Caused by: java.lang.ClassCastException: com.ibm.lang.management.internal.ExtendedThreadMXBeanImpl incompatible with com.sun.management.ThreadMXBean
	at co.elastic.apm.agent.metrics.builtin.JvmGcMetrics$HotspotAllocationSupplier.<init>(JvmGcMetrics.java:75)
	at co.elastic.apm.agent.metrics.builtin.JvmGcMetrics$HotspotAllocationSupplier.<clinit>(JvmGcMetrics.java:73)

For our project with have adoptopenjdk/openjdk11-openj9 as base image. It seems that the given metric goes to much into VM specific details or should back-off if it does not find it.

@felixbarny
Copy link
Member

Seems like the problem is that J9 does include a class with the name com.sun.management.ThreadMXBean but the object returned by ManagementFactory.getThreadMXBean() is not an instance of that class. I'll add such a check. It would be great if you could try the fix out then.

felixbarny added a commit to felixbarny/apm-agent-java that referenced this issue Mar 1, 2019
felixbarny added a commit to felixbarny/apm-agent-java that referenced this issue Mar 1, 2019
@remmeier
Copy link
Author

remmeier commented Mar 1, 2019

thx! in general everything in the com.sun package is bound to cause issues at one or the other place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants