You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by "McGibbney, Lewis John" <Le...@gcu.ac.uk> on 2010/12/29 15:04:22 UTC
Cannot initialize OntModelSpec
Hello List,
I have been working with Jena to boost query performance using ontology and have encountered problems with the above class when I submit a query within my web application. I first show tomcat exception error followed a root cause, this is followed by Tomcat console output showing LOG.info "creating new ontology", finally I attach the class which cannot be initialized.
exception
org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class com.hp.hpl.jena.ontology.OntModelSpec
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.NoClassDefFoundError: Could not initialize class com.hp.hpl.jena.ontology.OntModelSpec
org.apache.nutch.ontology.jena.OntologyImpl.<init>(OntologyImpl.java:82)
-------------
2010-12-29 13:43:06,794 INFO OntologyFactory - Using the first ontology extensi
on found: org.apache.nutch.ontology.jena.OntologyImpl
2010-12-29 13:43:06,811 INFO Ontology - creating new ontology
-------------
public OntologyImpl() {
//only initialize all the static variables
//if first time called to this ontology constructor
if (ontology == null) {
if (LOG.isInfoEnabled()) { LOG.info( "creating new ontology"); }
parser = new OwlParser();
ontology = this;
}
if (ontologyModel == null)
ontologyModel = <<<<Line 82
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
//ModelFactory.createOntologyModel();
}
I have been able to replicate this problem a couple of times and I am unsure of why it is occuring as I have specified my ontology location to the application. I am using Jena 2.1, Tomcat 6.0.26 running on Windows Vista.
I am aware that this may not be directly associated with the implementation of Jena but any help or pointers would be appreciated.
Thank you, Lewis
Glasgow Caledonian University is a registered Scottish charity, number SC021474
Winner: Times Higher Education's Widening Participation Initiative of the Year 2009 and Herald Society's Education Initiative of the Year 2009
http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
Re: Cannot initialize OntModelSpec
Posted by Ian Dickinson <i....@gmail.com>.
Hi Lewis,
I don't know if you've got this working yet, but:
On Wed, Dec 29, 2010 at 2:04 PM, McGibbney, Lewis John
<Le...@gcu.ac.uk> wrote:
> Hello List,
>
> org.apache.jasper.JasperException: javax.servlet.ServletException:
> java.lang.NoClassDefFoundError: Could not initialize class
> com.hp.hpl.jena.ontology.OntModelSpec
simply means that jena.jar is not on the classpath for your servlet.
You need all of the Jena jars in the /lib directory of your servlet's
.war file. NoClassDefFoundError is not a Jena specific error, it's
what the JVM says when it's asked to load a Java class that it cannot
find on the classpath.
Hth,
Ian