tomcat6 needs debug start mode with jpda

Bug #375493 reported by Bruce Edge
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tomcat6 (Ubuntu)
Fix Released
Wishlist
Thierry Carrez

Bug Description

Binary package hint: tomcat6

I had filed this in the wrong place, but I don't see any links to it now. Apologies if it's a dup.

Bits and pieces pasted here from different sources but it all describes the prob.

tomcat 6 in jaunty:
 dpkg -l | grep tomcat6
ii libtomcat6-java 6.0.18-0ubuntu6 Servlet and JSP engine -- core libraries
ii tomcat6 6.0.18-0ubuntu6 Servlet and JSP engine
ii tomcat6-admin 6.0.18-0ubuntu6 Servlet and JSP engine -- admin web applications
ii tomcat6-common 6.0.18-0ubuntu6 Servlet and JSP engine -- common files
ii tomcat6-user 6.0.18-0ubuntu6 Servlet and JSP engine -- tools to create user instances

I've installed the stock tomcat6 package on Intrepid, and I want to
configure it for remote JPDA debugging (listening on port 8000) for
debugging a webapp from eclipse. The normal way to do this is to edit
/usr/share/tomcat6/bin/startup.sh so it starts in debug mode:

exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"

However, the Ubuntu system startup script doesn't seem to follow the
normal tomcat6 startup procedure. /etc/init.d/tomcat6 runs /usr/bin/jsvc
instead of executing the normal startup scripts in
/usr/share/tomcat6/bin:

DAEMON=/usr/bin/jsvc
.
.
.
$DAEMON -user "$TOMCAT6_USER" -cp "$JSVC_CLASSPATH" \
-outfile SYSLOG -errfile SYSLOG \
-pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"

How should I configure it to start the debugger?

The attached patch is crude way of accomplishing this. I'm sure there are better ways.

Revision history for this message
Bruce Edge (bruce-edge) wrote :
Revision history for this message
Thierry Carrez (ttx) wrote :

Passing arbitrary Java options is supported through setting JAVA_OPTS in /etc/default/tomcat6...
So if you set:
JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.awt.headless=true -Xmx128M"
You should get desired behavior.

We could modify the init script so that JPDA_DEBUG becomes an option in /etc/default/tomcat6.
Setting this to Wishlist.

Please also note that the tomcat6-user package allows to set up private instances which sound more appropriate for development/debugging.

Changed in tomcat6 (Ubuntu):
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
Bruce Edge (bruce-edge) wrote :

While I agree that it is possible to get the same behavior with the addition of:

JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.awt.headless=true -Xmx128M"

to default/tomcat6, it is finding this information that is non-trivial.

A simple -d switch, or testing for $DEBUG in the init script would be much friendlier. If this is the standard debug incantation for tomcat6, what's wrong with making it so the user doesn't have to google or RTFM to find it.

Perhaps put something like this in the packages default/tomcat6:

# To enable remore debugging uncomment the following line. You will then be able to use a java debugger on port 8000
# JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Djava.awt.headless=true -Xmx128M"

-Bruce

Revision history for this message
Ludovic Claude (ludovicc) wrote :

I'm adding the comment from Thag to /etc/default/tomcat6 in the Debian packaging for Tomcat version 6.0.20-5

Thierry Carrez (ttx)
Changed in tomcat6 (Ubuntu):
assignee: nobody → Thierry Carrez (ttx)
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (4.2 KiB)

This bug was fixed in the package tomcat6 - 6.0.20-8ubuntu1

---------------
tomcat6 (6.0.20-8ubuntu1) lucid; urgency=low

  * Merge from Debian unstable. Remaining changes:
    - debian/control, debian/rules: Do not use 3.0 (quilt) source format yet
  * debian/tomcat6.default: Fix typos in "JSVC" and "remote", missing newline
  * debian/tomcat6.default, debian/tomcat6.init: Handle JSVC_CLASSPATH
    default value the same way as other defaults

tomcat6 (6.0.20-8) unstable; urgency=low

  * Corrected some spelling mistakes in debian/control.
    (Closes: #557377, #557378)
  * Added patches to install the OSGi metadata in some of the jars.
    (Closes: #558176)
  * Updated 03catalina.policy to allow "setContextClassLoader".
    - Fixes a problem where Sun's JVM would fail to generate log-files.
    (Closes: LP: #410379)
  * Updated /etc/default/tomcat6:
    - Clarified that JAVA_OPTS are passed to jscv and not the JVM.
    - Updated the JSP_COMPILER to javac (jikes is not in Debian anymore).
    (Closes: LP: #440685)
  * Use default-jdk and default-jre-headless instead of openjdk in
    (Build-)Depends.
  * Added more alternatives for java implementations to the Depends of
    libservlet2.5-java.
  * Exposed JSVC_CLASSPATH to the configuration file.
    (Closes: LP: #475457)
  * Updated description so it no longer refers to non-existent package.
    (Closes: #559475)
  * Used "set -e" in postinst and postrm instead of passing "-e" to sh
    in the #!-line.
  * Changed to 3.0 (quilt) source format.

tomcat6 (6.0.20-7) unstable; urgency=low

  * New patch fix_context_name.patch:
    - Allow Service name != Engine name. Regression in fix for 42707.
      Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=47316
    - This has been fixed in trunk and will be in 6.0.21
  * Register libservlet2.5-java-doc API with doc-base
  * Fix short description of tomcat6-docs by using "documentation" suffix

tomcat6 (6.0.20-6) unstable; urgency=low

  [ Ludovic Claude ]
  * tomcat6.postinst: set the ownership of files in /etc/tomcat6/
    to root:tomcat6, to prevent an attacker running inside a tomcat6
    instance to change the tomcat configuration
  * debian/policy/02debian.policy: grant access to
    /usr/share/maven-repo/ as it is a valid source of Debian JARs.
    (Closes: #545674)
  * Bump up Standards-Version to 3.8.3
    - add debian/README.source that describes the quilt patch system.
  * debian/control: Add Conflicts on libtomcat6-java with old versions
    of tomcat6-common (Closes: #542397)

  [ Michael Koch ]
  * Replace dh_clean -k by dh_prep.
  * Added Ludovic and myself to Uploaders.
  * Build-Depends on debhelper >= 7.

tomcat6 (6.0.20-5) unstable; urgency=low

  * Fix jsp-api dependency in the Maven descriptors.
  * Put tomcat-juli.jar in /usr/share/java instead of juli.jar.
    This fixes a broken link which prevented tomcat to start
    when logging is turned on, and restores the file layout
    defined in 6.0.20-2.
  * Restore links to the jars in usr/share/tomcat6/lib
  * Change watch to download fresh sources from SVN.
    Should fix wrong encoding in tomcat-i18n-fr/es.jar in the next upstream
    version. (Closes: #522067)
  * Update ...

Read more...

Changed in tomcat6 (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.