问题
I have my webapplication on tomcat 6
at serverA. I am running the tomcat
as service i.e thru tomcat6w.exe
lying under <tomcat_home>/bin
folder. To remotely debug the
weabbplication i have added below lines as suggested on different blog/sites on web in different line witout space at end. Mentioned the port as 8443 as application is running on same port.
-Xdebug-Xrunjdwp:transport=dt_socket,address=8443,server=y,suspend=n
Now thru eclipse
on server B i mentioned host as serverA and port 8443 and click debug. After 2-3 minutes it establishes connection without giving any error.But now
when i hit webapplication url in IE
it does not show up and says IE
can not display the webpage. But as soon as i remove the above mentioned debug parameters
and hit the url, application works fine. I am not getting how should i debug the application when tomcat is running as window service?
For Information Below are the parameters when i double click the tomcat service
-- Under java tab
--jvm section value
C:\Program Files\Java\jre6\bin\client\jvm.dll
--java classpath section value
C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin\bootstrap.jar
--java options section value
-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 6.0
-Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 6.0
-Djava.endorsed.dirs=C:\Program Files\Apache Software Foundation\Tomcat 6.0\common endorsed
-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 6.0\temp
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
-Djava.util.logging.config.file=C:\Program Files\Apache Software
Foundation\Tomcat6.0\conf\logging.properties-XX:MaxPermSize=512M
-Djavax.net.ssl.trustStore=c:/.keystore
-Djavax.net.ssl.trustStorePassword=changeit-Xdebug
-Xrunjdwp:transport=dt_socket,address=8443,server=y,suspend=n
--Under startup tab
--class section value
org.apache.catalina.startup.Bootstrap
--workingpath section value
C:\Program Files\Apache Software Foundation\Tomcat 6.0
--arguments section value
start
--mode section value
jvm
回答1:
In the Java Options tab add the below. Remember to put
-Xdebug
and
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8733
in SEPARATE LINE.
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8733
回答2:
you can pass JVM options using JvmOptions parameter:
tomcat.exe //TS// ++JvmOptions -Xdebug;-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
or
tomcat.exe //RS// ++JvmOptions -Xdebug;-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
回答3:
When I need to remotely debug an application that is deployed on Tomcat, I usually start the server through the Catalina.bat script, not as a Windows service. Actually, to enable remote debugging, you're supposed to provide the JPDA arguments when executing the catalina.bat script :
catalina jpda start
If you really need to start your server as a service, you could try to edit its definition so that you also provide the JPDA argument to it.
Yo could as well stop your Tomcat service and just start the server by executing the catalina.bat script.
Hope that'll help.
来源:https://stackoverflow.com/questions/10221429/how-to-remotely-debug-the-webapplication-running-on-tomcat-service