I´m trying to install perfino jar on production that can monitor Java Spring MVC web transactions and I need to put a javaagent into my Tomcat 9 server on windows somehow but am not clear on exactly how to do this, I am using Windows server and have been instructed by the software company that makes this product to do something like below:
-javaagent:C:\Program Files\perfino\agent\perfino.jar
Do i need to insert the above line into startup.bat or catlina.bat and any format i need to follow?
rem ---------------------------------------------------------------------------
rem Start script for the CATALINA Server
rem ---------------------------------------------------------------------------
setlocal
rem Guess CATALINA_HOME if not defined
set "CURRENT_DIR=%cd%"
if not "%CATALINA_HOME%" == "" goto gotHome
set "CATALINA_HOME=%CURRENT_DIR%"
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
cd ..
set "CATALINA_HOME=%cd%"
cd "%CURRENT_DIR%"
:gotHome
if exist "%CATALINA_HOME%\bin\catalina.bat" goto okHome
echo The CATALINA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end
Kindly advise me on this?
-javagent
is a VM parameter, it has to be inserted in the command line after the java executable and before the main class name.
The start scripts for Tomcat support an environment variable CATALINA_OPTS
. In startup.bat, you can insert the line
set CATALINA_OPTS="-javaagent:C:\Program Files\perfino\agent\perfino.jar" %CATALINA_OPTS%
before the call to
call "%EXECUTABLE%" run %CMD_LINE_ARGS%