I have a ubuntu server and my app is running in tomcat7. Now I have two methods of remote debugging, as a learner I want to know what is the technical difference between the two or are they both same and I am missing something?
Method 1: open file /etc/default/tomcat7
#To enable remote debugging uncomment the following line.
#You will then be able to use a java debugger on port 8000.
#JAVA_OPTS="${JAVA_OPTS} -Xdebug Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"
Method 2:
export CATALINA_HOME=/usr/share/tomcat7 export CATALINA_BASE=/var/lib/tomcat7/ export JPDA_ADDRESS=8090 export JRE_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
now go to tomcat home folder /usr/share/tomcat7/bin and write the following line to run tomcat in debug mode.
#./catalina.sh jpda start
One more thing about method 2 which I came across is that when i start jpda and my tomcat service was also running on port 80, I was getting connection refused and when I stopped tomcat I was able to connect to 8090 remotely. WHy is that so?