2016-02-07 19:49:19 Commons Daemon procrun stderr initialized
java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
Exception in thread "main"
这对我来说很奇怪,因为我可以通过&#34; Catalina.bat start&#34;来启动Tomcat 8.0。没有任何问题相同的库和类路径设置。
以下是我在WindowsService中的设置:
Tab&#34; Java&#34; - Java选项:
-Dcatalina.home=C:\Tomcat8030test
-Dcatalina.base=C:\Tomcat8030test
-Djava.endorsed.dirs=C:\Tomcat8030test\endorsed
-Djava.io.tmpdir=C:\Tomcat8030test\temp
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
-Dlog4j.configurationFile=%CATALINA_BASE%\lib\log4j2.xml
-Djava.class.path=%CLASSPATH%;%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_BASE%\lib\log4j-jul-2.5.jar;%CATALINA_BASE%\lib\log4j-jcl-2.5.jar;C:\tomcat8\lib\log4j2.xml;%CATALINA_BASE%\lib\log4j-core-2.5.jar;%CATALINA_BASE%\lib\log4j-api-2.5.jar;C:\tomcat8\lib\log4j2.xml;%CATALINA_BASE%\lib\commons-logging-1.2.jar;%CATALINA_BASE%\lib\tomcat-juli-adapters.jar"
Tab&#34; startup&#34; 类 org.apache.catalina.startup.Bootstrap Java类路径: C:\ Tomcat8030test \ BIN \ bootstrap.jar
工作路径: C:\ Tomcat8030test
除此之外: 这是我的文件系统设置
%CATALINA_HOME%\bin\tomcat-juli.jar (i checked the jar, the missing file is there and has Log4j2 version 2.5).
\lib\commons-logging-1.2.jar
\lib\log4j-1.2.17.jar
\lib\log4j-1.2-api-2.5.jar
\lib\log4j2.xml
\lib\log4j-api-2.5.jar
\lib\log4j-core-2.5.jar
\lib\log4j-jcl-2.5.jar
lib\log4j-jul-2.5.jar
\lib\log4j-web-2.5.jar
正如我通过catalina.bat解释启动工作很棒。 以下是设置:
rem tomcat-juli.jar can be over-ridden per instance
if not exist "%CATALINA_BASE%\bin\tomcat-juli.jar" goto juliClasspathHome
set "CLASSPATH=%CLASSPATH%;%CATALINA_BASE%\bin\tomcat-juli.jar;%CATALINA_BASE%\lib\log4j-jul-2.5.jar;%CATALINA_BASE%\lib\log4j-jcl-2.5.jar;C:\tomcat8\lib\log4j2.xml;%CATALINA_BASE%\lib\log4j-core-2.5.jar;%CATALINA_BASE%\lib\log4j-api-2.5.jar;C:\tomcat8\lib\log4j2.xml;%CATALINA_BASE%\lib\commons-logging-1.2.jar;%CATALINA_BASE%\lib\tomcat-juli-adapters.jar"
goto juliClasspathDone
:juliClasspathHome
set "CLASSPATH=%CLASSPATH%;%CATALINA_HOME%\bin\tomcat-juli.jar"
:juliClasspathDone
rem if not "%LOGGING_CONFIG%" == "" goto noJuliConfig
rem set LOGGING_CONFIG=-Dnop
rem if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig
set LOGGING_CONFIG=-Djava.util.logging.config.file="C:\tomcat8\lib\log4j2.xml"
rem set LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
rem :noJuliConfig
set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%"
if not "%LOGGING_MANAGER%" == "" goto noJuliManager
rem set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
set LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
....
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -Dlog4j.configurationFile="C:\tomcat8\lib\log4j2.xml" -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" %MAINCLASS% %CMD_LINE_ARGS% %ACTION% '
Tomcat-Juli.jar是2.5版,确实包含了这个缺失的类。
请帮忙。