How to connect JProfiler to an application running on localhost?
Asked Answered
V

2

9

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`
Victualage answered 8/11, 2011 at 16:10 Comment(0)
E
10

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.

Economist answered 9/11, 2011 at 9:22 Comment(13)
I have tried similar steps but still am not able to connect, am using windows system, could there be some issue in there?Victualage
You would have to provide more details. Using Windows is certainly not a problem. It sounds like the plugin is not loaded in your case. You could check the eclipse log to check if there was a related error.Economist
Ok, here is the thing, I am using windows platform and have local instance of jboss running and my application is running locally, also am starting my application using ant targets from cygwin commandline interface, when i start the application jprofiler is not able to find the jboss jvm instance and also in eclipse profile buttons are not activated, all i am trying to do in here is to run jprofiler on my application that is running on the localhost to get some usage statistics.Victualage
Also when i use Quick Attach functionality from JProfiler then it locates eclipse jvm instance but it does not locate jboss jvm instance and so this is the another issue am facing in getting JProfiler Configured, any suggestions?Victualage
Only JVMs with version 1.6 and higher can be detected if they run as the same user or as a local service. In your case I would suggest to run Session->Integration Wizards->New Server Integration and chooser the JBoss integration wizard. Also, your elicpse plugin installation has apparently not been successful. Have you had a look at the eclipse log?Economist
Yes my plugin was not installed properly, i have put that in plugins-plugins folder in eclipse but it should go to first plugins folder, also my application is running on 1.5 version and i did not understood about "if they run as the same user or as a local service", i have tried using New Server Integration still it does not work.Victualage
Also am not building application from eclipse, am doing it from commandline using ant targets and am not sure how would JProfiler pick it up, will it check for all running jvms, if yes then why does it not pick up jboss jvm?Victualage
jboss run.bat file is run using ant target as ant jboss.start and am not sure if this is ok with "run as same user or as local service", i would really appreciate if you can elaborate little more as it would be very helpful to understantVictualage
am having java 1.6 now and my jboss jvm is running and am able to find that from taskmanager but jprofiler is not picking up that jvm, is there anything that can make jprofiler to pick it up?Victualage
OK, then try "-agentpath:C:\Users\user~1.DOS\SOFTWA~1\JPROFI~1\bin\WINDOW~1\jprofilerti.dll=port=8849" as the VM parameter. Why it's not picked up, I don't know, check %USERPROFILE%/hsperfdata_%USERNAME%, it should create a PID file there. That's how the discovery mechanism works.Economist
what does %USERPROFILE%/hsperfdata_%USERNAME% refer to and how to interpret it?Victualage
%USERPROFILE% and %USERNAME% are Windows environment variables, replace them with the actual values on your systemEconomist
Hey Ingo Kegel, now am trying to connect JProfiler to remote application and it is still not able to connect, am passing required jvm options, first i tried with jboss.vmoptions and then i tried putting them inside jboss/bin/run.sh file but still it is not picking up, is there anything else that need to be done to make sure that jboss will pick it up am passing information about the remote location where i have installed jprofiler, i am kind of having hard time configuring it out, do you have any suggestions or thoughts that would point me to right direction?Victualage
N
2

I know that this is an old thread. Also I am not sure wether the problem described here is the same than the one that I mean.

A colleage of mine had a very similar problem: he could not see any local running JVM using the "Quick Attach" feature on Windows. Trying to add the jvm agent parameter or to reinstall JProfiler also didn't help.

The solution was to delete a folder called %USERPROFILE%\AppData\Local\Temp\hsperfdata_username after stopping all java processes. Probably something related to the permissions of this folder was messed up.

Nihilism answered 16/11, 2015 at 11:25 Comment(1)
This solved my issue than the actual answer of this post :D. Anyway if someone is following this answer, one quick tip: after deleting the hsprefdata folder, ensure you start the Jprofiler first to let JProfiler create this folder. Then things works normally.Marzi

© 2022 - 2024 — McMap. All rights reserved.