Different behavior calling the same library from Java main() vs from a JFace part [message #1142711] |
Thu, 17 October 2013 16:17  |
Eclipse User |
|
|
|
I created an Eclipse 4 RCP project with GUI. In one ViewPart I need to call a utility Java library I created (Apache Jena), but I experienced ClassCastException:
Caused by: java.lang.ClassCastException: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl cannot be cast to javax.xml.parsers.DocumentBuilderFactory
at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:92)
at java.util.XMLUtils.load(XMLUtils.java:74)
at java.util.Properties.loadFromXML(Properties.java:868)
at com.hp.hpl.jena.util.Metadata.read(Metadata.java:76)
at com.hp.hpl.jena.util.Metadata.addMetadata(Metadata.java:54)
at com.hp.hpl.jena.util.Metadata.<init>(Metadata.java:48)
at com.hp.hpl.jena.JenaRuntime.<clinit>(JenaRuntime.java:34)
... 81 more
If I create a pure main() Java program in the same Eclipse 4 RCP project and call the same utility Java program, it execute successfully.
In the viewPart, I didn't even import any Apache Jena packages. Apparently the class loading were different in the two cases.
So how should I approach to resolve this ClassCastException?
Thanks a lot!
[Updated on: Thu, 17 October 2013 16:26] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.27511 seconds