Debian
無法將 Tomcat 7 作為 Apache Commons Daemon 啟動
我一直按照此處推薦的安裝過程進行操作。我正在嘗試將 Tomcat 作為 Unix 守護程序執行,如文件中所述。但是,當我
$CATALINA_HOME/bin/jsvc
這樣執行時(注意,我在建議中添加了commons-daemon.jar
and-debug
以及-home ...
and-server
):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
我得到以下輸出
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
如果我去尋找使用
jar tf $CATALINA_HOME/bin/tomcat-juli.jar
它的課程顯然存在: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
jsvc 命令中有錯字。我寫:
-classpath [...]:$CATALINA_HOME/bin/tomcat-juli.jar:[...]
並不是:
-classpath [...]:$CATALINA__HOME/bin/tomcat-juli.jar:[...]
我刪除了不必要的下劃線,現在它可以工作了。