iferminm
iferminm

Reputation: 2059

InvocationTargetException on Web Service using Jena and AXIS

I'm new here on stackOverflow so, hi again =)

I'm using Jena Semantic Web Framework, Pellet Reasoner, Eclipse IDE (on a Linux machine) and Virtuoso OSE to store my graphs. I also made my ontology using Protege Editor =).

I'm working on a Client-Server app using SOAP, i wrote a procedure that reads the base model, applies reasoning by using pellet and writes the whole reasoned model on a temporary owl file, then, another procedure reads the reasoned model and stores it in Virtuoso, so I can query it through Virtuoso's SPARQL endpoint using a Python client.

The problem is that when I invoke the web service that calls the procedure that generates the reasoned model, I get this message (complete stack trace at the end of this question)

AxisFault
    faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode: 
    faultString: java.lang.reflect.InvocationTargetException
    faultActor: 
    faultNode: 
    faultDetail: 
      {http://xml.apache.org/axis/}hostname:leia

This is the routine that generates the reasoned model, and it this is the one that's throwing the Exception.

public InfModel reasonOverModel(String path) {
    Model emptyModel = ModelFactory.createDefaultModel();

    // Pellet instance
    Reasoner reasoner = PelletReasonerFactory.theInstance().create();

    InfModel model = ModelFactory.createInfModel(reasoner, emptyModel);
    try {
        InputStream in = FileManager.get().open(path);
        model.read(in, "");
    } catch (Exception ex) {
        // TODO: log with log4j
        ex.printStackTrace();
        return null;
    }
    return model;
}

It is reading the base model from "path" and it is applying reasoning over it, but it is not returning and my catch clause isn't catching that exception and I don't know why. It seems to be an Axis problem .

Any idea, clue or recommendation?? Thanks a lot in advance Greets from Caracas - Venezuela ----------------------------Complete Stacktrace Here-----------------------------

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.lang.reflect.InvocationTargetException
 faultActor: 
 faultNode: 
 faultDetail: 
    {http://xml.apache.org/axis/}hostname:leia

java.lang.reflect.InvocationTargetException
    at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
    at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
    at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
    at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
    at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.thesis.server.Admin.updateReasonedModel(Admin.java:21)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
    at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
    at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
    at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
    at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

EDIT JAN 19:

I also tried moving everything from tomcat 7 to tomcat 6.0.35 as @RakeshPatel recommended bellow, but still getting the same exception.

I've been reading about the InvocationTargetException and it wraps other exceptions, so, I captured it client-side and got the cause by using the getCause() method, but it returns null. It is strange, because I debugged it and it seems to be executing all the try block, but it never reaches the return statement.

Any clue or advice?

Upvotes: 2

Views: 2443

Answers (1)

iferminm
iferminm

Reputation: 2059

I've already solved this,

Jena appears not to be thread safe (If i'm wrong, please let me know), that's why I couldn't expose it as web services, I opted for developing a separate web application that uses Jena classes and administrates my OWL documents, all in Java.

Upvotes: 0

Related Questions