java - Jena: Nullpointer exception while iterating the dataset -
java - Jena: Nullpointer exception while iterating the dataset -
can please help me solving below issue. i'm running triplestore on 1 tomcat server , application access triplestore on tomcat7 server. first time, application runs if restart application , not triplestore causing nullpointer issue.
below exception causing on triplestore server
severe: servlet.service() servlet [servletadaptor] in context path [/triplestore] threw exception [java.lang.nullpointerexception] root cause java.lang.nullpointerexception @ com.hp.hpl.jena.sparql.util.nodeutils$1.accept(nodeutils.java: @ com.hp.hpl.jena.sparql.util.nodeutils$1.accept(nodeutils.java:91) @ com.hp.hpl.jena.util.iterator.mapfilteriterator.hasnext(mapfilteriterator.java:55) @ au.com.triplestore.core.impl.triplestoreimpl.savedataset(triplestoreimpl.java:224) @ au.com.triplestore.web.triplestorers.savedata(triplestorers.java:323) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:606) @ org.glassfish.jersey.server.model.internal.resourcemethodinvocationhandlerfactory$1.invoke(resourcemethodinvocationhandlerfactory.java:81) @ org.glassfish.jersey.server.model.internal.abstractjavaresourcemethoddispatcher$1.run(abstractjavaresourcemethoddispatcher.java:151) @ org.glassfish.jersey.server.model.internal.abstractjavaresourcemethoddispatcher.invoke(abstractjavaresourcemethoddispatcher.java:171) @ org.glassfish.jersey.server.model.internal.javaresourcemethoddispatcherprovider$responseoutinvoker.dodispatch(javaresourcemethoddispatcherprovider.java:152) @ org.glassfish.jersey.server.model.internal.abstractjavaresourcemethoddispatcher.dispatch(abstractjavaresourcemethoddispatcher.java:104) @ org.glassfish.jersey.server.model.resourcemethodinvoker.invoke(resourcemethodinvoker.java:402) @ org.glassfish.jersey.server.model.resourcemethodinvoker.apply(resourcemethodinvoker.java:349) @ org.glassfish.jersey.server.model.resourcemethodinvoker.apply(resourcemethodinvoker.java:106) @ org.glassfish.jersey.server.serverruntime$1.run(serverruntime.java:259) @ org.glassfish.jersey.internal.errors$1.call(errors.java:271) @ org.glassfish.jersey.internal.errors$1.call(errors.java:267) @ org.glassfish.jersey.internal.errors.process(errors.java:315) @ org.glassfish.jersey.internal.errors.process(errors.java:297) @ org.glassfish.jersey.internal.errors.process(errors.java:267) @ org.glassfish.jersey.process.internal.requestscope.runinscope(requestscope.java:318) @ org.glassfish.jersey.server.serverruntime.process(serverruntime.java:236) @ org.glassfish.jersey.server.applicationhandler.handle(applicationhandler.java:1010) @ org.glassfish.jersey.servlet.webcomponent.service(webcomponent.java:373) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:382) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:345) @ org.glassfish.jersey.servlet.servletcontainer.service(servletcontainer.java:220) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:241) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:220) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:501) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:170) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:98) @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:950) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:408) @ org .apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1040) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:607) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.dorun(aprendpoint.java:2441) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.run(aprendpoint.java:2430) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ java.lang.thread.run(thread.java:744)
and here code fails (line - while (listofsavednames.hasnext()) { )
public boolean savedataset(model model, string baseuri, boolean issave, string reasonername) { dataset.begin(readwrite.write); boolean alreadysaved = false; infmodel infmodel = null; if (baseuri == null) { baseuri = model.getnsprefixuri("ex"); } iterator<string> listofsavednames = dataset.listnames(); while (listofsavednames.hasnext()) { if (baseuri.equals(listofsavednames.next())) { alreadysaved = true; break; } } if (issave) { if (alreadysaved) { model defaultmodel = dataset.getdefaultmodel(); model namedmodel = dataset.getnamedmodel(baseuri); dataset.removenamedmodel(baseuri); defaultmodel.add(infmodel); namedmodel.add(infmodel); //add new model dataset.addnamedmodel(baseuri, namedmodel); } else { model defaultmodel = dataset.getdefaultmodel(); defaultmodel.add(infmodel); dataset.addnamedmodel(baseuri, infmodel); } } else { model defaultmodel = dataset.getdefaultmodel(); model namedmodel = dataset.getnamedmodel(baseuri); dataset.removenamedmodel(baseuri); defaultmodel.add(infmodel); namedmodel.add(infmodel); //add new model dataset.addnamedmodel(baseuri, namedmodel); } dataset.commit(); tdb.sync(dataset); dataset.end(); schemadataset.end(); homecoming true; }
java tomcat7 jena triplestore
Comments
Post a Comment