Search code examples
javalinuxtomcatjsvc

running tomcat6 with jsvc


I'm trying to run tomcat6 with jsvc in order to get user privileges at start.

I'm trying to run using the code in the tomcat documentation: http://tomcat.apache.org/tomcat-6.0-doc/setup.html

cd $CATALINA_HOME
./bin/jsvc -cp ./bin/bootstrap.jar \
    -outfile ./logs/catalina.out -errfile ./logs/catalina.err \
    org.apache.catalina.startup.Bootstrap

And these are the errors I get:

Unable to redirect to ./logs/catalina.out
Unable to redirect to ./logs/catalina.err
Cannot open PID file /var/run/jsvc.pid, PID is 2813
Service exit with a return value of 255

It is also important to mention that I did not installed tomcat and jsvc from sources as specified in the guide. Instead I installed them from package using synaptic.


UPDATE:

I'm running it as script now, here is the code:

#!/bin/sh

export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
export CATALINA_HOME=/usr/share/tomcat6
./bin/jsvc -cp ./bin/bootstrap.jar:$JAVA_HOME\
    -outfile ./logs/catalina.out -errfile ./logs/catalina.err \
    org.apache.catalina.startup.Bootstrap

now I'm getting a different error:

Cannot find daemon loader org/apache/commons/daemon/support/DaemonLoader
Service exit with a return value of 1

I also tried to remove the jsvc installation I did from synaptic and install version 1.0.10 of jsvc from sources. It did not help.


Solution

  • You need the bin/commons-daemon.jar in your classpath in addition to bootstrap.jar