0

当我尝试使用一项 Web 服务时出现此错误:

java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z
at org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.isOperation(JaxWsServiceConfiguration.java:155)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.isValidMethod(ReflectionServiceFactoryBean.java:1853)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:623)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:289)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:392)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:499)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:241)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:202)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:90)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:152)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:464)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:331)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:318)
at javax.xml.ws.Service.getPort(Service.java:40)
at prova.wsclient.hello.HelloWorldImplService.getHelloWorldImplPort(HelloWorldImplService.java:78)
at prova.helloWorldProxy(Tasca.java:1380)
at prova.run(Tasca.java:126)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)

在我的项目中,我有 CXF 和 JSR181 罐子,似乎出现了这种方法。

在 weblogic.xml 出现:

<wls:prefer-web-inf-classes>true</wls:prefer-web-inf-classes>

此外,在 weblogic-application.xml 中:

<prefer-application-packages>
    <package-name>javax.jws.*</package-name>
</prefer-application-packages>

我的 Weblogic Server 版本是 9.2。我做错了什么?我将不胜感激任何帮助。

谢谢!

4

1 回答 1

0

我在使用 Weblogic 9.2 时遇到过此类问题,并通过将 jar 预先添加到服务器 jvm 类路径来解决(您可以通过 weblogic 控制台进行操作)。这不是正确的解决方案,但有时确实有效。

于 2013-09-19T09:11:07.190 回答