启动Tomcat时出现大量乱码的解决方法
启动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淇℃伅: 浣跨敤APR鐗堟湰[1.7.0]鍔犺浇浜嗗熀浜嶢PR鐨凙pache Tomcat鏈満搴揫1.2.28]銆?鍏湀 15, 2021 12:06:59 涓婂崍 org.apache.catalina.core.AprLifecycleListener lifecycleEvent淇℃伅: APR鍔熻兘锛欼Pv6[true]銆乻endfile[true]銆乤ccept filters[false]銆乺andom[true]銆?鍏湀 15, 2021 12:06:59 涓婂崍 org.apache.catalina.core.AprLifecycleListener initializeSSL淇℃伅: OpenSSL鎴愬姛鍒濆鍖? [OpenSSL 1.1.1k25 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 msConnected 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淇℃伅: 鎶妛eb 搴旂敤绋嬪簭閮ㄧ讲鍒扮洰褰? [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乱码内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!
推荐阅读
- 任时光绽放成六月繁花
- 一个人的碎碎念
- 昨夜小楼听风
- 20170612时间和注意力开销记录
- 远去的风筝
- 为什么你的路演总会超时()
- 杜月笙的口才
- 时间老了
- MediaRecorder前后摄像头同时录像
- 眉头开了