DX Application Performance Management

Expand all | Collapse all

Need help 'JavaAgent Installation for tomcat 6.0'

Jump to Best Answer
  • 1.  Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 03-31-2010 02:57 AM
    hi  i am just a starter and trying to deploy tomcat 6.0 with wily introscope 8.1.0.0 with following versions/configurations,  1. Wily introscope 8.1.0.0 (on Windows Server 2003 SP2 R2 with jdk 1.5 installed)2. Tomcat 6.0 (on same machine with same jdk version)  I am follwing documentation JavaAgent8.1.0.0.pdf 'chapter 2', tomcat portion.Now the difficult part is that i am not able to deploy java agent successfully. I wrote all code given in documentation to catalina.bat, but when i start startup.bat, i didnt get anything on 'Enterprise Manager' console.  Now i wanna ask that if there is any wrong in my deployeemnt. Am i not able to write catalina. well i dont know where i am going wrong. Is there any xml i need to create in 'tomcat home directory' that will tell him about 'wily' folder.  I will be really thankful to you.


  • 2.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 03-31-2010 07:58 AM
    Can you post your catalina.bat here?   It's probably just a minor syntax issue.  


  • 3.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 03-31-2010 08:33 AM
    well here is my catalina.bat,      ----->@echo off
    if "%OS%" == "Windows_NT" setlocal  :: ----- Wily Introscope ---------------------------------------
    :: Place this code right before the commented-out start command
    :: Only put Wily on the classpath when starting Tomcat
    if not "%ACTION%" == "start" goto skipWilyVars
    set WILY_HOME=C:\apache-tomcat\wily

    :: NOTE: Configuration below for jdk versions >= 1.5
    ::set WILY_ARGS=-javaagent:"%WILY_HOME%\Agent.jar"
    set WILY_NAME=-Dcom.wily.introscope.agent.agentName=NewTomcatAgent
    set WILY_OPTS=-Dcom.wily.introscope.agentProfile="%WILY_HOME%\IntroscopeAgent.profile" %WILY_NAME%
    echo Using WILY_HOME: %WILY_HOME%
    echo Using WILY_ARGS: %WILY_ARGS%
    echo Using WILY_NAME: %WILY_NAME%
    echo Using WILY_OPTS: %WILY_OPTS%
    :skipWilyVars


    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
    :okHome

    rem Ensure that any user defined CLASSPATH variables are not used on startup,
    rem but allow them to be specified in setenv.bat, in rare case when it is needed.
    set CLASSPATH=

    rem Get standard environment variables
    if "%CATALINA_BASE%" == "" goto gotSetenvHome
    if exist "%CATALINA_BASE%\bin\setenv.bat" call "%CATALINA_BASE%\bin\setenv.bat"
    goto gotSetenvBase
    :gotSetenvHome
    if exist "%CATALINA_HOME%\bin\setenv.bat" call "%CATALINA_HOME%\bin\setenv.bat"
    :gotSetenvBase

    rem Get standard Java environment variables
    if exist "%CATALINA_HOME%\bin\setclasspath.bat" goto okSetclasspath
    echo Cannot find "%CATALINA_HOME%\bin\setclasspath.bat"
    echo This file is needed to run this program
    goto end
    :okSetclasspath
    set "BASEDIR=%CATALINA_HOME%"
    call "%CATALINA_HOME%\bin\setclasspath.bat" %1
    if errorlevel 1 goto end

    if not "%CATALINA_BASE%" == "" goto gotBase
    set "CATALINA_BASE=%CATALINA_HOME%"
    :gotBase

    if not "%CATALINA_TMPDIR%" == "" goto gotTmpdir
    set "CATALINA_TMPDIR=%CATALINA_BASE%\temp"
    :gotTmpdir

    rem Add tomcat-juli.jar and bootstrap.jar to classpath
    rem tomcat-juli.jar can be over-ridden per instance
    rem Note that there are no quotes as we do not want to introduce random
    rem quotes into the CLASSPATH
    if "%CLASSPATH%" == "" goto emptyClasspath
    set "CLASSPATH=%CLASSPATH%;"
    :emptyClasspath
    if "%CATALINA_BASE%" == "%CATALINA_HOME%" goto juliClasspathHome
    if not exist "%CATALINA_BASE%\bin\tomcat-juli.jar" goto juliClasspathHome
    set "CLASSPATH=%CLASSPATH%%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\bootstrap.jar"
    goto juliClasspathDone
    :juliClasspathHome
    set "CLASSPATH=%CLASSPATH%%CATALINA_HOME%\bin\bootstrap.jar"
    :juliClasspathDone

    if not "%LOGGING_CONFIG%" == "" goto noJuliConfig
    set LOGGING_CONFIG=-Dnop
    if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig
    set LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
    :noJuliConfig
    set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%

    if not "%LOGGING_MANAGER%" == "" goto noJuliManager
    set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    :noJuliManager
    set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%

    rem ----- Execute The Requested Command ---------------------------------------

    echo Using CATALINA_BASE: "%CATALINA_BASE%"
    echo Using CATALINA_HOME: "%CATALINA_HOME%"
    echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"
    if ""%1"" == ""debug"" goto use_jdk
    echo Using JRE_HOME: "%JRE_HOME%"
    goto java_dir_displayed
    :use_jdk
    echo Using JAVA_HOME: "%JAVA_HOME%"
    :java_dir_displayed
    echo Using CLASSPATH: "%CLASSPATH%"

    set EXECJAVA=%RUNJAVA%
    set MAINCLASS=org.apache.catalina.startup.Bootstrap
    set ACTION=start
    set SECURITY_POLICY_FILE=
    set DEBUG_OPTS=
    set JPDA=

    if not ""%1"" == ""jpda"" goto noJpda
    set JPDA=jpda
    if not "%JPDA_TRANSPORT%" == "" goto gotJpdaTransport
    set JPDA_TRANSPORT=dt_socket
    :gotJpdaTransport
    if not "%JPDA_ADDRESS%" == "" goto gotJpdaAddress
    set JPDA_ADDRESS=8000
    :gotJpdaAddress
    if not "%JPDA_SUSPEND%" == "" goto gotJpdaSuspend
    set JPDA_SUSPEND=n
    :gotJpdaSuspend
    if not "%JPDA_OPTS%" == "" goto gotJpdaOpts
    set JPDA_OPTS=-agentlib:jdwp=transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=%JPDA_SUSPEND%
    :gotJpdaOpts
    shift
    :noJpda

    if ""%1"" == ""debug"" goto doDebug
    if ""%1"" == ""run"" goto doRun
    if ""%1"" == ""start"" goto doStart
    if ""%1"" == ""stop"" goto doStop
    if ""%1"" == ""version"" goto doVersion

    echo Usage: catalina ( commands ... )
    echo commands:
    echo debug Start Catalina in a debugger
    echo debug -security Debug Catalina with a security manager
    echo jpda start Start Catalina under JPDA debugger
    echo run Start Catalina in the current window
    echo run -security Start in the current window with security manager
    echo start Start Catalina in a separate window
    echo start -security Start in a separate window with security manager
    echo stop Stop Catalina
    echo version What version of tomcat are you running?
    goto end

    :doDebug
    shift
    set EXECJAVA=%RUNJDB%
    set DEBUG_OPTS=-sourcepath "%CATALINA_HOME%\..\..\java"
    if not ""%1"" == ""-security"" goto execCmd
    shift
    echo Using Security Manager
    set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
    goto execCmd

    :doRun
    shift
    if not ""%1"" == ""-security"" goto execCmd
    shift
    echo Using Security Manager
    set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
    goto execCmd

    :doStart
    shift
    if not "%OS%" == "Windows_NT" goto noTitle
    if "%TITLE%" == "" set TITLE=Tomcat
    set EXECJAVA=start "%TITLE%" %RUNJAVA%
    goto gotTitle
    :noTitle
    set EXECJAVA=start %RUNJAVA%
    :gotTitle
    if not ""%1"" == ""-security"" goto execCmd
    shift
    echo Using Security Manager
    set "SECURITY_POLICY_FILE=%CATALINA_BASE%\conf\catalina.policy"
    goto execCmd

    :doStop
    shift
    set ACTION=stop
    set CATALINA_OPTS=
    goto execCmd

    :doVersion
    %_EXECJAVA% -classpath "%CATALINA_HOME%\lib\catalina.jar" org.apache.catalina.util.ServerInfo
    goto end


    :execCmd
    rem Get remaining unshifted command line arguments and save them in the
    set CMD_LINE_ARGS=
    :setArgs
    if ""%1""=="""" goto doneSetArgs
    set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
    shift
    goto setArgs
    :doneSetArgs

    rem Execute Java with the applicable properties
    if not "%JPDA%" == "" goto doJpda
    if not "%SECURITY_POLICY_FILE%" == "" goto doSecurity
    rem %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

    ::Comment out the original start command
    ::%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

    ::Print the command line before executing it
    echo About to execute command: %_EXECJAVA% %WILY_ARGS% %WILY_OPTS% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%

    %_EXECJAVA% %WILY_ARGS% %WILY_OPTS% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%


    goto end
    :doSecurity
    %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
    goto end
    :doJpda
    if not "%SECURITY_POLICY_FILE%" == "" goto doSecurityJpda
    %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
    goto end
    :doSecurityJpda
    %_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %JPDA_OPTS% %DEBUG_OPTS% -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Djava.security.manager -Djava.security.policy=="%SECURITY_POLICY_FILE%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
    goto end

    :end----->    well also i wanna mention you all my steps with tomcat agent deployement. please correct me if i am wrong.  1. unzip tomcat agent package, and copy the 'wily' folder in 'apache-tomcat' as C:\apache-tomcat\wily.2. edit 'IntroscopeAgent.profile' and give a pc name, change 'localhost' in case of remote machine.3. edit 'catalina.bat' as shown, the blue part is what wily text and the red part is what i commented.4. run apache-tomcat but there is no agent indication on Enterprise Manager console.  Before that i have tried JBoss and its deployed successfully in first attempt. Facing issue with tomcat.  Well thats all for tomcat that i have done.  Await for ur reply,Regards and thanks.  sbastine


  • 4.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 03-31-2010 04:39 PM
      Have you tried un-commenting this line  ::set WILY_ARGS=-javaagent:"%WILY_HOME%\Agent.jar"    :-)


  • 5.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 03-31-2010 11:30 PM
    hi  i actually miss that point but the issue is still there, Enterprise Manager is'nt able to sense any sort of tomcat agent. i uncommented it, that was a mistake but the issue is not resolved. i also wrote my deployement steps above with catalina script,  now i have a doubt that i am going to miss any point in deployement steps.ORthere is any wrong with catalina.bat.  Thanks and Regards,sbastine.


  • 6.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-01-2010 02:25 AM
    I reread all the documentation about deploying tomcat again, but this time i choose version 5.5 of tomcat as Introscope 8.1.0.0 support it. But this time also the result was same.


  • 7.  Re: Need help 'JavaAgent Installation for tomcat 6.0'
    Best Answer

    Posted 04-01-2010 03:05 AM
      |   view attached
    Hi,  Instead of using variables, could you try specifying the values directly. Here is an example from my test system:  set JRE_HOME=C:\Program Files\Java\jre1.5.0_03
    set WILY_HOME=C:\apache-tomcat-5.5.23\wily
    set JAVA_OPTS=%JAVA_OPTS% -javaagent:C:\apache-tomcat-5.5.23\wily\Agent.jar -Dcom.wily.introscope.agentProfile=C:\apache-tomcat-5.5.23\wily\IntroscopeAgent.profileAlso, please find attached a copy of the bat file.  Is there any log file being created? If yes, it means that the instrumentation is working and the problem is something else.  If the problem persist, attach  the listing content of the whole tomcat directory (including directories, subdirectories and files). I would like to verify that all files are in the right location.  I hope this helps,  Regards,Sergio

    Attachment(s)

    txt
    wily-catalina.txt   9K 1 version


  • 8.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-01-2010 12:00 PM
    tada...........................................it works.Thanks smorales, rdimar, hdavis, thanks very much helping me in resolving the issue. I just manually specify the values, not env variables and it works.  One last thing, can i make my custom probes to get metrics from JVM, is there any application or rules to define them, because the number of metrics i am getting, are very very less to my requirements. Please say something about that. is it possible?  Also 'SMORALES', as my apache deployement works, can i still send u the folder to take a look into it. Are there any other tunings that i am missing or i can improve.  Thanks and Regards,sbastine.


  • 9.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-01-2010 12:16 PM
    Are you looking for a PBD to provide more details?There is a default one on the old community site (https://community.wilytech.com/entry!default.jspa?categoryID=488&externalID=2035&fromSearchPage=true).Are you using the Tomcat PowerPack?


  • 10.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-01-2010 12:40 PM
    That's great! I am glad to know that it is working now.  In regards to your additional question, can you attach the autoprobe log?  RegardsSergio


  • 11.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-01-2010 11:20 PM
      |   view attached
    hi  here is my autoprobe.log,  thanks and regards,sbastine.

    Attachment(s)

    txt
    AutoProbe.log.txt   376K 1 version


  • 12.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-01-2010 11:42 PM
    Thank for the file.  It looks like you are usng C:\apache-tomcat\wily\tomcat-typical.pbl.Try using tomcat-full.pbl.Open the IntroscopeAgent.profile then update the introscope.autoprobe.directivesFile as appropiate.  If after applying the above change you are still unable to view the extra tomcat  metrics you are  looking for,  then you need  to a) create custom pbd for those missing classes, b)  Please contact the Professional Service Team, as they can implement/develop this for you --  probably an Agent extension is required and c) if you believe they are  important metrics for any customer, then  open a product enhancement with the  support team.    Regards,  Sergio


  • 13.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-02-2010 12:13 AM
    hi  well tell me a thing, what is 'tomcat power-pack' and from where (download url) i get it, does it help in increase tomcat   metrics.  thanks and regards,sbastine.


  • 14.  Re: Need help 'JavaAgent Installation for tomcat 6.0'

    Posted 04-02-2010 12:32 AM
    Hi  I believe you are refering to the "CA Introscope Services Deployment Pack for ApacheTM Tomcat Application Server Version 2.0" which supports Tomcat V4.1, V5.0, V5.5, V6.0. Please find below an brief summary from the Install guide doc:  --The Tomcat Services Deployment Pack delivers capabilities that enable Introscope to produce performance metrics for the Apache Tomcat Application Server. Metrics include the standard set of Introscope metrics (J2EE, JDBC/SQL, JVM, and others) and a customized set of Tomcat-specific metrics that include server information, DBCP/JDBC pools, sessions (per context), thread pools, and JMX in cases where the Tomcat Application Server produces JMX metrics. The Tomcat ServicesPack produces the following metrics:1. Tomcat Version2. DBCP based JDBC Connection Pools:
     a. name of the pool
     b. active connections
     c. idle connections
     d. getConnection3. Sessions
     a. statistics per context
     b. created sessions
     c. expired sessions
     d. recycled sessions
     e. passivated sessions
     f. activated sessions4. Thread Pools:
     a. current thread count (total) per thread pool
     b. idle thread count per thread pool5. JMX: (will vary by Tomcat version)
     a. Catalina
     b. Users
     
    For more details about Tomcat Services Deployment Pack. Please see your CA Wily Technology Division account representative.  ---