1

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.

Tom Klino
  • 2,358
  • 5
  • 35
  • 60

2 Answers2

2

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

nos
  • 223,662
  • 58
  • 417
  • 506
  • this side effect can also happen when you have defined a bad argument on your startup path. For example, imagine you specify the G1 garbage collector with "XX:+UseG1GC" instead of "-XX:+UseG1GC" somewhere (you forgot to add the dash), your tomcat would also not start up with this error message. To test if this is the case, you could use the "configtest.sh" script to double check your config before launching it from the jsvc – Kevin Chabot Mar 12 '14 at 11:52
  • what is a class path? – Christian Matthew Sep 26 '16 at 14:38
0

are you sure that CATELINA_HOME is properly exported ? or tomcat is started properly ?

may be that's the problem

Abhilash PS
  • 734
  • 1
  • 11
  • 25
  • yes, CATALINA_HOME is exported correctly. I've checked and also tried with a script to export it at run time. – Tom Klino Oct 15 '12 at 06:10