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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Wednesday in Jira

Join our webinar: How 1B+ feature flag events helped us build the new Jira

Every time you release software, there's a bit of risk – that there's a bug, that something breaks, or that the feature doesn't resonate with customers. Feature flagging helps make high stakes s...

98 views 0 1
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