Unable to attach standalone agent to weblogic 12.2

Hello Team,
The following are the details

Kibana version: 7.8.1

Elasticsearch version: 7.8.1

APM Server version: apm-agent-attach-1.18.0.RC1-standalone
APM Agent language and version: Java, Weblogic 12.2.1.2.0
Original install method (e.g. download page, yum, deb, from source, etc.) and version: downloaded apm-agent-attach-1.18.0.RC1-standalone.jar from maven central
Fresh install or upgraded from other version? Fresh
Is there anything special in your setup? For example, are you using the Logstash or Kafka outputs? Are you using a load balancer in front of the APM Servers? Have you changed index pattern, generated custom templates, changed agent configuration etc. No

Description of the problem including expected versus actual behavior. Please include screenshots (if relevant):

When attaching weblogic's PID to the standalone.jar using the following command,
java -jar apm-agent-attach-1.18.0.RC1-standalone.jar --pid <> --config service_name=Svc server_urls=http://xx.xx.xx.xx:8200 config_file=elasticapm.properties

We encounter the following exception,

java.lang.NoClassDefFoundError: Could not initialize class co.elastic.apm.agent.servlet.ServletApiAdvice
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at java.lang.invoke.DirectMethodHandle$EnsureInitialized.computeValue(DirectMethodHandle.java:330)
at java.lang.invoke.DirectMethodHandle$EnsureInitialized.computeValue(DirectMethodHandle.java:327)
at java.lang.ClassValue.getFromHashMap(ClassValue.java:227)
at java.lang.ClassValue.getFromBackup(ClassValue.java:209)
at java.lang.ClassValue.get(ClassValue.java:115)
at java.lang.invoke.DirectMethodHandle.checkInitialized(DirectMethodHandle.java:351)
at java.lang.invoke.DirectMethodHandle.ensureInitialized(DirectMethodHandle.java:341)
at java.lang.invoke.DirectMethodHandle.internalMemberNameEnsureInit(DirectMethodHandle.java:291)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:247)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3679)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3649)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326)
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197)
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259)
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651)
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270)
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)
** at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)**
** at weblogic.work.ExecuteThread.run(ExecuteThread.java:346)**
java.lang.NoClassDefFoundError: Could not initialize class co.elastic.apm.agent.servlet.ServletApiAdvice

Weblogic is running in production and we have to quicky find/resolve some performance issues. How do we go about this? Is it possible to get the traces by attaching the standalone.jar to the PID of the server.

Thanks for your help!

Regards

Even with 1.18, it is throwing the same error.
Any help here would be appreciated.

Thanks Again!
regards,
Bhavani

Hi @Bhavani_Ananth,

Thanks for reporting this error.

Have you tried to use JVM settings and -javaagent parameter to setup the agent to see if that makes any difference ? One downside is that it requires to stop/restart the whole server.

Runtime attach is currently in beta as of version 1.18.0, and Weblogic is known to have some compatibility issues due to Classloading.

Are there any specific settings relevant to your Weblogic setup ?

  • using a domain or standalone server ?
  • is there any security policy or SecurityManager ?