java - Cannot connect to a local sesame local store -
i want create sparql endpoint locally tomcat on computer , sesame2.7.3 apis, there problem encountered. after have created native datastore on computer, want connect datastore , execute sparql queries on it, , code in java, following error message tomcat.
exception
javax.servlet.servletexception: error instantiating servlet class com.jelly.web.rdfservlet org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) org.apache.coyote.http11.http11processor.process(http11processor.java:861) org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:606) org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) java.lang.thread.run(thread.java:680)
root cause
java.lang.noclassdeffounderror: org/openrdf/repository/repositoryexception java.lang.class.getdeclaredconstructors0(native method) java.lang.class.privategetdeclaredconstructors(class.java:2437) java.lang.class.getconstructor0(class.java:2747) java.lang.class.newinstance0(class.java:328) java.lang.class.newinstance(class.java:310) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) org.apache.coyote.http11.http11processor.process(http11processor.java:861) org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:606) org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) java.lang.thread.run(thread.java:680)
root cause
java.lang.classnotfoundexception: org.openrdf.repository.repositoryexception org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1680) org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1526) java.lang.class.getdeclaredconstructors0(native method) java.lang.class.privategetdeclaredconstructors(class.java:2437) java.lang.class.getconstructor0(class.java:2747) java.lang.class.newinstance0(class.java:328) java.lang.class.newinstance(class.java:310) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) org.apache.coyote.http11.http11processor.process(http11processor.java:861) org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:606) org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) java.lang.thread.run(thread.java:680)
my servlet code following:
import java.io.file; import java.io.ioexception; import java.util.list; import javax.servlet.requestdispatcher; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.openrdf.repository.*; import org.openrdf.repository.config.repositoryconfig; import org.openrdf.repository.config.repositoryconfigexception; import org.openrdf.repository.config.repositoryimplconfig; import org.openrdf.repository.manager.localrepositorymanager; import org.openrdf.repository.sail.config.sailrepositoryconfig; import org.openrdf.sail.config.sailimplconfig; import org.openrdf.sail.nativerdf.config.nativestoreconfig;` public class rdfservlet extends httpservlet { public rdfservlet() { super(); // todo auto-generated constructor stub } protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { // todo auto-generated method stub string querystring = request.getparameter("queryinput"); // create rdf model string dbdirectory = "/users/ray/documents/a04_developer/12_personsearch/sesamedb"; sailimplconfig backendconfig = new nativestoreconfig(); repositoryimplconfig repositorytypespec = new sailrepositoryconfig(backendconfig); try { localrepositorymanager manager = new localrepositorymanager(new file(dbdirectory)); manager.initialize(); string repositoryid = "personv0"; repositoryconfig config = new repositoryconfig(repositoryid, repositorytypespec); manager.addrepositoryconfig(config); repository repo = manager.getrepository(repositoryid); rdfmodel model = new rdfmodel(repo); @suppresswarnings("rawtypes") list solutions = model.queryrdf(repo, querystring); request.setattribute("rdf", solutions); requestdispatcher view = request.getrequestdispatcher("result.jsp"); view.forward(request, response); } catch (repositoryexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (repositoryconfigexception e) { // todo auto-generated catch block e.printstacktrace(); } } }
i'm confused this, can me? in advance.
i add .jar files own /lib directory, ok.
Comments
Post a Comment