使用webservice时获取异常(AXIS2)

时间:2013-01-15 07:08:44

标签: axis2

我使用axis2和tomcat开发我的webservices,用于使用Lucene搜索我的系统。 我编写服务器类并对其进行测试,然后使用“Axis2 Service Archiver”进行部署。 Web服务中有2种方法。我用户浏览器来测试它。 [HTTP://本地主机:8080 /的axis2 /服务/电子书/加X = 1.1&安培; Y = 2.2] 这个简单的方法(PLUS)效果很好,返回3.3。 但另一个(使用lucene)返回一些异常:               无法初始化类org.apache.lucene.codecs.Codec           我不知道是什么造成了这个问题。有人可以帮忙吗?非常感谢。 以下错误消息:

org.apache.axis2.AxisFault: Could not initialize class org.apache.lucene.codecs.Codec
 at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:210)
 at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
 at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114)
 at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
 at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:144)
 at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:139)
 at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:837)
 at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:273)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
 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:222)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
 at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
 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:1004)
 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
 at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
 Caused by: java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
 at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
 ... 25 more
 Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.lucene.codecs.Codec
 at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:299)
 at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:56)
 at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:783)
 at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:52)
 at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:65)
 at ns.eBook.Search.process2(Search.java:52)
 ... 31 more

1 个答案:

答案 0 :(得分:1)

我已经解决了这个问题。 经过多方努力,我明白了。 我把web服务中使用的每个jar文件(lucene)都放到“WEB-INF \ lib”中,然后就可以了。 谢天谢地。