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


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时出现大量乱码的解决方法

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

Java/Android 相关文章推荐
Win10系统下配置Java环境变量
Jun 13 Java/Android
总结一下关于在Java8中使用stream流踩过的一些坑
Jun 24 Java/Android
mybatis 解决从列名到属性名的自动映射失败问题
Jun 30 Java/Android
Java中CyclicBarrier和CountDownLatch的用法与区别
Aug 23 Java/Android
java调用Restful接口的三种方法
Aug 23 Java/Android
Spring Cloud 中@FeignClient注解中的contextId属性详解
Sep 25 Java/Android
解决persistence.xml配置文件修改存放路径的问题
Feb 24 Java/Android
解析探秘fescar分布式事务实现原理
Feb 28 Java/Android
解决spring.thymeleaf.cache=false不起作用的问题
Jun 10 Java/Android
java实现自定义时钟并实现走时功能
Jun 21 Java/Android
Java Spring读取和存储详细操作
Aug 05 Java/Android
Java使用HttpClient实现文件下载
Aug 14 Java/Android
详解java如何集成swagger组件
SpringCloud Alibaba项目实战之nacos-server服务搭建过程
java中重写父类方法加不加@Override详解
Jun 21 #Java/Android
Java并发编程之Executor接口的使用
深入理解以DEBUG方式线程的底层运行原理
浅谈什么是SpringBoot异常处理自动配置的原理
SpringAop日志找不到方法的处理
You might like
浅谈PHP链表数据结构(单链表)
2016/06/08 PHP
PHP实现表单提交数据的验证处理功能【防SQL注入和XSS攻击等】
2017/07/21 PHP
PHP多进程通信-消息队列使用
2019/03/08 PHP
input、button的不同type值在ajax提交表单时导致的陷阱
2009/02/24 Javascript
js清空表单数据的两种方式(遍历+reset)
2014/07/18 Javascript
jQuery实现列表的全选功能
2015/03/18 Javascript
Javascript 是你的高阶函数(高级应用)
2015/06/15 Javascript
学习JavaScript设计模式之中介者模式
2016/01/14 Javascript
jquery表单提交带错误信息提示效果
2017/03/09 Javascript
常用的几个JQuery代码片段
2017/03/13 Javascript
JavaScript数据结构之二叉树的删除算法示例
2017/04/13 Javascript
node.js 利用流实现读写同步,边读边写的方法
2017/09/11 Javascript
Vue组件Draggable实现拖拽功能
2018/12/01 Javascript
vue v-for 使用问题整理小结
2019/08/04 Javascript
javascript实现摄像头拍照预览
2019/09/30 Javascript
JS Array.from()将伪数组转换成数组的方法示例
2020/03/23 Javascript
js实现页面导航层级指示效果
2020/08/25 Javascript
[48:30]LGD vs infamous Supermajor小组赛D组 BO3 第一场 6.3
2018/06/04 DOTA
[04:09]2018年度DOTA2社区贡献奖-完美盛典
2018/12/16 DOTA
Python 分析Nginx访问日志并保存到MySQL数据库实例
2014/03/13 Python
Python利用多进程将大量数据放入有限内存的教程
2015/04/01 Python
Python使用MD5加密算法对字符串进行加密操作示例
2018/03/30 Python
解决Spyder中图片显示太小的问题
2018/04/27 Python
利用Python如何将数据写到CSV文件中
2018/06/05 Python
python 将大文件切分为多个小文件的实例
2019/01/14 Python
浅析python,PyCharm,Anaconda三者之间的关系
2019/11/27 Python
Python发送手机动态验证码代码实例
2020/02/28 Python
中药学专业求职信
2014/05/31 职场文书
门店业绩提升方案
2014/06/08 职场文书
幼儿园见习报告范文
2014/10/30 职场文书
中学教师教学工作总结
2015/08/13 职场文书
详解Go语言Slice作为函数参数的使用
2021/07/02 Golang
python数据可视化使用pyfinance分析证券收益示例详解
2021/11/20 Python
Shell脚本一键安装Nginx服务自定义Nginx版本
2022/03/20 Servers
《黑岩★★射手 DAWN FALL》BD发售宣传CM公开
2022/04/04 日漫
css如何把元素固定在容器底部的四种方式
2022/06/16 HTML / CSS