欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

启动Tomcat时出现大量乱码的解决方法

程序员文章站 2022-03-10 14:16:43
启动tomcat乱码1. 在 tomcat 的启动窗口打印的启动信息中包含了大量的中文乱码,虽然这些对 tomcat 本身的使用没有任何影响,但却非常碍眼,影响视觉效果!d:\jar\apache-t...

启动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.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
淇℃伅: 鎶妛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时出现大量乱码的解决方法

到此这篇关于启动tomcat时出现大量乱码的解决方法的文章就介绍到这了,更多相关启动tomcat乱码内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!