I encountered an error during debugging today. When I threw the war package into Jboss' deploy directory, I reported an error of "Failed to create a new SAX parser". I looked for solutions online. Generally speaking, it is said that the xerces-2.6.2.jar and xml-apis.jar packages in the project can be deleted, but I tried to delete them still cannot, because Maven will still put them into your war package when packaging.
First of all, I used dwr in my project. Dwr depends on these two packages by default. Therefore, the pom file will associate these two packages when you introduce dwr. Therefore, it is useless for you to just delete it from the project's lib library, because when packaging, Maven will still type them in according to the dependencies in the pom file. The solution is very simple, the steps are as follows:
1. Open the pom file and click the "Dependency Hierarchy" tab;
2. Enter the two package names just now in the box above;
3. Right-click the corresponding package and select the "Exclude Maven artifactId" option.
See the picture below:
After that, the pom file will have a few more lines of code in the reference to dwr:
<exclusions> <exclusion> <artifactId>xercesImpl</artifactId> <groupId>xerces</groupId> </exclusion> <exclusion> <artifactId>xml-apis</artifactId> <groupId>xml-apis</groupId> </exclusion> </exclusions>
It means to remove the dependency on the above two jars. Then package, deploy, and see the cute successfully. The problem has been solved, and you can write the code happily, oh!
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.