Splunk AppDynamics

AppDynamics unable to connect with java agent

CommunityUser
Splunk Employee
Splunk Employee

While connecting java agent with AppDynamics observed below error. please help to resolve this and connect the java agent to AppDynamics:

C:\Windows\system32> java -Xbootclasspath/a:"C:\Program Files\Java\jdk1.8.0_131\lib\tools.jar" -jar "D:\2019\Monitoring_utilities\AppServerAgent\javaagent.jar" 4875
Attaching to VM [4875]
java.util.ServiceConfigurationError: com.sun.tools.attach.spi.AttachProvider: Provider sun.tools.attach.WindowsAttachProvider could not be instantiated
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.singularity.ee.agent.appagent.AgentEntryPoint.main(AgentEntryPoint.java:658)
Caused by: com.sun.tools.attach.AttachNotSupportedException: no providers installed
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:203)

I am stuck due to this & unable to use AppDynamics for java resources. 

Labels (1)
0 Karma

David_Hope
Explorer

Hi Rahul,

I see that you are using Dynamic Attach to connect to a live Java process. Is there any reason you can't start the process using the "-javaagent" parameter instead?

Dynamic Attach isn't really an AppDynamics feature, rather, a feature of the JVM. The JVM needs to have the correct libraries loaded in order for Dynamic Attach to be successful.

It seems that at least for this Windows system that library was not loaded and it's very tricky to get a Native library loaded once the JVM has started.

There is some information on this StackOverflow Thread:

https://stackoverflow.com/questions/11134159/how-to-load-attachprovider-attach-dll-dynamically

I recommend either starting the process with the Javaagent command line parameter and if that is not possible you need the process to be started with the correct java.library.path to the attach.dll native library.

Kind Regards,

David

CommunityUser
Splunk Employee
Splunk Employee

With command line parameter application get successfully started but still shows waiting for the connection. we are referring "Getting started wizard - java".

so please provide details steps if any.

0 Karma

David_Hope
Explorer

Hi Rahul,

Can you upload a screenshot showing the output, please?

Kind Regards,

David

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

image.png

0 Karma

David_Hope
Explorer

I noticed in the command line you didn't specify the required properties:

C:\Windows\system32> java -Xbootclasspath/a:"C:\Program Files\Java\jdk1.8.0_131\lib\tools.jar" -jar "D:\2019\Monitoring_utilities\AppServerAgent\javaagent.jar" 4875

Try something like this instead with all the values set:

java -Xbootclasspath/a:"C:/Program Files/Java/jdk1.8.0_151/lib/tools.jar" -jar C:/appdynamics/AppServerAgent-4.5.8.25115/javaagent.jar 14760 appdynamics.controller.hostName=somehost,appdynamics.controller.port=someport,appdynamics.controller.ssl.enabled=false,appdynamics.agent.accountAccessKey=somevalue,appdynamics.agent.applicationName=Doughuts,appdynamics.agent.tierName=DT1,appdynamics.agent.nodeName=DN1,appdynamics.agent.accountName=someaccount

Failing that, are there any logs in the following folder with any useful information?

AppServerAgent-4.x.x.xxxxx\ver4.x.x.xxxxx\logs

Kind Regards,

David

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

Hi,

I have already tried this. please check screenshot for error. also, the specified log folder is empty, no log file get generated there.image.png

0 Karma

CommunityUser
Splunk Employee
Splunk Employee

I have still observed the same issue, even after following the steps provided in the mail.

0 Karma

Ankur_Joshi
Explorer

HI Rahul/David,

I am getting same error, I am not able to connect javaagent to my apache tomcat based application.

Please help me if found solution.

Thanks,

Rakhi

0 Karma

David_Hope
Explorer

Hi Ankur,

Are you also using Dynamic Attach? Have you tried to do this using the normal method (by adding -javaagent to the startup command)?

Kind Regards,

David

Ankur_Joshi
Explorer

Hi David,

I am running below command in windows command prompt and getting error:

 

C:\Program Files\Java\jdk1.8.0_191>java -Xbootclasspath/a:lib\tools.jar -jar C:\Data\AppDynamics\AppServerAgent-4.5.18.29239\javaagent.jar 18552
Attaching to VM [18552]
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:1144)
Caused by: java.io.IOException: no such process
at sun.tools.attach.WindowsVirtualMachine.openProcess(Native Method)
at sun.tools.attach.WindowsVirtualMachine.<init>(WindowsVirtualMachine.java:56)
at sun.tools.attach.WindowsAttachProvider.attachVirtualMachine(WindowsAttachProvider.java:69)
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:1158)
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:1144)
Caused by: java.io.IOException: no such process
at sun.tools.attach.WindowsVirtualMachine.openProcess(Native Method)
at sun.tools.attach.WindowsVirtualMachine.<init>(WindowsVirtualMachine.java:56)
at sun.tools.attach.WindowsAttachProvider.attachVirtualMachine(WindowsAttachProvider.java:69)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208)
... 5 more

Thanks,

Rakhi

0 Karma

Ankur_Joshi
Explorer

Hi David,

Plz help to correct below command:

C:\Program Files\Java\jdk1.8.0_191>java -Xbootclasspath/a:lib\tools.jar -jar C:\Data\AppDynamics\AppServerAgent-4.5.18.29239\javaagent.jar 18552

I want to run on Windows OS only this Java agent. My Java applivation is running on tomcat server.

on windows. I tried Machine agent, it worked fine on my windows system.

Thank,

Rakhi

0 Karma

David_Hope
Explorer

Hi there, I see the following message:

"Caused by: java.io.IOException: no such process"

Are you sure you have the right process id in the command? on windows you can find the process id using the "tasklist" command.

Kind Regards,

David

Ankur_Joshi
Explorer

Hi David,

 

C:\Program Files\Java\jdk1.8.0_191>java -Xbootclasspath/a:lib\tools.jar -jar C:\Data\AppDynamics\AppServerAgent-4.5.18.29239\javaagent.jar 1432
Attaching to VM [1432]
agent path >>>C:\Data\AppDynamics\AppServerAgent-4.5.18.29239\javaagent.jar

C:\Program Files\Java\jdk1.8.0_191>

Above is Working for me  now, I started my tomcat where my application is running, 

C:\apache-tomcat-8.5.51\bin>startup.bat restart
Using CATALINA_BASE: "C:\apache-tomcat-8.5.51"
Using CATALINA_HOME: "C:\apache-tomcat-8.5.51"
Using CATALINA_TMPDIR: "C:\apache-tomcat-8.5.51\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_191"
Using CLASSPATH: "C:\apache-tomcat-8.5.51\bin\bootstrap.jar;C:\apache-tomcat-8.5.51\bin\tomcat-juli.jar"
C:\apache-tomcat-8.5.51\bin>

I could see a new window for tomcat, and there it is showing:

Started AppDynamic Java Agent Successfully. message as below:

[Thread-9] Fri Feb 21 22:54:57 IST 2020[INFO]: JavaAgent - Java Agent AppAgent directory [C:\Data\AppDynamics\AppServerAgent-4.5.18.29239\ver4.5.18.29239]
Agent logging directory set to [C:\Data\AppDynamics\AppServerAgent-4.5.18.29239\ver4.5.18.29239\logs]
[Thread-9] Fri Feb 21 22:54:57 IST 2020[INFO]: JavaAgent - Agent logging directory set to [C:\Data\AppDynamics\AppServerAgent-4.5.18.29239\ver4.5.18.29239\logs]
Registered app server agent with Node ID[13314] Component ID[12071] Application ID [7613]
Started AppDynamics Java Agent Successfully.

Now in UI i.e. https://bruce202001142354425.saas.appdynamics.com/controller/#/location=SETTINGS_AGENTS&timeRange=la...

I want to see my application and monitor the same. which I am unable to see anything. I tried searching with NodeID too, didnt got. Please help for same.

Thanks and regards,

Rakhi

David_Hope
Explorer

Great thanks, you're missing a crutical argument (after the process id), see below:

java -Xbootclasspath/a:"C:/Program Files/Java/jdk1.8.0_151/lib/tools.jar" -jar C:/appdynamics/AppServerAgent-4.5.8.25115/javaagent.jar 14760 appdynamics.controller.hostName=somehost,appdynamics.controller.port=someport,appdynamics.controller.ssl.enabled=false,appdynamics.agent.accountAccessKey=somevalue,appdynamics.agent.applicationName=Doughuts,appdynamics.agent.tierName=DT1,appdynamics.agent.nodeName=DN1,appdynamics.agent.accountName=someaccount

Kind Regards,

David

Get Updates on the Splunk Community!

New This Month - Splunk Observability updates and improvements for faster ...

What’s New? This month, we’re delivering several enhancements across Splunk Observability Cloud for faster and ...

What's New in Splunk Cloud Platform 9.3.2411?

Hey Splunky People! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2411. This release ...

Buttercup Games: Further Dashboarding Techniques (Part 6)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...