Elastic APM - Java agent for JDK1.7 applications

If you are asking about a problem you are experiencing, please use the following template, as it will help us help you. If you have a different problem, please delete all of this text :slight_smile:

APM Server version: 6.7

APM Agent language and version: Java and 1.5.0

We have Java applications running on JDK1.7 and need to enable Elastic APM. Exceptions are thrown when we use latest version of agent.

We tried to compile APM java agent source code with JDK1.7 and getting below exceptions

  • Tried with the oldest available jar version elastic-apm-agent-0.5.1.jar and getting the same error and container is not getting started.

Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe not found by org.apache.camel.camel-core [155]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_79]
... 58 more
2019-05-07 01:27:07,843 | INFO | 6.0.1-1-thread-1 | DeploymentAgent | 86 - io.fabric8.fabric-agent - 1.2.0.redhat-621084 | Validating baseline information
2019-05-07 01:27:10,434 | INFO | 6.0.1-1-thread-1 | Agent | 86 - io.fabric8.fabric-agent - 1.2.0.redhat-621084 | Done.

  • Tried to compile the source code of the old branch apm-agent-java-0.5 and they have a validation and minimum jdk required is jdk 1.9

[DEBUG] (f) mojoExecution = org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M1:enforce {execution: enforce-java}
[DEBUG] (s) project = MavenProject: co.elastic.apm:apm-agent-parent:0.5.1 @ /jenkins/jenkins_home/workspace/elkapm/apm-agent-java-0.5/pom.xml
[DEBUG] (s) version = 9
[DEBUG] (s) rules = [org.apache.maven.plugins.enforcer.RequireJavaVersion@51e7a255]
[DEBUG] (s) session = org.apache.maven.execution.MavenSession@3e52a475
[DEBUG] (s) skip = false
[DEBUG] -- end configuration --
[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireJavaVersion
[DEBUG] Rule org.apache.maven.plugins.enforcer.RequireJavaVersion is cacheable.
[DEBUG] Detected Java String: '1.7.0_79'
[DEBUG] Normalized Java String: '1.7.0-79'
[DEBUG] Parsed Version: Major: 1 Minor: 7 Incremental: 0 Build: 79 Qualifier: null
[DEBUG] Adding failure due to exception
org.apache.maven.enforcer.rule.api.EnforcerRuleException: Detected JDK Version: 1.7.0-79 is not in the allowed

Hi and welcome to the forum :slight_smile:

This looks like a class loading issue, maybe related to OSGi, or to side effects by agent actions causing alterations in class loading.

If you are using Java agent version 1.5.0, this is not the latest. We did some change in 1.6.0 that eliminated those side effects I was referring to, so please try out latest version, which is now 1.6.1 and see if the problem reproduces.

If so, this may be an OSGi-related issue, but in order to find out about it, you will need to provide more info about your system- which frameworks and technologies are used by your application. The more info you provide, the better chances for us to analyze.

In addition, a full log will be much more useful. The current section you enclosed only shows the end of the problematic stack trace.

Thanks,
Eyal.

Hi Eyal,
Thanks for quick response .
we have tried using the latest 1.6.1 version.
however we are facing the same issue .Please find the Log and full exception stacktrace. and the jboss fuse process .
Kindly help us in fixing the below issue.

process:
00:00:29 /jboss/fuse/java/oracle/1.7/jre/bin/java -server -Dcom.sun.management.jmxremote -Dorg.jboss.gravia.repository.storage.dir=data/repository --------
-Dkaraf.admin.role=admin -Djava.naming.referral=ignore -javaagent:/jboss/fuse/apm/elastic-apm-agent-1.6.1.jar-Delastic.apm.service_name=HKLVATAPP301-fc20-entitlements-uat_cedd_gg_01 -Delastic.apm.application_packages=com.scb.cic -Delastic.apm.log_level=INFO -Delastic.apm.server_urls=http://10.23.219.179:8200 -XX:+UnlockDiagnosticVMOptions -XX:+UnsyncloadClass -Dio.fabric8.datastore.gitRemotePollInterval=60000 -Dio.fabric8.datastore.importDir=fabric -Dio.fabric8.datastore.felix.fileinstall.filename=file:/jboss/fuse/6.2/uat_cedd_gg_01/etc/io.fabric8.datastore.cfg -Dio.fabric8.datastore.service.pid=io.fabric8.datastore -Dio.fabric8.datastore.component.name=io.fabric8.datastore -----------------
-classpath /jboss/fuse/6.2/uat_cedd_gg_01/lib/org.apache.karaf.diagnostic.core-2.4.0.redhat-621084.jar:/jboss/fuse/6.2/uat_cedd_gg_01/lib/esb-version.jar:/jboss/fuse/6.2/uat_cedd_gg_01/lib/org.apache.servicemix.specs.locator-2.5.0.jar:/jboss/fuse/6.2/uat_cedd_gg_01/lib/karaf-jmx-boot.jar:/jboss/fuse/6.2/uat_cedd_gg_01/lib/karaf.jar:/jboss/fuse/6.2/uat_cedd_gg_01/lib/karaf-jaas-boot.jar:/jboss/fuse/6.2/uat_cedd_gg_01/lib/org.apache.servicemix.specs.activator-2.5.0.jar org.apache.karaf.main.Main

Exception Log:
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean .camelBlueprint.factory.prospectSolrContext
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:714)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[15:org.apache.aries.blueprint.core:1.4.4]
at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:754)[15:org.apache.aries.blueprint.core:1.4.4]
at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:965)[152:org.apache.camel.camel-blueprint:2.15.1.redhat-621084]

    at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745)[:1.7.0_79]

Caused by: java.lang.NoClassDefFoundError: sun/misc/Unsafe
at org.apache.camel.com.googlecode.concurrentlinkedhashmap.ConcurrentHashMapV8.getUnsafe(ConcurrentHashMapV8.java:4136)
at org.apache.camel.com.googlecode.concurrentlinkedhashmap.ConcurrentHashMapV8.(ConcurrentHashMapV8.java:4101)

    at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)
    ... 35 more

Caused by: java.lang.ClassNotFoundException: sun.misc.Unsafe not found by org.apache.camel.camel-core [155]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_79]

Thanks.

indent preformatted text by 4 spaces

Can you upload the full log?
And some information about your app stack?
Thanks.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.