Working with a service...

Questions about YourKit Java Profiler
Post Reply
brownalan
Posts: 2
Joined: Fri Nov 19, 2004 12:13 am

Working with a service...

Post by brownalan »

I have a java app that is run as a service on a remote machine. I have added -Xrunyjpagent to the command line of the java command that the service invokes. I have confirmed that java -Xrunyjagent:help works ok (I have the dll in my path). However, the service fails to start up when I add the runyjpagent option.

What am I doing wrong? Is there something obvious that I'm missing about how services run (does my regular system path not apply to services?), or does yjp have an issue with services (seems highly unlikely).

Forgive me if the answer to my question is slightly OT (ie. if the answer is regarding paths and services), but I need to fix this asap.

thanks.

alan
lionel
Posts: 2
Joined: Tue May 24, 2005 1:42 am

Working with a service

Post by lionel »

Was there any answer to this question?

I am trying to test an application running in Tomcat. However on the production server it runs as a service.

I did a test on our dev boxes and I can run the agent with Tomcat using the startup script. But if I had the jvm option to the registry and try and start tomcat as a service it fails without a reason why?
lionel
Posts: 2
Joined: Tue May 24, 2005 1:42 am

No Answer

Post by lionel »

No answer. If it can't run when Tomcat is a service its pretty useless for profiling any applications in a windows production environment. No one is going to running a production application in a console.
Its a shame because real advantage of having a profiler with "zero" overhead would be its ability to be used in production environments without degrading the performance of the server.
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Hi Alan,

we are investigating the issue. It looks like yjpagent.dll isn't in the PATH when service starts.

Regards,
Vladimir
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

1. Please make sure you alter system PATH, not user.

2. Alternatively, if you're running Tomcat with Java 5.0, instead of -agentlib:yjpagent try -agentpath:full_path_to_yjpagent.dll
mjtrefethen
Posts: 1
Joined: Sat May 28, 2005 3:14 pm

Encountered and Fixed / Bandaided this Issue

Post by mjtrefethen »

I encountered this exact same issue attempting to profile a third party vendor's bootstrapped installation of JBoss running Sun 1.4.2 JRE on Windows 2000. The yjpagent.dll was in the system path and I could execute it via command line, obviously using my logged in user path, but the service account could not locate the dll.

With some quick research on how JVMPI loads the agent I found this note :

"The VM attempts to locate a profiler agent library called myprofiler in Java's library directory:

* On Microsoft Windows, it is [value of java.home property]\bin\myprofiler.dll
* On SPARC/Solaris, it is [value of java.home property]/lib/sparc/libmyprofiler.so

If the library is not found in the Java library directory, the VM continues to search for the library following the normal library search mechanism of the given platform:

* On Microsoft Windows, the VM searches the current directory, Windows system directories, and the directories in the PATH environment variable.
* On Solaris, the VM searches the directories in LD_LIBRARY_PATH. "


Since the second option was obviously not working I added a JAVA_HOME parameter to the system and moved the yjpagent.ini and yjpagent.dll into the java/bin folder. This resolved the issue.
Post Reply