How to connect JProfiler to an application running on localhost?

Rachel picture Rachel · Nov 8, 2011 · Viewed 67.2k times · Source

I have an application running on my localhost and I want to profile the application to see how can I enhance the performance of the application. I am doing the setup steps as defined but it is not able to connect to localhost server, is there a proper step by step guideline available on how to:

  1. Configure JProfiler to work with application running on localhost?
  2. How to profile and what areas to look for while profiling for an application?
  3. Configure JProfiler with Eclipse IDE, right now am able to see profile in run dropdowns in eclipse but they are not activated and so how can it be activated?

I have similar issue as in this question but am not able to understand the solution, any suggestions on this would be really appreciated.

I am tried for sometime now without any success on configuring JProfiler to work with application running on localhost, any suggestions would be highly appreciated.

I am new to profiling application world and so would really appreciate if you can provide some useful pointers

I am getting following error message:

Could not connect to 127.0.0.1:8849. Please make sure that the remote address is correct, the remote program is started properly, and the network route allows socket connections. and I have set up configuration using New Server Integration, not sure what else needs to be done and how can this be fixed.

After adding -agentpath:C:\Users\user~1.DOS\SOFTWA~1\JPROFI~1\bin\WINDOW~1\jprofilerti.dll=port=8849,nowait,id=117,config=C:\Users\user\.jprofiler6\config.xml to vm arguments under run configuration and then when i run configuration i get

JProfiler> Protocol version 32
JProfiler> Using JVMTI
JProfiler> JVMTI version 1.1 detected.
JProfiler> 64-bit library
JProfiler> Don't wait for frontend to connect.
JProfiler> Using config file C:\Users\user\.jprofiler6\config.xml (id: 117)
JProfiler> Could not find session with id: 117`

Answer

Ingo Kegel picture Ingo Kegel · Nov 9, 2011

Manually adding a VM parameter to a run configuration in eclipse is not recommended for profiling with JProfiler.

For more on the eclipse IDE integration, see this screen cast and this help page. You can then profile JBoss with an eclipse run configuration without adding any VM parameters.

There are other ways to profile without manually adding any VM parameters:

  1. The easiest way to get started is to use the "Quick attach" feature in JProfiler. With "Session->Quick Attach" you get a list of running JVMs that you can profile without having to add any JVM parameters.

  2. If you miss source code navigation to eclipse in the above step, the same action is available in eclipse if the JProfiler plugin is installed.

enter image description here

  1. For standalone configuration, use the integration wizard by invoking "Session->Integration Wizards->New Server Integration" from JProfiler's main menu. The integration wizard will modify the start script, so that you don't have to add any VM parameters.

For the error message that you got, I suspect that C:\Users\user\.jprofiler6\config.xml does not exist. Reducing the parameter to -agentpath:C:\Users\user~1.DOS\SOFTWA~1\JPROFI~1\bin\WINDOW~1\jprofilerti.dll=port=8849 will work, then the JBoss VM will wait until you connect with a session of type "Attach to JVM (local or remote)" from JProfiler. Anyway, adding VM parameters manually is only necessary in special situations.