tomcat应用程序中文账号登陆失败,日志显示用户名“乱码”
将tomcat7.0.82 更换为7.0.100 后,应用程序使用中文账号登陆失败,日志显示,登陆账号显示?:Parameters: ????????????(String),即中文字符识别不了
[app@VHOST-121 Application]$ tomcat-sos-web/bin/version.sh
Using CATALINA_BASE: /data/Application/tomcat-sos-web
Using CATALINA_HOME: /data/Application/tomcat-sos-web
Using CATALINA_TMPDIR: /data/Application/tomcat-sos-web/temp
Using JRE_HOME: /usr/local/jdk1.8.0_151
Using CLASSPATH: /data/Application/tomcat-s0s-web/bin/bootstrap.jar:/data/Application/tomcat-sos-web/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.100
Server built: Feb 11 2020 08:31:12 UTC
Server number: 7.0.100.0
OS Name: Linux
OS Version: 3.10.0-327.el7.x86_64
Architecture: amd64
JVM Version: 1.8.0_151-b12
JVM Vendor: Oracle Corporation
server.xml配置:
[app@VHOST-121 Application]$ cat tomcat-sos-web/conf/server.xml |grep URIEncoding
URIEncoding="UTF-8"
URIEncoding="UTF-8"
catalina.sh配置,添加“-Dfile.encoding=UTF-8”
[app@VHOST-121 Application]$ cat tomcat-sos-web/bin/catalina.sh |grep encoding
CATALINA_OPTS="-server -Xms1024M -Xmx1024M -Xss512k -XX:PermSize=128M -XX:MaxPermSize=256M -Duser.timezone=Asia/Shanghai -Djava.awt.headless=true -Dfile.encoding=UTF-8 "
应用程序使用中文账号登陆正常