# Unable to attach standalone agent to weblogic 12.2

**URL:** <https://discuss.elastic.co/t/unable-to-attach-standalone-agent-to-weblogic-12-2/248249>\
**Category:** APM\
**Tags:** java\
**Created:** [September 11, 2020, 1:41am UTC](https://discuss.elastic.co/t/unable-to-attach-standalone-agent-to-weblogic-12-2/248249 "2020-09-11T01:41:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhavani\_Ananth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavani_ananth/32/45740_2.png) [@Bhavani\_Ananth](https://discuss.elastic.co/u/Bhavani_Ananth)\
**Post date:** [September 11, 2020, 1:41am UTC](https://discuss.elastic.co/t/unable-to-attach-standalone-agent-to-weblogic-12-2/248249/1 "2020-09-11T01:41:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bhavani\_Ananth](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavani_ananth/32/45740_2.png) [@Bhavani\_Ananth](https://discuss.elastic.co/u/Bhavani_Ananth)\
**Post date:** [September 14, 2020, 11:34am UTC](https://discuss.elastic.co/t/unable-to-attach-standalone-agent-to-weblogic-12-2/248249/2 "2020-09-14T11:34:58Z")

</div>

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

Thanks Again!  
regards,  
Bhavani

---

<div class="post-metadata">

**Author:** ![Sylvain\_Juge](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sylvain_juge/32/55521_2.png) [@Sylvain\_Juge](https://discuss.elastic.co/u/Sylvain_Juge)\
**Post date:** [September 15, 2020, 2:30pm UTC](https://discuss.elastic.co/t/unable-to-attach-standalone-agent-to-weblogic-12-2/248249/3 "2020-09-15T14:30:50Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 6, 2020, 10:30am UTC](https://discuss.elastic.co/t/unable-to-attach-standalone-agent-to-weblogic-12-2/248249/4 "2020-10-06T10:30:56Z")

</div>

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