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

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

Can you paste the full exception stacktrace?

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Dec 10, 2018 in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

206 views 6 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you