Deploying Machines
- Operating system: CentOS 7
- Java Edition: Java version "1.7.0_80"
Problem symptoms
- A Java Web program deployed on two identically configured servers (server 1, server 2), the program started normally, the current side of the request to register the service, the background will request a picture verification code, however (server 1) Verification code shows 1 garbled problem, Figure two shows the normal verification code (server 2).
Figure 1
Figure 2
Problem exploration
- Guessing the encoding problem of 1:java characters
- Discovery process: Convert character encoding to utf-8 encoding, but garbled problem is not solved
- Guess 2: Server font problems, because the Java environment of the two servers is the same, so guess the font configuration of the two servers caused by inconsistency.
- Exploration process: (PS: The following operations are operating under the root authority of Linux)
1. Look at the font version of the two servers by entering the following command on the server:
rpm -qa | grep font
Server 1
Server 2
The two images above show the version of the font library for server 1 and server 2, which shows that the font library version of the two server is the same, thus excluding the assumption that the Font library version is different.
2.查看linux字体库里面的字体有哪些怎样知道字体库的位置呢,通过输入如下指令就可以找到:
find / -name fonts
To enter the marked folder, the instruction is:
cd /usr/share/fonts
Go to folder, find the folder under server 1 has a folder Lxy, and server 2 there is no folder under the folder, display the contents of the file Folder Lxy.
Solution Solutions
Move the Lxy folder to a different folder (PS: It seems that the folder name is not correct, you must move the folder out of the Fonts folder), and then restart the Web service, the problem is resolved. Instructions:
mv lxy tager
Summarize
- This problem is the font file in the Linux font library is caused by different, I guess Java loaded font library when loading the Linux system comes with the font library, if not found the corresponding font library will go to find Java own font library (PS: Just my guess, whether it is so, to which the great God to unlock).
Problem record-java Image verification code display garbled