Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Xml parsing jar what to do about jar package conflict under oracle linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "xml parsing jar jar package conflicts under oracle linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

After receiving this bug, take a closer look at the log file. When the tomcat starts, spring initializes the applicationcontaxt.xml, resulting in a transcoding error.

Since this project can be run on other platforms, the initial judgment is environmental issues.

The following attempts were made

1. It is found that the version of tomcat is the windows version, and all versions are replaced by the same version of linxu.

2. Found the jdk version, this machine is not quite the same, changed to the latest version of jdk1.8.

Found that the problem still exists.

Think about it twice. Since it's a coding problem, change the code:

1. Add fileecncoding=UTF-8 encoding parameters to the tomcat startup parameters.

2. Modify the linux operating system code

/ etc/profile

Export LC_ALL= "zh_CN.GBK"

Export LANG= "zh_CN.GBK"

Modify

/ etc/sysconfig/i18n

LANG= "zh_CN.GBK"

LANGUAGE= "zh_CN.GBK;zh_CN.GB18030;zh_CN.GB2312;zh_CN"

3. Write a jdk, a simple program, and read the code of the operating system to make sure that tomcat can read the code correctly.

The problem is still unsolved.

Think about it for the third time and take a closer look at tomcat's log.

Caused by: oracle.xml.parser.v2.XMLParseExceptionpublicId:-/ / SPRING//DTD BEAN//EN; systemId: http://www.springframework.org/dtd/spring-beans.dtd; lineNumber: 1; columnNumber: 38; Illegal change of encoding: from gb2312 to UTF-8.

I took a closer look at the xmlparser2 code and found no anomalies.

After taking a closer look at applicationcontent.xml, and the first file TopOA_Routine.xml that reported an error, we found that the encoding format of the applicationcontent.xml file is utf8,TopOA_Routine.xml and the file format is gbk, that is, the gb2312 to utf-8 error reported in the exception. I probably know why, because the first one is utf-8, so the rest is handled according to utf-8.

Inference: the operating system does some processing when reading files, or thread sharing.

Summary: if it is a java project, non-special requirements, all utf8, data, project code, resource files. As for most operating systems can be handled successfully, a few can not be handled, can only be said that the test is not fully covered.

Finally, mark the environment tomcat9.0.12,jdk1.8.0_212-b10, the operating system is in centos, ubuntu is OK, and in Oracle Linux Server release 6.4

The problem is finally solved:

The cause of this error is a jar package conflict

The implementation of javax.xml.parsers.DocumentBuilder is available in jar package xmlparser2.jar and xml-apis, and in xercesImpl-2.8.1.jar

The problem occurred because oracle linux reported an error when loading the jar package because it did not know why the xmlparser2.jar was loaded first.

Solution:-Xbootclasspath/p:/lib/xercesImpl-2.8.1.jar

Use Xbootclasspath to specify xercesImpl priority load, problem resolved.

This is the end of the content of "xml parsing jar jar package conflicts under oracle linux". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report