Tomcat 5.x with yjp not working

Questions about YourKit Java Profiler
Post Reply
anton
Posts: 5
Joined: Sun Jan 16, 2005 6:15 pm

Tomcat 5.x with yjp not working

Post by anton »

Hello,

I've used EAP 4.0 build 502 and it worked great for me. Now i've downloaded build 508 and when i try to set up my Tomcat startup.sh with yjp support it does not work anymore. Startup script works by itself though, but with yjp it does not. Any ideas why this is happening?

Configuration: Tomcat 5.0.19, Java 1.4.2_05, YJP EAP 4.0 build 508

Thanks,

Anton
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

What does "not work anymore" mean? Do you see any error in console and Tomcat's log file?
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

Please send us your startup script at [email protected]
RangerRob
Posts: 64
Joined: Wed Oct 06, 2004 7:56 am

Post by RangerRob »

Hmm... curious. I'm currently using 508 on Tomcat 5.5.4 on both Linux and Windows and I've not seen any problems since the 4.0 EAP started.

Anton, could it be that your startup script is still pointing to an older version of YJP??
anton
Posts: 5
Joined: Sun Jan 16, 2005 6:15 pm

Post by anton »

Ok, this is the script with yjp:

Code: Select all

# Generated with YourKit Java Profiler 4.0 EAP build 508

export LD_LIBRARY_PATH=/root/work/yjp-4.0-eap-build508/bin/linux:$LD_LIBRARY_PATH
export JAVA_TOOL_OPTIONS=-agentlib:yjpagent=port=10100,sessionname=Tomcat $JAVA_TOOL_OPTIONS
#!/bin/sh
# -----------------------------------------------------------------------------
# Start Script for the CATALINA Server
#
# $Id: startup.sh,v 1.1 2004/05/13 16:06:05 ajcachia Exp $
# -----------------------------------------------------------------------------

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done
 
PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh

# Check that target executable exists
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
  echo "Cannot find $PRGDIR/$EXECUTABLE"
  echo "This file is needed to run this program"
  exit 1
fi

JAVA_OPTS=-Xrunyjpagent:port=10100,sessionname=Tomcat $JAVA_OPTS
export JAVA_OPTS
exec "$PRGDIR"/"$EXECUTABLE" start "$@"
and this is without yjp support:

Code: Select all

#!/bin/sh
# -----------------------------------------------------------------------------
# Start Script for the CATALINA Server
#
# $Id: startup.sh,v 1.1 2004/05/13 16:06:05 ajcachia Exp $
# -----------------------------------------------------------------------------

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done
 
PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh

# Check that target executable exists
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
  echo "Cannot find $PRGDIR/$EXECUTABLE"
  echo "This file is needed to run this program"
  exit 1
fi

exec "$PRGDIR"/"$EXECUTABLE" start "$@"
For whatever reason, whithout yjp the tomcat sturts up fine and has no problems running, but with yjp support it does not start, even though it does not show any error massages... I've used build 502 before that and it was working fine for me, did not have any problems of this kind. Just to let you know, I did delete the old script for 502, so i'm not using the old one... It is weird because it does show the Java options needed for yjp on startup, but tomcat does not start up itself though... i'll try manually adding those in catalina.sh, should be working that way at least, i'll let you know how it goes.

Thanks for responce everybody,

Anton
anton
Posts: 5
Joined: Sun Jan 16, 2005 6:15 pm

Post by anton »

I've tryed editing startup_with_yjp.sh to:

Code: Select all

#!/bin/sh
# -----------------------------------------------------------------------------
# Start Script for the CATALINA Server
#
# $Id: startup.sh,v 1.1 2004/05/13 16:06:05 ajcachia Exp $
# -----------------------------------------------------------------------------

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ] ; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done
 
PRGDIR=`dirname "$PRG"`
EXECUTABLE=catalina.sh

# Check that target executable exists
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
  echo "Cannot find $PRGDIR/$EXECUTABLE"
  echo "This file is needed to run this program"
  exit 1
fi

# Generated with YourKit Java Profiler 4.0 EAP build 508

LD_LIBRARY_PATH=/root/work/yjp-4.0-eap-build508/bin/linux:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
JAVA_TOOL_OPTIONS=-agentlib:yjpagent=port=10100,sessionname=Tomcat $JAVA_TOOL_OPTIONS
export JAVA_TOOL_OPTIONS
JAVA_OPTS=-Xrunyjpagent:port=10100,sessionname=Tomcat $JAVA_OPTS
export JAVA_OPTS

exec "$PRGDIR"/"$EXECUTABLE" start "$@"
with not much success, Tomcat still does not start... I've also tried adding those options to catalina.sh itself like this:

Code: Select all

#!/bin/sh
# -----------------------------------------------------------------------------
# Start/Stop Script for the CATALINA Server
#
# Environment Variable Prequisites
#
#   CATALINA_HOME   May point at your Catalina "build" directory.
#
#   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
#                   of a Catalina installation.  If not present, resolves to
#                   the same directory that CATALINA_HOME points to.
#
#   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
#                   "stop", or "run" command is executed.
#
#   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
#                   the JVM should use (java.io.tmpdir).  Defaults to
#                   $CATALINA_BASE/temp.
#
#   JAVA_HOME       Must point at your Java Development Kit installation.
#
#   JAVA_OPTS       (Optional) Java runtime options used when the "start",
#                   "stop", or "run" command is executed.
#
#   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
#                   command is executed. The default is "dt_socket".
#
#   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
#                   command is executed. The default is 8000.
#
#   JSSE_HOME       (Optional) May point at your Java Secure Sockets Extension
#                   (JSSE) installation, whose JAR files will be added to the
#                   system class path used to start Tomcat.
#
#   CATALINA_PID    (Optional) Path of the file which should contains the pid
#                   of catalina startup java process, when start (fork) is used
#
# $Id: catalina.sh,v 1.1 2004/05/13 16:06:05 ajcachia Exp $
# -----------------------------------------------------------------------------

# Set JAVA_OPTS to give max heap of 256Mb and no GC on classes.
export JAVA_OPTS=$JAVA_OPTS" -Xmx256M -Xnoclassgc"

# -----------------------------------------------------------------------------
# Generated with YourKit Java Profiler 4.0 EAP build 508

LD_LIBRARY_PATH=/root/work/yjp-4.0-eap-build508/bin/linux:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
JAVA_TOOL_OPTIONS=-agentlib:yjpagent=port=10100,sessionname=Tomcat $JAVA_TOOL_OPTIONS
export JAVA_TOOL_OPTIONS
JAVA_OPTS=-Xrunyjpagent:port=10100,sessionname=Tomcat $JAVA_OPTS
export JAVA_OPTS

# -----------------------------------------------------------------------------

# OS specific support.  $var _must_ be set to either true or false.
cygwin=false
os400=false
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
esac

# resolve links - $0 may be a softlink
PRG="$0"

while [ -h "$PRG" ]; do
  ls=`ls -ld "$PRG"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '.*/.*' > /dev/null; then
    PRG="$link"
  else
    PRG=`dirname "$PRG"`/"$link"
  fi
done

# Get standard environment variables
PRGDIR=`dirname "$PRG"`
CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`
if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then
  . "$CATALINA_HOME"/bin/setenv.sh
fi

...
...
...
In this case Tomcat starts up, but YourKit does not find any apps that can be profiled... I'll send complete catalina.sh, startup.sh and startup_with_yjp.sh to above mentioned email for support for you to look at it... Again, there was no problem of this sort with build 502...

Thank you for helping,

Anton
anton
Posts: 5
Joined: Sun Jan 16, 2005 6:15 pm

Post by anton »

I've tried running build 502, which was working before my testing licence expired, now i have the same problem as with build 508... i don't know what could be wrong... the startup_with_yjp.sh is created by 502 and 508 are the same... any suggestions?
anton
Posts: 5
Joined: Sun Jan 16, 2005 6:15 pm

Post by anton »

It's been resolved. I'm sorry to call it a bug, the problem was on my side... i had to restart my FC2... don't know why, but now it works... never happened to me before, i thought those problems were only on windows... i'm sorry guys... thanks for helping.

Anton
RangerRob
Posts: 64
Joined: Wed Oct 06, 2004 7:56 am

Post by RangerRob »

Hi Anton, sorry not to reply to any of your subsequent posts (not sure where you are located but they were like midnight my time and I was tucked up in bed, lol), I would have tried today however from what you are saying the solution was I don't think I would have been much help anyway since I wouldn't have even though of that!! :)

Well done for solving it, like you I'm not sure what it all has to do with FC2 though.
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Post by Vladimir Kondratyev »

I'm sorry to call it a bug, the problem was on my side... i'm sorry guys...
No problems :)
Post Reply