Search code examples
javajaxbbusinessworks

How to identify which missing Java Libraries to make JAXB to work?


My Tibco BW 6.3.2 project invokes some Java Code that works on my machine, but I'm having issues on the server.

At first, I got this error

 <CausedBy> java.lang.ClassNotFoundException: com.sun.xml.bind.v2.model.annotation.AnnotationReader cannot be found

So Googled it and added jaxb-impl.jar and jaxb-core.jar(JAXB v2.2.11). Again, it worked on my machine without adding these to the classpath. But once I added them, I got this error on the server:

<CausedBy> java.lang.RuntimeException: Provider for class javax.xml.parsers.SAXParserFactory cannot be created
<CausedBy> java.util.ServiceConfigurationError: javax.xml.parsers.SAXParserFactory: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found

Again, I Googled it and added xercesImpl.jar. But now I'm getting this on my machine & server :

<CausedBy> java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration

After some google searching, I've determined there are 2 xerces jars in my project, but I can't find the second one. Any thoughts on how to do that? OR does anyone have a different solution?

Side note, the java code works perfectly fine in Eclipse without any of these libraries added to the class path. (All devices are using Sun JDK 1.8.0_92)


Solution

  • EDITED: I removed all the jaxb libraries I added and defined them in the Module Descriptors -> Dependencies -> Imported Packages.

    Imported Packages