You have the wrong version of Xerces on the classpath (one that is too old, probably) for some reason. You may have two copies on the classpath, the earlier one if being found.

(and some environments put Xerces in the endorsed directory which overrides anything you choose but they seem to be are nowadays)

        Andy

On 17/10/13 21:52, Charles Li wrote:
Hi, Jena Experts:
Please excuse me if you think I am asking in a wrong place.

classpath issues are a perennial issue :-)


I created a utility package in Java to do different Jena queries. The
objective is to hide the Jena/RDF Store details from the user.

I am using Eclipse 4 for the development. When I call my utility package in
a Java main() program, it execute successfully. However, when I created an
Eclipse GUI and call the same utility package from a GUI viewPart, it fails
at the following call with a ClassCastException:

  model = TDBFactory.createDataset(CimModelStoreURL).getDefaultModel();

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

Without knowing exactly what's going on inside the above call, it is hard
to trouble shoot. Any advice?

Thanks a lot!

P.S.: I found this but not sure if it is relevant.
http://www.pressingquestion.com/2600422/Java-Xerces-Jar-And-Jena


Reply via email to