java - Condition in CATCH block when I run a query on DBPedia -
i have question:
i have written java code executes queries on dbpedia. usually, dbpedia out , error:
severe [http-apr-8080-exec-12] com.sun.xml.ws.server.sei.endpointmethodhandler.invoke error making query, see cause details httpexception: 502 @ com.hp.hpl.jena.sparql.engine.http.httpquery.execget(httpquery.java:340) @ com.hp.hpl.jena.sparql.engine.http.httpquery.exec(httpquery.java:276) @ com.hp.hpl.jena.sparql.engine.http.queryenginehttp.execselect(queryenginehttp.java:345) @ ws.test.testmethod(test.java:184) @ 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) @ com.sun.xml.ws.api.server.instanceresolver$1.invoke(instanceresolver.java:246) @ com.sun.xml.ws.server.invokertube$2.invoke(invokertube.java:146) @ com.sun.xml.ws.server.sei.endpointmethodhandler.invoke(endpointmethodhandler.java:257) @ com.sun.xml.ws.server.sei.seiinvokertube.processrequest(seiinvokertube.java:95) @ com.sun.xml.ws.api.pipe.fiber.__dorun(fiber.java:629) @ com.sun.xml.ws.api.pipe.fiber._dorun(fiber.java:588) @ com.sun.xml.ws.api.pipe.fiber.dorun(fiber.java:573) @ com.sun.xml.ws.api.pipe.fiber.runsync(fiber.java:470) @ com.sun.xml.ws.server.wsendpointimpl$2.process(wsendpointimpl.java:295) @ com.sun.xml.ws.transport.http.httpadapter$httptoolkit.handle(httpadapter.java:515) @ com.sun.xml.ws.transport.http.httpadapter.handle(httpadapter.java:285) @ com.sun.xml.ws.transport.http.servlet.servletadapter.handle(servletadapter.java:143) @ com.sun.xml.ws.transport.http.servlet.wsservletdelegate.doget(wsservletdelegate.java:155) @ com.sun.xml.ws.transport.http.servlet.wsservletdelegate.dopost(wsservletdelegate.java:189) @ com.sun.xml.ws.transport.http.servlet.wsservlet.dopost(wsservlet.java:76) @ javax.servlet.http.httpservlet.service(httpservlet.java:644) @ javax.servlet.http.httpservlet.service(httpservlet.java:725) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:291) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:219) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106) @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:505) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:142) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) @ org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:534) @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1081) @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:658) @ org.apache.coyote.http11.http11aprprotocol$http11connectionhandler.process(http11aprprotocol.java:277) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.dorun(aprendpoint.java:2381) @ org.apache.tomcat.util.net.aprendpoint$socketprocessor.run(aprendpoint.java:2370) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) @ java.lang.thread.run(thread.java:744)
now, want add together in code try/catch block when phone call operation:
queryexecution qe = query(string);
what status must insert in grab error?
from code looks throws httpexception.
so write:
try { queryexecution qe = query(string); } grab (httpexception ex) { system.out.println (ex.getmessage()); //optional ex.printstacktrace(); //optional }
another grab can catch (exception ex) {..}
// grab problem. if know exact exception utilize exact.
at grab wrote mutual error prints, can fill find suits problem.
java exception try-catch sparql dbpedia
No comments:
Post a Comment