纯净、安全、绿色的下载网站

首页

当前位置:首页IT学院IT技术

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

正在自学java的菜鸟   2021-06-21 我要评论
想了解启动Tomcat时出现大量乱码的解决办法的相关内容吗正在自学java的菜鸟在本文为您仔细讲解启动Tomcat乱码的相关知识和一些Code实例欢迎阅读和指正我们先划重点:启动Tomcat乱码的解决办法,启动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.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

在这里插入图片描述

在这里插入图片描述

最后重启窗口乱码问题就解决了

在这里插入图片描述


相关文章

猜您喜欢

  • Python聚类算法 Python实现DBSCAN聚类算法并样例测试

    想了解Python实现DBSCAN聚类算法并样例测试的相关内容吗午夜的行人在本文为您仔细讲解Python聚类算法的相关知识和一些Code实例欢迎阅读和指正我们先划重点:Python聚类算法,Python,DBSCAN聚类算法下面大家一起来学习吧..
  • python中文编码 详解python中文编码问题

    想了解详解python中文编码问题的相关内容吗daivlin在本文为您仔细讲解python中文编码的相关知识和一些Code实例欢迎阅读和指正我们先划重点:python中文编码,python,编码下面大家一起来学习吧..

网友评论

Copyright 2022 版权所有 软件发布

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们