tomact正常启动,但是在日志文件报错java.lang.NoClassDefFoundError: java/util/logging/Logger
程序员文章站
2023-04-03 19:53:38
启动tomcat,显示正常启动tomcat这个小人,表面上Using CATALINA_BASE: /usr/local/tomcatUsing CATALINA_HOME: /usr/local/tomcatUsing CATALINA_TMPDIR: /usr/local/tomcat/tempUsing JRE_HOME: /usr/java/jdk-13.0.2/Using CLASSPATH: /usr/local/tomcat/bin/bootstr...
启动tomcat,显示正常启动
tomcat这个小人,表面上
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jdk-13.0.2/
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
但是查看logs下的cata***
发现如下报错
NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
WARNING: Unknown module: java.rmi specified to --add-opens
Exception in thread "main" java.lang.NoClassDefFoundError: java/util/logging/Logger
at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:61)
at org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:181)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:116)
at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:139)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:194)
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
Caused by: java.lang.ClassNotFoundException: java.util.logging.Logger
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 6 more
找了好久,最后发现是jre的问题。
# 从JDK9开始, 引入了模块化, 可以根据自己的需要生成一个runtime, 所以就不再单独提供jre了, 你需要什么模块, 自己生成就好了, 可以自己定制jre的. https://www.zhihu.com/question/352542780/answer/872011539
# 我这里没有生成jre, 只是在/etc/profile文件中指定jre的位置为jdk的位置, tomcat启动失败的问题解决!
# /etc/profile文件末添加如下, 解决jre找不到的问题
JAVA_HOME=/usr/app/jdk-11.0.1/
JRE_HOME=$JAVA_HOME
CLASSPATH=$JAVA_HOME/lib
PATH=$JRE_HOME/bin:$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME CLASSPATH
本文地址:https://blog.csdn.net/elias2333/article/details/107352646
上一篇: mnist数据集下载及相关配置