1 Reply Latest reply: Dec 5, 2009 1:47 PM by 843798 RSS

    VisualVM standalone won't attach, but NetBeans profiler will

    843798
      I have a JDK1.5 app that I want to profile with VisualVM. I have started the app using the following JVM parameter:
      -agentpath:"C:\Program Files\VisualVM\profiler3\lib\deployed\jdk15\windows\profilerinterface.dll=\"C:\Program Files\VisualVM\profiler3\lib\"",3333
      The app starts, with the message that it is listening on port 3333 awaiting connection. Now if I configure VisualVM to look to port 3333 under jstatd connections, it attempts to connect but the remote app dies with the following error:
      Profiler Agent Error: Exception when trying to establish connection with client:
      java.io.StreamCorruptedException: invalid stream header
      The same thing happens if I try to create a jmx connection to localhost:3333.

      Now the weird thing is if I configure netbeans profiler to connect to port 3333 and attempt to profile this application, it works fine. My question is, what is the difference between the two. I have tried connecting with VisualVM 1.1.1 and 1.2.1 and neither work.
        • 1. Re: VisualVM standalone won't attach, but NetBeans profiler will
          843798
          Hi,

          VisualVM can only profile local applications running on JDK 6. If you enable [JMX agent|http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html] in your application, you can "profile" your application with [VisualVM-Sampler plugin|http://java.dzone.com/announcements/visualvm-12-great-java] available for VisualVM 1.2.1. Note that VisualVM is a Java monitoring and troubleshooting tool - it detects and recognizes running applications, browses their MBeans, takes thread and heap dumps, shows VM configuration and metrics and saves these information into application snapshots. It uses four different technologies (Jvmstat, JMX, Attach API and Serviceablity agent) to extract useful information from running JVM and present them in the one integrated view. It also provides basic profiling capabilities, but that's just one of the features. If you need a full-featured mature Java profiler for your daily development use NetBeans Profiler.

          Bye.