NullPointerException org. apache. commons. digester. Digester. getXMLReader (Digester. java: 1058), father of java

Source: Internet
Author: User

NullPointerException org. apache. commons. digester. Digester. getXMLReader (Digester. java: 1058), father of java

Http://pwu-developer.blogspot.com/2010/01/nullpointerexception.html

MavenIs great build tool making it easy to fetch all the library dependencies for a particle build. But what happens when you 've got an application that uses wide variety of libraries of which can beDependent on the same library but different versions. Indeed we can have conflicts and the title of this blog is what I got as a result of some transitive dependency of Apache CXF.

The root cause of the above error is because an older version ofSAXParserFactoryWas being used. The class loaders for commons digester was using the SAXParserFactory from another JAR file in the classpath rather than the one provided in the JDK 1.6.
Others have had similar problems as in this forum

It turns out I had therXercesImpl-2.6.2In my classpath. This I needed to remove and boilied down to adding exclusions in my POM file as follows:

<!--     ========================    Apache CXF Web services    ========================    -->    <dependency>        <groupId>org.apache.cxf</groupId>        <artifactId>cxf-bundle-minimal</artifactId>        <version>2.2.4</version>                <exclusions>            <exclusion>                <groupId>xalan</groupId>                                <artifactId>xalan</artifactId>            </exclusion>            <exclusion>                <groupId>xalan</groupId>                                <artifactId>serializer</artifactId>            </exclusion>            <exclusion>                <groupId>xom</groupId>                <artifactId>xom</artifactId>            </exclusion>                    <exclusion>                <groupId>xerces</groupId>                <artifactId>xerces</artifactId>            </exclusion>            <exclusion>                <groupId>xerces</groupId>                <artifactId>xercesImpl</artifactId>            </exclusion>            <exclusion>                <groupId>xerces</groupId>                <artifactId>xmlParserAPIs</artifactId>            </exclusion>                        <exclusion>                <groupId>org.apache.santuario</groupId>                <artifactId>xmlsec</artifactId>            </exclusion>                                </exclusions>                    </dependency>  

---------------

When maven introduces dependencies, it will also introduce dependencies.

For example, a. jar depends on x. jar; B. jar depends on x. jar;

But a. jar depends on the x-1.1.jar; B. jar depends on the x-1.0.jar;

In this way, the project will introduce both x-1.1.jar and x-1.0.jar;

In this case, the x-1.0.jar needs to be excluded; because a. jar depends on the x-1.1jar, but because there are both x-1.1.jar and x-1.0.jar, a. jar may use the x-1.0.jar instead of the x-1.1.jar;

This may cause an error in a. jar. So you need to remove the x-1.0.jar;

B. jar depends on the x-1.0.jar, because the x-1.1.jar version is higher than the x-1.0.jar, so B. jar use x-1.1.jar and use x-1.0.jar should be no problem; general high version will be compatible with the lower version;

In turn, it won't work.

 

Just remove the xerces-2.6.2.jar package from your project.

Note that tomcat should also be cleaned up. You cannot just delete it in eclipse, because the jar package in the eclipse project has been deleted, and tomcat may not be deleted. So we need to clean it.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.