JianJunShen
asked on
How to make debug working for tomcat when using Eclipse
I have a webapplication using Eclipse EE edition as IDE and tomcat as server. Now I need to debug my web applications. I use sudo /etc/init.d/tomcat5.5 start to start tomcat, so that I put command JAVA_OPTS=$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_soc ket,server =y,suspend =n,address =5000
into /etc/default/tomcat5.5
But when I start tomcat again, it says /etc/default/tomcat5.5: 18: -Xdebug: not found. How to correct it? In windows I put following line in catalina.bat. Then Eclipse remote debugging works.
set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xnoagent -Xrunjdwp:transport=dt_soc ket,server =y,suspend =n,address =5000
How to do it in linux?
into /etc/default/tomcat5.5
But when I start tomcat again, it says /etc/default/tomcat5.5: 18: -Xdebug: not found. How to correct it? In windows I put following line in catalina.bat. Then Eclipse remote debugging works.
set JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xnoagent -Xrunjdwp:transport=dt_soc
How to do it in linux?
try quoting the string
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Add quote could make tomcat startup, but Eclipse debug mode would not be activated using remote application.
how are you connecting with eclipse?
is eclipse running on same box or a different one?
is eclipse running on same box or a different one?
ASKER
I use remote application to debug, I put connection type as "Standard(Socket attach)", host as "localhost" and port as 5000
if you are running eclipse on a different box then change localhost to the hostname of the box running tomcat
ASKER
# Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat55.
#TOMCAT5_USER=tomcat55
# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.4. If JAVA_HOME is not set, some common directories for
# the Sun JDK, various J2SE 1.4 versions, and the free runtimes
# java-gcj-compat-dev and kaffe are tried.
#JAVA_HOME=/usr/lib/jvm/ja va-6-sun
# Directory for per-instance configuration files and webapps. It contain the
# directories conf, logs, webapps, work and temp. See RUNNING.txt for details.
# Default: /var/lib/tomcat5.5
#CATALINA_BASE=/var/lib/to mcat5.5
# Arguments to pass to the Java virtual machine (JVM).
#JAVA_OPTS="-Djava.awt.hea dless=true -Xmx128M"
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_soc ket,server =y,suspend =n,address =5000"
# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
# compilers that are accepted by Ant's build.compiler property.
#JSP_COMPILER=jikes
# Use the Java security manager? (yes/no, default: yes)
# WARNING: Do not disable the security manager unless you understand
# the consequences!
# NOTE: java-gcj-compat-dev currently doesn't support a security
# manager.
TOMCAT5_SECURITY=no
# default of tomcat55.
#TOMCAT5_USER=tomcat55
# The home directory of the Java development kit (JDK). You need at least
# JDK version 1.4. If JAVA_HOME is not set, some common directories for
# the Sun JDK, various J2SE 1.4 versions, and the free runtimes
# java-gcj-compat-dev and kaffe are tried.
#JAVA_HOME=/usr/lib/jvm/ja
# Directory for per-instance configuration files and webapps. It contain the
# directories conf, logs, webapps, work and temp. See RUNNING.txt for details.
# Default: /var/lib/tomcat5.5
#CATALINA_BASE=/var/lib/to
# Arguments to pass to the Java virtual machine (JVM).
#JAVA_OPTS="-Djava.awt.hea
JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Xrunjdwp:transport=dt_soc
# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
# compilers that are accepted by Ant's build.compiler property.
#JSP_COMPILER=jikes
# Use the Java security manager? (yes/no, default: yes)
# WARNING: Do not disable the security manager unless you understand
# the consequences!
# NOTE: java-gcj-compat-dev currently doesn't support a security
# manager.
TOMCAT5_SECURITY=no
ASKER
Yes. After add quotation, one need to restart tomcat. Now it works.