Hi,
Im getting a "java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory" when added org.apache.abdera as dependency to pom. I'have tried to follow the tips in this post adding:
<dependency> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> <version>1.3.04</version> <scope>provided</scope> </dependency>
and excluding it from abdera dependency:
<dependency> <groupId>org.apache.abdera</groupId> <artifactId>abdera-parser</artifactId> <version>1.1.3</version> <exclusions> <exclusion> <groupId>xml-apis</groupId> <artifactId>xml-apis</artifactId> </exclusion> </exclusions> </dependency>
But then i get "java.lang.ClassNotFoundException: org.w3c.dom.Node
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:772)" and i can't understand why.
Someone with similar problem and possible solutions ?
Kind regards,
Fábio Antunes
Community moderators have prevented the ability to post new answers.
I found out the solution:
<dependency> <groupId>org.apache.abdera</groupId> <artifactId>abdera-parser</artifactId> <version>1.1.3</version> <exclusions> <exclusion> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> </exclusion> <exclusion> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.abdera</groupId> <artifactId>abdera-core</artifactId> <version>1.1.3</version> <exclusions> <exclusion> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.abdera</groupId> <artifactId>abdera-i18n</artifactId> <version>1.1.3</version> <exclusions> <exclusion> <groupId>xerces</groupId> <artifactId>xercesImpl</artifactId> </exclusion> </exclusions> </dependency>
Regards
An alternative to excluding the offending package would be to excplicitly import the one that we need.
Error:
ClassCastException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory
The following worked for me:
// pom.xml, inside maven-jira-plugin (or maven-amps-plugin)
<Import-Package>
javax.xml.parsers, <<<<< Excplicitly import the one we want to use
*;resolution:=optional
</Import-Package>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.