Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up JPDA for Tomcat7 in ubuntu-server

I am attempting to setup the JPDA for Tomcat7 in ubuntu.
I have used the apt-get method of installing Tomcat7.
By attempting to edit the /usr/share/tomcat7/startup.sh file with the following lines I try to get tomcat7 to boot into debug mode and allow remote debugging via eclipse.

 JPDA_TRANSPORT="dt_socket"
 JPDA_ADDRESS="8000"
 exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"

After editing the startup.sh file, I reboot tomcat7 using:

 sudo service tomcat7 restart

Then attempt to connect to the tomcat jpda in eclipse with the IP address and port 8000. I receive a "Connection Refused" error from Eclipse.

I have attempted to manually start tomcat7 using the startup.sh script rather than the service executable method as I thought perhaps the startup.sh was not being called.

sudo ./startup.sh

This failed with the following output:

 Using CATALINA_BASE:   /usr/share/tomcat7
 Using CATALINA_HOME:   /usr/share/tomcat7
 Using CATALINA_TMPDIR: /usr/share/tomcat7/temp
 Using JRE_HOME:        /usr
 Using CLASSPATH:       /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
 touch: cannot touch `/usr/share/tomcat7/logs/catalina.out': No such file or directory
 ./catalina.sh: 389: ./catalina.sh: cannot create /usr/share/tomcat7/logs/catalina.out: Directory nonexistent

I have also attempted to alter the startup script at /etc/init.d/tomcat7 as I am using service to start/restart tomcat7 to no avail...

What am I doing wrong?

like image 489
Ospho Avatar asked Oct 25 '13 00:10

Ospho


People also ask

How do I start tomcat7 in Ubuntu?

Type in sudo service tomcat7 start and then hit Enter : You will receive the following message indicating the server is started: To stop the Tomcat server, type in sudo service tomcat7 start and then hit Enter in the original terminal window: You will receive a message indicating the Tomcat server has been stopped.

What is Jpda Tomcat?

Note JPDA (Java Platform Debugger Architecture) is for debugging and JMX for monitoring. Both can run in parallel and JMX can be enabled in Java Control Panel - JMX. JMX URL, username and password will be displayed there for you. Find more on debugging using JPDA with Eclipse or NetBeans in Tomcat's Wiki.

What is Jpda port?

A JPDA Transport is a method of communication between a debugger and the virtual machine that is being debugged (hereafter the target VM). The communication is connection oriented - one side acts as a server, listening for a connection. The other side acts as a client and connects to the server.


1 Answers

In Ubuntu 12.04+ there is a section like this in /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"

So just uncomment it and run sudo service tomcat7 restart.

like image 137
David Levesque Avatar answered Sep 19 '22 05:09

David Levesque