使用Jena和AXIS的Web服务上的InvocationTargetException

时间:2012-01-18 23:56:59

标签: java web-services soap axis jena

我是stackOverflow的新手,所以,再次=)

我正在使用Jena Semantic Web Framework,Pellet Reasoner,Eclipse IDE(在Linux机器上)和Virtuoso OSE来存储我的图形。我还使用Protege Editor =)创建了我的本体。

我正在使用SOAP工作的Client-Server应用程序,我编写了一个读取基本模型的过程,使用pellet应用推理并将整个推理模型写入临时owl文件,然后,另一个过程读取推理模型并将其存储在Virtuoso中,因此我可以使用Python客户端通过Virtuoso的SP​​ARQL端点进行查询。

问题在于,当我调用调用生成推理模型的过程的Web服务时,我收到此消息(此问题末尾的完整堆栈跟踪)

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

这是生成推理模型的例程,而这就是抛出异常的那个。

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;
}

它正在从“路径”中读取基本模型并且它正在应用推理,但它没有返回,我的catch子句没有捕获该异常,我不知道为什么。这似乎是轴心问题。

任何想法,线索或推荐? 非常感谢提前 招呼来自加拉加斯 - 委内瑞拉 ----------------------------在这里完成Stacktrace ------------------- ----------

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)

编辑JAN 19:

我也尝试将所有内容从tomcat 7移动到tomcat 6.0.35,因为@RakeshPatel建议如下,但仍然得到相同的异常。

我一直在阅读有关InvocationTargetException并且它包装了其他异常,因此,我在客户端捕获它并通过使用getCause()方法得到原因,但它返回null。这很奇怪,因为我调试了它,它似乎正在执行所有的try块,但它永远不会到达return语句。

任何线索或建议?

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题,

Jena似乎不是线程安全的(如果我错了,请告诉我),这就是为什么我不能将它作为Web服务公开,我选择开发一个使用Jena类并管理我的单独的Web应用程序OWL文档,全部使用Java。