Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to perform runtime attachment of the stagemonitor agent #7

Open
johnsmitherpn5 opened this issue May 14, 2015 · 8 comments
Open

Comments

@johnsmitherpn5
Copy link

Hi,

I am trying to run "spring-petclinic" application to see the stagemonitor "In Browser Widget". I am using STS and WebSphere 8.5.

Followed your wiki "Set up stagemonitor with your own Application". But getting issues. Please see below...

INFO  AgentLoader - Unavailable or unrecognised attach API : java.lang.ClassNotFoundException: com.sun.tools.attach.VirtualMachine
INFO  MainStagemonitorClassFileTransformer - Registering SpringMvcRequestNameDeterminerInstrumenter
INFO  MainStagemonitorClassFileTransformer - Registering ProfilingInstrumenter
WARN  ElasticsearchClient - Failed to read stagemonitor version from manifest (class is not in jar)
INFO  MainStagemonitorClassFileTransformer - Registering MonitorRequestsInstrumenter
INFO  MainStagemonitorClassFileTransformer - Registering ExceptionMeteredInstrumenter
INFO  MainStagemonitorClassFileTransformer - Registering MeteredInstrumenter
INFO  MainStagemonitorClassFileTransformer - Registering TimedInstrumenter
INFO  MainStagemonitorClassFileTransformer - Registering GaugeInstrumenter
INFO  MainStagemonitorClassFileTransformer - Registering ConnectionMonitoringInstrumenter
WARN  MainStagemonitorClassFileTransformer - Failed to perform runtime attachment of the stagemonitor agent. You can load the agent with the command line argument -javaagent:/path/to/stagemonitor-javaagent-<version>.jar
java.lang.NullPointerException: null
    at org.stagemonitor.core.instrument.MainStagemonitorClassFileTransformer.performRuntimeAttachment(MainStagemonitorClassFileTransformer.java:61) ~[na:0.13.0]
    at org.stagemonitor.web.attach.RuntimeAgentAttacherListener.<init>(RuntimeAgentAttacherListener.java:25) [na:0.13.0]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.7.0_79]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [na:1.7.0_79]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [na:1.7.0_79]
    at java.lang.reflect.Constructor.newInstance(Unknown Source) [na:1.7.0_79]
    at java.lang.Class.newInstance(Unknown Source) [na:1.7.0_79]
    at java.beans.Beans.instantiate(Unknown Source) [na:1.7.0_79]
    at java.beans.Beans.instantiate(Unknown Source) [na:1.7.0_79]
    at com.ibm.ws.webcontainer.webapp.WebApp.loadListener(WebApp.java:2339) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.webcontainer.osgi.webapp.WebApp.loadListener(WebApp.java:827) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.webcontainer.webapp.WebApp.loadLifecycleListeners(WebApp.java:2246) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1040) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6404) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:248) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:313) [com.ibm.ws.webcontainer_1.0.8.jar:na]
    at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:241) [com.ibm.ws.transport.http_1.0.8.jar:na]
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:306) [com.ibm.ws.transport.http_1.0.8.jar:na]
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:449) [com.ibm.ws.transport.http_1.0.8.jar:na]
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:383) [com.ibm.ws.transport.http_1.0.8.jar:na]
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:283) [com.ibm.ws.transport.http_1.0.8.jar:na]
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:254) [com.ibm.ws.transport.http_1.0.8.jar:na]
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174) [com.ibm.ws.channelfw_1.0.8.jar:na]
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83) [com.ibm.ws.channelfw_1.0.8.jar:na]
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504) [com.ibm.ws.channelfw_1.0.8.jar:na]
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574) [com.ibm.ws.channelfw_1.0.8.jar:na]
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929) [com.ibm.ws.channelfw_1.0.8.jar:na]
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018) [com.ibm.ws.channelfw_1.0.8.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_79]
    at java.lang.Thread.run(Unknown Source) [na:1.7.0_79]

Thanks

@trampi
Copy link
Member

trampi commented May 15, 2015

Hello johnsmitherpn5!

Quoting the error from your stacktrace:

Failed to perform runtime attachment of the stagemonitor agent. You can load the agent with the command line argument -javaagent:/path/to/stagemonitor-javaagent-<version>.jar

Unfortunately i haven't had an opportunity to use WebSphere myself, but the following guide might help you configuring the stagemonitor agent properly:
https://docs.newrelic.com/docs/agents/java-agent/frameworks/websphere-installation-java#install

If you need further assistance: Just ask :-)

@johnsmitherpn5
Copy link
Author

@trampi : Sure...will look into the guide and let you know. Thanks for the quick response.

@johnsmitherpn5
Copy link
Author

@trampi : I tried those instructions in the guide. But same issue. I changed my server to "Tomcat 7". Still same issue.

I thought may be the issue is with tools.jar. So added tools.jar to classpath of the server and now I am getting different error. Please see below...

java.util.ServiceConfigurationError: com.sun.tools.attach.spi.AttachProvider: Provider sun.tools.attach.WindowsAttachProvider could not be instantiated

I am using Windows 7 64bit and JDK version "jdk1.7.0_79" 64bit.
Spring Tool Suite
Version: 3.6.4.RELEASE
Build Id: 201503100339
Platform: Eclipse Luna SR1 (4.4.2)

java.util.ServiceConfigurationError: com.sun.tools.attach.spi.AttachProvider: Provider sun.tools.attach.WindowsAttachProvider could not be instantiated
WARN  MainStagemonitorClassFileTransformer - Failed to perform runtime attachment of the stagemonitor agent. You can load the agent with the command line argument -javaagent:/path/to/stagemonitor-javaagent-<version>.jar
java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_79]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_79]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_79]
    at org.stagemonitor.core.instrument.AgentLoader.loadAgent(AgentLoader.java:154) ~[stagemonitor-core-0.14.0.jar:0.14.0]
    at org.stagemonitor.core.instrument.MainStagemonitorClassFileTransformer.performRuntimeAttachment(MainStagemonitorClassFileTransformer.java:58) ~[stagemonitor-core-0.14.0.jar:0.14.0]
    at org.stagemonitor.web.attach.RuntimeAgentAttacherListener.<clinit>(RuntimeAgentAttacherListener.java:25) [stagemonitor-web-0.14.0.jar:0.14.0]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.7.0_79]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) [na:1.7.0_79]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) [na:1.7.0_79]
    at java.lang.reflect.Constructor.newInstance(Unknown Source) [na:1.7.0_79]
    at java.lang.Class.newInstance(Unknown Source) [na:1.7.0_79]
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:116) [catalina.jar:7.0.62]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4932) [catalina.jar:7.0.62]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528) [catalina.jar:7.0.62]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.62]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575) [catalina.jar:7.0.62]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565) [catalina.jar:7.0.62]
    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.7.0_79]
    at java.lang.Thread.run(Unknown Source) [na:1.7.0_79]
Caused by: com.sun.tools.attach.AttachNotSupportedException: no providers installed
    at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:208) ~[na:na]
    ... 22 common frames omitted

@felixbarny
Copy link
Member

Are you using a JDK or JRE? Which JDK/JRE are you using (Oracle, Open JDK, ...)? Does this example work on your machine?

@johnsmitherpn5
Copy link
Author

@felixbarny : I am using Oracle JDK 1.7.0_79. Yes...the example works on my machine. I am getting this issue when I run this from STS using Tomcat 7.

@felixbarny
Copy link
Member

I've just downloaded STS and deploying petclinic on Tomcat 7 works on my machine...
Could you paste the head of the logs when you try to start the server? Maybe there is something misconfigured. Mabe it's using the wrong JAVA_HOME.

This is what I get:

Mai 18, 2015 6:15:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNUNG: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:spring-petclinic' did not find a matching property.
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Server version:        Apache Tomcat/7.0.57
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Server built:          Nov 3 2014 08:39:16 UTC
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Server number:         7.0.57.0
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: OS Name:               Mac OS X
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: OS Version:            10.10.3
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Architecture:          x86_64
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: JAVA_HOME:             /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: JVM Version:           1.7.0_75-b13
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: JVM Vendor:            Oracle Corporation
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: CATALINA_BASE:         /Users/felixbarnsteiner/Documents/workspace-sts-3.6.4.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: CATALINA_HOME:         /Users/felixbarnsteiner/Applications/Server/apache-tomcat-7.0.57
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:50638
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dcatalina.base=/Users/felixbarnsteiner/Documents/workspace-sts-3.6.4.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dcatalina.home=/Users/felixbarnsteiner/Applications/Server/apache-tomcat-7.0.57
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dwtp.deploy=/Users/felixbarnsteiner/Documents/workspace-sts-3.6.4.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Djava.endorsed.dirs=/Users/felixbarnsteiner/Applications/Server/apache-tomcat-7.0.57/endorsed
Mai 18, 2015 6:15:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMATION: Command line argument: -Dfile.encoding=UTF-8

@johnsmitherpn5
Copy link
Author

@felixbarny : You are right. Tomcat server in my STS is using wrong JAVA_HOME. When I installed jdk-7 it installed both JDK as well as JRE. I set JAVA_HOME to C:\Program Files\Java\jdk1.7.0_79... but Tomcat Server is picking up the JRE instead of JDK and it showed C:\Program Files\Java\jre in the logs. I reconfigured JRE in the Tomcat Runtime Environment to jdk1.7.0_79
image

...now everything works fine.

Thanks a lot for your help.

@felixbarny
Copy link
Member

You're welcome, I'm glad I could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants