cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
463
Views
0
Helpful
3
Replies

Exception while attaching to running java process with javaagent.jar

krkothan
Cisco Employee
Cisco Employee

I need to attach to the  running java process id 1395 and is issuing below cmd for the same.

  $>sudo java -Xbootclasspath/a:/usr/local/java/amazon-corretto-8.252.09.1-linux-x64/lib/tools.jar -jar  /home/centos/JavaAgentDownoad/agentapp/javaagent.jar 1395

Getting below exception.


Attaching to VM [1395]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.singularity.ee.agent.appagent.AgentEntryPoint.main(AgentEntryPoint.java:1176)
Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:106)
at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)
... 5 more
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.singularity.ee.agent.appagent.AgentEntryPoint.main(AgentEntryPoint.java:1190)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.singularity.ee.agent.appagent.AgentEntryPoint.main(AgentEntryPoint.java:1176)
Caused by: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded
at sun.tools.attach.LinuxVirtualMachine.<init>(LinuxVirtualMachine.java:106)
at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:63)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)
... 5 more

Kindly update on how to resolve the issue.

1 Accepted Solution

Accepted Solutions

krkothan
Cisco Employee
Cisco Employee

Thanks, Its resolved now by updating the path for CATALINA_OPTS env variable.

Actually, I referred earlier “Getting Started Wizard -Java” and had configured env variable “CATALINA_OPTS” in “catalina.sh” file considering base path as “/usr/local”.

Later I referred the “https://developer.cisco.com/learning/modules/appdynamics-fundamentals/fnd-01-appd-apm-java/install-the-appdynamics-java-apm-agent/”  and as per this, added another env variable “CATALINA_OPTS” with base path as “/opt/”.

Though the appagent files were relocated w.r.t the path referred in above 2 cases, the duplicate entries for CATALINA_OPTS variable  with different path was causing the issue.

Later after removing duplicate env variable entry with incorrect path entry, it is working fine now.

View solution in original post

3 Replies 3

dstaudt
Cisco Employee
Cisco Employee

Can you provide some details: which sandbox, which Cisco product/API (AppDynamics?)...what are you attempting to accomplish when the error occurs?

krkothan
Cisco Employee
Cisco Employee

Thanks.
I am learning from https://developer.cisco.com/learning/modules/appdynamics-fundamentals and is working on
"Java Application Montoring Fundamentals"--->Completed Step 1 . Download the AppDynamics Java APM Agent and is in Step 2. Install the AppDynamics Java APM Agent where I was facing the issue.  I have installed  the javaagent in a different path and had not executed "chown ".   Now seems to be working.

But now the tomcat manager URL is not accessible and tomcat server is not running on 8080.
 url: http://10.10.20.10:8080/manager/html 

This was accessible yesterday. Server is accessible via ssh otherwise.
Can you share support link where vm issue ticket can be raised or suggest how to resolve this.?

 

krkothan
Cisco Employee
Cisco Employee

Thanks, Its resolved now by updating the path for CATALINA_OPTS env variable.

Actually, I referred earlier “Getting Started Wizard -Java” and had configured env variable “CATALINA_OPTS” in “catalina.sh” file considering base path as “/usr/local”.

Later I referred the “https://developer.cisco.com/learning/modules/appdynamics-fundamentals/fnd-01-appd-apm-java/install-the-appdynamics-java-apm-agent/”  and as per this, added another env variable “CATALINA_OPTS” with base path as “/opt/”.

Though the appagent files were relocated w.r.t the path referred in above 2 cases, the duplicate entries for CATALINA_OPTS variable  with different path was causing the issue.

Later after removing duplicate env variable entry with incorrect path entry, it is working fine now.