Discussion:
java.lang.NoClassDefFoundError: org/apache/xerces/util/XMLChar
edask
2010-09-29 12:18:22 UTC
Permalink
Hello,
I am trying to create a Ontology Model (OntModel) with the OWL model
specification but I get an error.
Specifically when I run the following code:

OntModel m = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM );

I get the Error:

javax.servlet.ServletException: Servlet execution threw an exception

java.lang.NoClassDefFoundError: org/apache/xerces/util/XMLChar
com.hp.hpl.jena.rdf.model.impl.Util.notNameChar(Util.java:121)
com.hp.hpl.jena.rdf.model.impl.Util.splitNamespace(Util.java:79)
com.hp.hpl.jena.graph.Node_URI.getLocalName(Node_URI.java:64)

com.hp.hpl.jena.rdf.model.impl.ResourceImpl.getLocalName(ResourceImpl.java:133)

com.hp.hpl.jena.rdf.model.impl.PropertyImpl.checkLocalName(PropertyImpl.java:81)

com.hp.hpl.jena.rdf.model.impl.PropertyImpl.<init>(PropertyImpl.java:89)

com.hp.hpl.jena.rdf.model.ResourceFactory$Impl.createProperty(ResourceFactory.java:245)

com.hp.hpl.jena.rdf.model.ResourceFactory.createProperty(ResourceFactory.java:121)
com.hp.hpl.jena.vocabulary.RDF.property(RDF.java:32)
com.hp.hpl.jena.vocabulary.RDF.<clinit>(RDF.java:45)

com.hp.hpl.jena.ontology.impl.OntResourceImpl.<clinit>(OntResourceImpl.java:63)

com.hp.hpl.jena.enhanced.BuiltinPersonalities.<clinit>(BuiltinPersonalities.java:27)
com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:50)

com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:122)

com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:116)
com.hp.hpl.jena.vocabulary.OWL.<clinit>(OWL.java:37)

com.hp.hpl.jena.ontology.ProfileRegistry.<clinit>(ProfileRegistry.java:48)
com.hp.hpl.jena.ontology.OntModelSpec.<clinit>(OntModelSpec.java:54)
OntologyToModel.importOntology(OntologyToModel.java:91)
LoadSchemas.doGet(LoadSchemas.java:93)
LoadSchemas.doPost(LoadSchemas.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I have loaded the xercesImpl-2.9.1.jar and jena-2.6.3.jar (plus other
necessary libs), and I am sure that the class that is not found is in the
xercesImpl-2.9.1.jar library.

Any ideas what the problem could be?

Thank you in advance,
Eva
--
View this message in context: http://old.nabble.com/java.lang.NoClassDefFoundError%3A-org-apache-xerces-util-XMLChar-tp29837929p29837929.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.
Mukul Gandhi
2010-09-29 15:03:33 UTC
Permalink
I think the almost definitive answer to this problem is:

Please provide the jar (xercesImpl.jar in this case) to JVM classpath.

Though I haven't worked with the API you've mentioned.
Post by edask
javax.servlet.ServletException: Servlet execution threw an exception
java.lang.NoClassDefFoundError: org/apache/xerces/util/XMLChar
       com.hp.hpl.jena.rdf.model.impl.Util.notNameChar(Util.java:121)
       com.hp.hpl.jena.rdf.model.impl.Util.splitNamespace(Util.java:79)
       com.hp.hpl.jena.graph.Node_URI.getLocalName(Node_URI.java:64)
--
Regards,
Mukul Gandhi
edask
2010-09-30 14:52:18 UTC
Permalink
Thanks Mukul Gandhi,
actually the problem was that although I have added the jar in the classpath
, Tomcat couldn't see it. So I added the jar into the Tomcat/shared/lib path
and the problem was solved.


Thank you again,
Eva


I think the almost definitive answer to this problem is:

Please provide the jar (xercesImpl.jar in this case) to JVM classpath.

Though I haven't worked with the API you've mentioned.
--
View this message in context: http://old.nabble.com/java.lang.NoClassDefFoundError%3A-org-apache-xerces-util-XMLChar-tp29837929p29846517.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.
Loading...