tomcat5.5 failed when started via daemon for a particular application, but work when using catalina.sh

Bug #427394 reported by alan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tomcat5.5 (Ubuntu)
Incomplete
Medium
Unassigned

Bug Description

Binary package hint: tomcat5.5

I am using Ubuntu 9.04 with tomcat 5.5.26-5ubuntu

You can find the application I am working on at https://cselnx4.dl.ac.uk/download

I found this:

tomcat5.5 (5.5.20-3) experimental; urgency=low

  * Really fix the "/etc/init.d/tomcat5.5 status" command this
    time. (Closes: #398044)
  * Use jsvc for daemon startup, instead of the catalina.sh script. Daemon
    shutdown is now faster and more reliable.
  * Add missing permissions required by the admin webapp. Thanks to
    Jonathan-Marc Lapointe.
  * The CATALINA_OPTS variable in /etc/default/tomcat5.5 has been renamed
    to the more intuitive JAVA_OPTS.

 -- Marcus Better <email address hidden> Sat, 25 Nov 2006 21:20:18 +0100

If I use /etc/init.d/tomcat5.5 start than my application returns (at http://localhost:8180/pims/):

HTTP Status 404 -

type Status report

message

description The requested resource () is not available.
Apache Tomcat/5.5

If I use, as root:

export JAVA_HOME=/usr/lib/jvm/java-6-sun
/usr/share/tomcat5.5/bin/catalina.sh start

Than my application works fine at http://localhost:8180/pims/

In the end, the deamon is executing this command:

/usr/bin/jsvc -cp /usr/share/java/commons-daemon.jar:/usr/share/tomcat5.5/bin/bootstrap.jar -outfile SYSLOG -errfile SYSLOG -pidfile /var/run/tomcat5.5.pid -XX:MaxPermSize=512m -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Djava.awt.headless=true -Djava.endorsed.dirs=/usr/share/tomcat5.5/common/endorsed -Dcatalina.base=/var/lib/tomcat5.5 -Dcatalina.home=/usr/share/tomcat5.5 -Djava.io.tmpdir=/var/lib/tomcat5.5/temp -Djava.security.manager -Djava.security.policy=/var/lib/tomcat5.5/conf/catalina.policy -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/var/lib/tomcat5.5/conf/logging.properties org.apache.catalina.startup.Bootstrap

and catalina.sh is doing:

/usr/lib/jvm/java-6-sun/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/usr/share/tomcat5.5/conf/logging.properties -Djava.endorsed.dirs=/usr/share/tomcat5.5/common/endorsed -classpath :/usr/share/tomcat5.5/bin/bootstrap.jar:/usr/share/tomcat5.5/bin/commons-logging-api.jar -Dcatalina.base=/usr/share/tomcat5.5 -Dcatalina.home=/usr/share/tomcat5.5 -Djava.io.tmpdir=/usr/share/tomcat5.5/temp org.apache.catalina.startup.Bootstrap start

I frankly have no further idea of why the deamon command doesn't work and I sincerely appreciate any help here.

Cheers,
Alan

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 9.04
Package: tomcat5.5 5.5.26-5ubuntu1 [modified: usr/share/tomcat5.5/bin/catalina.sh]
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=en_GB.UTF-8
 SHELL=/bin/zsh
SourcePackage: tomcat5.5
Uname: Linux 2.6.28-15-generic i686

Revision history for this message
alan (alanwilter) wrote :
Revision history for this message
Thierry Carrez (ttx) wrote :

One important difference is that the initscript makes it run with a security manager by default:
 -Djava.security.manager -Djava.security.policy=/var/lib/tomcat5.5/conf/catalina.policy

Try running with TOMCAT5_SECURITY=no in /etc/default/tomcat5.5 and see if it works.

Changed in tomcat5.5 (Ubuntu):
importance: Undecided → Medium
status: New → Incomplete
Revision history for this message
alan (alanwilter) wrote :

you right, with TOMCAT5_SECURITY=no in /etc/default/tomcat5.5 my application ran.

Changed in tomcat5.5 (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Thierry Carrez (ttx) wrote :

Not a bug, then. You either need to add policy files so that your application works or disable running under a security manager altogether.

See http://tomcat.apache.org/tomcat-5.5-doc/security-manager-howto.html for documentation.

Changed in tomcat5.5 (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
alan (alanwilter) wrote :

Actually, there's a bug.

Tomcat 5.5.26 (the one in Ubuntu 9.04) failed for webapps examples with security even after adding the
the following permission to tomcat-juli.jar:

permission java.lang.RuntimePermission "setContextClassLoader"; in catalina.policy

See the whole thread at:
http://<email address hidden>/msg67193.html

Revision history for this message
Thierry Carrez (ttx) wrote :

Interesting, that seems to depend on the JVM used. Could you try with the OpenJDK in jaunty and let me know if it exhibits the same problem ?

Changed in tomcat5.5 (Ubuntu):
status: Invalid → Incomplete
Revision history for this message
alan (alanwilter) wrote :

Rectifying: it does work in Ubuntu 9.04 with security manager. However no log is generated. To have the logs, just add in /etc/tomcat5.5/policy.d/03catalina.policy:

permission java.lang.RuntimePermission "setContextClassLoader";

(See updated http://<email address hidden>/msg67193.html)

Testing with OpenJDK with clean install of tomcat 5.5:

It worked with no problems and without changing any file.

Alan

Revision history for this message
Thierry Carrez (ttx) wrote :

Marking as duplicate of bug 410379, then.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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