Skip to content

Cannot fetch jmx counter for GC with Java SDK agent #952

@usecloud

Description

@usecloud

Expected behavior

I am trying to fetch data from mbeans about last GC duration but I am receiving error

Actual behavior

RROR 18-06-2019 20:59:52.694+0000, 27(PerformanceCounterContainer-0): Failed to fetch JMX object 'java.lang:type=GarbageCollector,name=PS MarkSweep' with attribute 'LastGcInfo.#duration': 'java.lang.ClassCastException: sun.management.GcInfoCompositeData cannot be cast to javax.management.openmbean.CompositeDataSupport'
ERROR 18-06-2019 20:59:52.695+0000, 27(PerformanceCounterContainer-0): Error while fetching JMX data: 'java.lang.ClassCastException: sun.management.GcInfoCompositeData cannot be cast to javax.management.openmbean.CompositeDataSupport', The PC will be ignored
TRACE 18-06-2019 20:59:52.697+0000, 27(PerformanceCounterContainer-0): Stack trace generated is java.lang.ClassCastException: sun.management.GcInfoCompositeData cannot be cast to javax.management.openmbean.CompositeDataSupport
at com.microsoft.applicationinsights.internal.jmx.JmxDataFetcher.fetch(JmxDataFetcher.java:113)
at com.microsoft.applicationinsights.internal.jmx.JmxDataFetcher.fetch(JmxDataFetcher.java:72)
at com.microsoft.applicationinsights.internal.perfcounter.AbstractJmxPerformanceCounter.report(AbstractJmxPerformanceCounter.java:64)
at com.microsoft.applicationinsights.internal.perfcounter.PerformanceCounterContainer$1.run(PerformanceCounterContainer.java:251)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

To Reproduce

Steps to reproduce the behavior:
My configuration in ApplicationInsight

Sample Application

The application is running on Tomcat 9

System information

Please provide the following information:

  • SDK Version: 2.3.1
  • OS type and version: Linux
  • Application Server type and version (if applicable): Tomcat with Java 8
  • Using spring-boot? no
  • Additional relevant libraries (with version, if applicable):

Logs

Turn on SDK logs and attach/paste them to the issue. If using an application server, also attach any relevant server logs.

Be sure to remove any private information from the logs before posting!

Screenshots

If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions