0

I've been following the install process as recommended here. I'm trying to run Tomcat as a Unix daemon as described in the docs. However, when I run $CATALINA_HOME/bin/jsvc like this (note, I added commons-daemon.jarand -debugas well as -home ... and -server to the suggestions):

user@debian:/usr/local/tomcat7$ sudo ./bin/jsvc \
-home $JAVA_HOME -debug -server \
-classpath $CATALINA_HOME/bin/bootstrap.jar:$CATALINA__HOME/bin/tomcat-juli.jar:$CATALINA_HOME/bin/commons-daemon.jar \
-outfile $CATALINA_BASE/logs/catalina.out \
-errfile $CATALINA_BASE/logs/catalina.err \
-Dcatalina.home=$CATALINA_HOME \
-Dcatalina.base=$CATALINA_BASE \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties \
org.apache.catalina.startup.Bootstrap

I get the following output in catalina.err:

user@debian:/usr/local/tomcat7$ sudo cat logs/catalina.err 
Switching umask back to 022 from 077
Using specific JVM in /usr/local/jvm/jdk1.7.0_75/jre/lib/amd64/server/libjvm.so
Attemtping to load library /usr/local/jvm/jdk1.7.0_75/jre/lib/amd64/server/libjvm.so
JVM library /usr/local/jvm/jdk1.7.0_75/jre/lib/amd64/server/libjvm.so loaded
JVM library entry point found (0x6EE14110)
+-- DUMPING JAVA VM CREATION ARGUMENTS -----------------
| Version:                       0x010004
| Ignore Unrecognized Arguments: False
| Extra options:                 5
|   "-Djava.class.path=/usr/local/tomcat7/bin/bootstrap.jar:/bin/tomcat-juli.jar:/usr/local/tomcat7/bin/commons-daemon.jar" (0x00000000)
|   "-Dcatalina.home=/usr/local/tomcat7" (0x00000000)
|   "-Dcatalina.base=/usr/local/tomcat7" (0x00000000)
|   "-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" (0x00000000)
|   "-Djava.util.logging.config.file=/usr/local/tomcat7/conf/logging.properties" (0x00000000)
+-------------------------------------------------------
| Internal options:              4
|   "-Dcommons.daemon.process.id=3040" (0x00000000)
|   "-Dcommons.daemon.process.parent=3039" (0x00000000)
|   "-Dcommons.daemon.version=1.0.15-dev" (0x00000000)
|   "abort" (0x00405500)
+-------------------------------------------------------
Java VM created successfully
Class org/apache/commons/daemon/support/DaemonLoader found
Native methods registered
java_init done
Daemon loading...
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
    at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:59)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at java.lang.Class.newInstance(Class.java:379)
    at org.apache.commons.daemon.support.DaemonLoader.load(DaemonLoader.java:190)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 7 more
Cannot load daemon
java_load failed
Service exit with a return value of 3

If I go looking for the class using jar tf $CATALINA_HOME/bin/tomcat-juli.jar it's clearly present:

user@debian:/usr/local/tomcat7$ jar tf bin/tomcat-juli.jar 
META-INF/MANIFEST.MF
org/apache/juli/AsyncFileHandler$LogEntry.class
org/apache/juli/AsyncFileHandler$LoggerThread.class
org/apache/juli/AsyncFileHandler.class
org/apache/juli/ClassLoaderLogManager$1.class
org/apache/juli/ClassLoaderLogManager$2.class
org/apache/juli/ClassLoaderLogManager$3.class
org/apache/juli/ClassLoaderLogManager$ClassLoaderLogInfo.class
org/apache/juli/ClassLoaderLogManager$Cleaner.class
org/apache/juli/ClassLoaderLogManager$LogNode.class
org/apache/juli/ClassLoaderLogManager$RootLogger.class
org/apache/juli/ClassLoaderLogManager.class
org/apache/juli/DateFormatCache$1.class
org/apache/juli/DateFormatCache$Cache.class
org/apache/juli/DateFormatCache.class
org/apache/juli/FileHandler.class
org/apache/juli/JdkLoggerFormatter.class
org/apache/juli/OneLineFormatter$1.class
org/apache/juli/OneLineFormatter.class
org/apache/juli/VerbatimFormatter.class
org/apache/juli/logging/DirectJDKLog.class
org/apache/juli/logging/Log.class
org/apache/juli/logging/LogConfigurationException.class
org/apache/juli/logging/LogFactory.class
META-INF/NOTICE
META-INF/LICENSE
0

There's a typo in the jsvc command. I wrote:

-classpath [...]:$CATALINA_HOME/bin/tomcat-juli.jar:[...]

and not:

-classpath [...]:$CATALINA__HOME/bin/tomcat-juli.jar:[...]

I removed the unnecessary underscore and now it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.