Can't integrate with Tomcat4

Questions about YourKit Java Profiler
Post Reply
Centaur
Posts: 1
Joined: Tue Apr 19, 2005 1:45 pm

Can't integrate with Tomcat4

Post by Centaur »

Hi,

I use Tomcat 4.0.1, JDK 1.4.2_04
I run Tools/Integrate with J2EE server, chose Tomcat, and it generates new start batch file (see below). When I run it, Tomcat starts successfully, but the tool still answers that "No application being profiled found".

How this can be resolved?

Thanks,
Nick

Generated startup_with_yjp.bat
rem Generated with YourKit Java Profiler 4.0.8

set PATH=D:\Program Files\YourKit Java Profiler 4.0.8\bin\win32;%PATH%
set JAVA_TOOL_OPTIONS=-agentlib:yjpagent=sessionname=Tomcat %JAVA_TOOL_OPTIONS%
@echo off
rem ---------------------------------------------------------------------------
rem startup.bat - Start Script for the CATALINA Server
rem
rem $Id: startup.bat,v 1.3.4.1 2001/10/12 16:48:57 remm Exp $
rem ---------------------------------------------------------------------------

set _CATALINA_HOME=%CATALINA_HOME%
if not "%CATALINA_HOME%" == "" goto gotHome
set CATALINA_HOME=.
if exist "%CATALINA_HOME%\bin\catalina.bat" goto gotHome
set CATALINA_HOME=..
if exist "%CATALINA_HOME%\bin\catalina.bat" goto gotHome
echo Unable to determine the value of CATALINA_HOME
goto cleanup
:gotHome
"%CATALINA_HOME%\bin\catalina" start %1 %2 %3 %4 %5 %6 %7 %8 %9
:cleanup
set CATALINA_HOME=%_CATALINA_HOME%
set _CATALINA_HOME=
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

If Tomcat starts successfully with profiler agent, it should prints in console (or log file) port number which is used by agent. Please try to connect to this port (as remote application on localhost:port)
adelhaj
Posts: 8
Joined: Wed May 04, 2005 10:38 pm

Post by adelhaj »

Vladimir Kondratyev wrote:If Tomcat starts successfully with profiler agent, it should prints in console (or log file) port number which is used by agent. Please try to connect to this port (as remote application on localhost:port)

My tomcat starts with the modified tomcat .bat file generated from your software, however it look like its not instrumenting it correctly. The server starts but no port number is getting printed.

.bat file after modifications is:
rem Generated with YourKit Java Profiler 4.0.10

set PATH=D:\Program Files\YourKit Java Profiler 4.0.10\bin\win32;%PATH%
set JAVA_TOOL_OPTIONS=-agentlib:yjpagent=sessionname=Tomcat %JAVA_TOOL_OPTIONS%
set CATALINA_BASE=.
set CATALINA_HOME=d:\dev\tomcat\v4.1.24
set CATALINA_TMPDIR=d:\temp
set JAVA_OPTS=-server -Xmx256M

rem to perform remote debugging, change the JPDA
rem transport to dt_socket and set the JPDA_ADDRESS
rem to a port like 53002. Then, in karmira, connect
rem via socket.
set JPDA_TRANSPORT=dt_socket
set JPDA_ADDRESS=53000
set DEBUG=
if not ""%1"" == ""-debug"" goto doStart

set DEBUG=jpda
echo %DEBUG%

:doStart
%CATALINA_HOME%\bin\catalina %DEBUG% start -config %CATALINA_BASE%\conf\server.xml
goto end

:end


----------------
my tomcat home is:
set CATALINA_HOME=d:\dev\tomcat\v4.1.24

my site directory is:
D:\Projects\r8.0.8\FinanceCenter\site_deploy



Any help would be great, we are having a major issue on a customer site and I need to get this tool working, specially its remote connection abilities. Once the issue above is resolved, do I need to install the profiling tool ( yourkit) on the application server, or I can work with it remotely?
RangerRob
Posts: 64
Joined: Wed Oct 06, 2004 7:56 am

Post by RangerRob »

adelhaj, have you tried specifying a port in your Tomcat startup file for loading YourKit? This is how the versions prior to 4.0 used to work and I find that sometimes it can solve the problem of it not allocating it's own port.

The syntax is as follows:

set PATH=C:\Programs\YourKit-4.0.10\bin\win32;%PATH%
set JAVA_OPTS=-Xrunyjpagent:port=10100,sessionname=Tomcat %JAVA_OPTS%

Also to answer your subsequent question, you do not need the UI componants on the web server, these go on your local machine for remote access. You will however need to make sure the required libraries (DLLs on Windows) are in the directory set in the PATH environment variable which must be local to the web server. You should be able to delete the executable.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Post by Anton Katilin »

Hello adelhaj

It is intended to select in the integration wizard the file startup.bat, and then run the generated startup_with_yjp.bat.

I have just checked it with Tomcat 4.1.29, and it works fine for me.

Furthermore, I see that your modified .bat file does not look like startup.bat from that Tomcat version.

Best regards,
Anton
Post Reply