exception : org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory

apedko July 17, 2016
I am trying to use Tika http://tika.apache.org/ to convert doc or pdf files to text.
        File document = new File(target);
        Parser parser = new AutoDetectParser();
        ContentHandler handler = new BodyContentHandler();
        Metadata metadata = new Metadata();
During execution " Parser parser = new AutoDetectParser(); " 
I get an exception : org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory
where is proposed to remove that jar file.
there are dependencies :
[INFO] +- com.atlassian.jira:jira-api:jar:6.4.3:provided
[INFO] |  +- com.atlassian.annotations:atlassian-annotations:jar:0.14:provided
[INFO] |  +- com.atlassian.ofbiz:entityengine-share:jar:1.0.64:provided
[INFO] |  |  \- xerces:xercesImpl:jar:2.4.0:provided
but com.atlassian.jira depends on xerces:xercesImpl:jar:2.4.0
Is it possible to remove xerces:xercesImpl.jar file from dependencies to be able to use Tika http://tika.apache.org/ and don't break com.atlassian.JIRA dependency?
Is there another solution to fix exception : "org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory" ?
Thank you

2 answers

0 votes
Andrey Pedko July 18, 2016

java.lang.RuntimeException: org.apache.xerces.jaxp.SAXParserFactoryImpl cannot be cast to javax.xml.parsers.SAXParserFactory

 

This is all that returns 

throw new RuntimeException(e.getCause().getMessage(), e.getCause()); 

from com.atlassian.event.internal.SingleParameterMethodListenerInvoker file

Please let me know if I can provide you more information.

Thank you

0 votes
Petar Petrov (Appfire)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2016

Can you paste the full exception stacktrace?

Suggest an answer

Log in or Sign up to answer