Tomcat

关注公众号 jb51net

关闭
首页 > 网站技巧 > 服务器 > Tomcat > Tomcat Caused  java.util.logging.Logger

解决Tomcat Caused by: java.lang.ClassNotFoundException: java.util.logging.Logger的问题

作者:此方星河

这篇文章主要给大家介绍了如何解决Tomcat Caused by: java.lang.ClassNotFoundException: java.util.logging.Logger的问题,文中有详细的原因分析及解决方法,需要的朋友可以参考下

发生缘由

环境

问题及补救

启动Tomcat

下载jre

修改源码

set JAVA_HOME=E:\JAVA\jdk-16.0.2(jdk路径)
set JRE_HOME=E:\JAVA\jdk-16.0.2\jre(jre路径)

检查端口号

捕捉错误信息

call "%EXECUTABLE%" start %CMD_LINE_ARGS%
# 修改为下面代码
call "%EXECUTABLE%" run %CMD_LINE_ARGS%
Using CATALINA_BASE:   "E:\Tomcat\apache-tomcat-8.5.75"
		Using CATALINA_HOME:   "E:\Tomcat\apache-tomcat-8.5.75"
		Using CATALINA_TMPDIR: "E:\Tomcat\apache-tomcat-8.5.75\temp"
		Using JRE_HOME:        "E:\JAVA\jdk-16.0.2\jre"
		Using CLASSPATH:       "E:\Tomcat\apache-tomcat-8.5.75\bin\bootstrap.jar;E:\Tomcat\apache-tomcat-8.5.75\bin\tomcat-juli.jar"
		Using CATALINA_OPTS:   ""
		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.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=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:130)
		       at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:153)
		       at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:208)
		       at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:50)
		Caused by: java.lang.ClassNotFoundException: java.util.logging.Logger
		       at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
		       at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
		       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
		       ... 6 more
Using CATALINA_BASE:   "E:\Tomcat\apache-tomcat-8.5.75"
		Using CATALINA_HOME:   "E:\Tomcat\apache-tomcat-8.5.75"
		Using CATALINA_TMPDIR: "E:\Tomcat\apache-tomcat-8.5.75\temp"
		Using JRE_HOME:        "E:\JAVA\jdk-16.0.2\jre"
		Using CLASSPATH:       "E:\Tomcat\apache-tomcat-8.5.75\bin\bootstrap.jar;E:\Tomcat\apache-tomcat-8.5.75\bin\tomcat-juli.jar"
		Using CATALINA_OPTS:   ""
		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.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=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:130)
		       at org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:153)
		       at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:208)
		       at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:50)
		Caused by: java.lang.ClassNotFoundException: java.util.logging.Logger
		       at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:636)
		       at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:182)
		       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
		       ... 6 more

修改jre环境变量

set JAVA_HOME=E:\JAVA\jdk-16.0.2
set JRE_HOME=E:\JAVA\jdk-16.0.2

修改乱码问题

java.util.logging.ConsoleHandler.encoding = UTF-8
# 修改为下面代码
java.util.logging.ConsoleHandler.encoding = GBK

重新修改环境变量

在我写这篇博客的时候,发现其实是把JAVA环境变量配置错误了。

所以导致了错误,可是使用cmd命令窗口分别输入下面命令:javajavacjava -version都没有任何问题。

修改完了环境变量,将之前在配置文件中写的代码删除:

set JAVA_HOME=E:\JAVA\jdk-16.0.2
set JRE_HOME=E:\JAVA\jdk-16.0.2

然后就没有什么问题了。

以上就是解决Tomcat Caused by: java.lang.ClassNotFoundException: java.util.logging.Logger的问题的详细内容,更多关于Tomcat Caused java.util.logging.Logger的资料请关注脚本之家其它相关文章!

您可能感兴趣的文章:
阅读全文