Posted in Java/Android onJune 21, 2021
启动Tomcat乱码
1. 在 tomcat 的启动窗口打印的启动信息中包含了大量的中文乱码,虽然这些对 tomcat 本身的使用没有任何影响,但却非常碍眼,影响视觉效果!
D:\jar\apache-tomcat-7.0.109\bin\catalina.bat run
[2021-06-15 12:06:55,652] Artifact ch01hellospringmvc:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\lenovo\.IntelliJIdea2018.3\system\tomcat\Tomcat_7_0_109_springmvc"
Using CATALINA_HOME: "D:\jar\apache-tomcat-7.0.109"
Using CATALINA_TMPDIR: "D:\jar\apache-tomcat-7.0.109\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_40"
Using CLASSPATH: "D:\jar\apache-tomcat-7.0.109\bin\bootstrap.jar;D:\jar\apache-tomcat-7.0.109\bin\tomcat-juli.jar"
Using CATALINA_OPTS: ""
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? Server.???″?ㄧ???�: Apache Tomcat/7.0.109
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ???″?ㄦ??寤�: Apr 22 2021 18:43:38 UTC
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ???″?ㄧ?????? 7.0.109.0
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ??浣?绯荤???绉? Windows 8.1
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? OS.???? 6.3
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?舵??: amd64
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? Java ???????: C:\Program Files\Java\jdk1.8.0_40\jre
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? Java?????虹???�: 1.8.0_40-b25
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? JVM.渚?搴??�: Oracle Corporation
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? CATALINA_BASE: C:\Users\lenovo\.IntelliJIdea2018.3\system\tomcat\Tomcat_7_0_109_springmvc
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? CATALINA_HOME: D:\jar\apache-tomcat-7.0.109
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Djava.util.logging.config.file=C:\Users\lenovo\.IntelliJIdea2018.3\system\tomcat\Tomcat_7_0_109_springmvc\conf\logging.properties
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dcom.sun.management.jmxremote=
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dcom.sun.management.jmxremote.port=1099
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dcom.sun.management.jmxremote.ssl=false
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dcom.sun.management.jmxremote.password.file=C:\Users\lenovo\.IntelliJIdea2018.3\system\tomcat\Tomcat_7_0_109_springmvc\jmxremote.password
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dcom.sun.management.jmxremote.access.file=C:\Users\lenovo\.IntelliJIdea2018.3\system\tomcat\Tomcat_7_0_109_springmvc\jmxremote.access
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Djava.rmi.server.hostname=127.0.0.1
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Djdk.tls.ephemeralDHKeySize=2048
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dignore.endorsed.dirs=
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dcatalina.base=C:\Users\lenovo\.IntelliJIdea2018.3\system\tomcat\Tomcat_7_0_109_springmvc
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Dcatalina.home=D:\jar\apache-tomcat-7.0.109
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.VersionLoggerListener log
淇℃?? ?戒护琛????帮? -Djava.io.tmpdir=D:\jar\apache-tomcat-7.0.109\temp
???? 15, 2021 12:06:59 涓??? org.apache.catalina.core.AprLifecycleListener lifecycleEvent
淇℃?? 浣跨??PR????1.7.0]??杞戒??轰?APR??Apache Tomcat???哄?[1.2.28]?�
???? 15, 2021 12:06:59 涓??? org.apache.catalina.core.AprLifecycleListener lifecycleEvent
淇℃?? APR???斤?IPv6[true]??sendfile[true]??accept filters[false]??random[true]?�
???? 15, 2021 12:06:59 涓??? org.apache.catalina.core.AprLifecycleListener initializeSSL
淇℃?? OpenSSL??????濮??� [OpenSSL 1.1.1k 25 Mar 2021]
???? 15, 2021 12:06:59 涓??? org.apache.coyote.AbstractProtocol init
淇℃?? ??濮?????璁????? ["http-apr-8090"]
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.Catalina load
淇℃?? Initialization processed in 1462 ms
???? 15, 2021 12:06:59 涓??? org.apache.catalina.core.StandardService startInternal
淇℃?? 姝e?ㄥ???ㄦ????Catalina]
???? 15, 2021 12:06:59 涓??? org.apache.catalina.core.StandardEngine startInternal
淇℃?? Starting Servlet Engine: Apache Tomcat/7.0.109
???? 15, 2021 12:06:59 涓??? org.apache.coyote.AbstractProtocol start
淇℃?? 寮�濮???璁?????ユ??["http-apr-8090"]
???? 15, 2021 12:06:59 涓??? org.apache.catalina.startup.Catalina start
淇℃?? Server startup in 108 ms
Connected to server
[2021-06-15 12:07:00,087] Artifact ch01hellospringmvc:war exploded: Artifact is being deployed, please wait...
???? 15, 2021 12:07:00 涓??? org.apache.catalina.deploy.WebXml setVersion
璀﹀??: Unknown version string [4.0]. Default version will be used.
???? 15, 2021 12:07:02 涓??? org.apache.catalina.startup.TldConfig execute
淇℃?? At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2021-06-15 12:07:03,217] Artifact ch01hellospringmvc:war exploded: Artifact is deployed successfully
[2021-06-15 12:07:03,218] Artifact ch01hellospringmvc:war exploded: Deploy took 3,131 milliseconds
???? 15, 2021 12:07:09 涓??? org.apache.catalina.startup.HostConfig deployDirectory
淇℃?? ??web 搴??ㄧ?搴??ㄧ讲?扮???#65533; [D:\jar\apache-tomcat-7.0.109\webapps\manager]
???? 15, 2021 12:07:10 涓??? org.apache.catalina.startup.HostConfig deployDirectory
淇℃?? Web搴??ㄧ?搴????[D:\jar\apache-tomcat-7.0.109\webapps\manager]???ㄧ讲宸插??319]姣????瀹??�
2. 对于乱码问题,原因是字节流解码为字符串时,使用了错误的字符集(和编码所用字符集不一致) !
我们找到 tomcat 目录下的 config 子目录中,找到"logging.properties" 文件,打开这个文本文件,找到如下配置项:
java.util.logging.ConsoleHandler.encoding = UTF-8
将 UTF-8 修改为 GBK,修改后的效果为:
java.util.logging.ConsoleHandler.encoding = GBK
保存后,重启 tomcat
、
最后,重启窗口,乱码问题就解决了
到此这篇关于启动Tomcat时出现大量乱码的解决方法的文章就介绍到这了,更多相关启动Tomcat乱码内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!
启动Tomcat时出现大量乱码的解决方法
- Author -
正在自学java的菜鸟声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@