error java.lang.noclassdeffounderror:Java11中的javax/jws/webservice

wwwo4jvm  于 2021-07-03  发布在  Java
关注(0)|答案(1)|浏览(733)

在设置jaxwsproxyfactorybean服务类时,在我的cxfWebService调用中,我得到了一个致命错误,我在下面给出了它的跟踪。我正在将代码从Java8迁移到Java11。
我已经在构建路径中设置了所有必需的库jar、cxf包和jax-ws-jar,但是仍然无法解决这个错误。这是我的密码:

APIWS _stub = null;
        JaxWsProxyFactoryBean fac = new JaxWsProxyFactoryBean();

        fac.setAddress(API_WS_URL);
        fac.setServiceClass(APIWS.class);

        _stub = (APIWS) fac.create();
        Client c = ClientProxy.getClient(_stub);
        HTTPConduit http = (HTTPConduit)c.getConduit();
        HTTPClientPolicy policy = new HTTPClientPolicy();
        policy.setConnectionTimeout(0);
        policy.setReceiveTimeout(0);
        http.setClient(policy);

        c.getInInterceptors().add(new LoggingInInterceptor());
        c.getInInterceptors().add(new LoggingOutInterceptor());
        ApiWS.aboutCall(_stub);
        List<String> output = ApiWS.invokeLiqApiWebService(_stub, transformedQueue);
        outputFileList.addAll(output);

错误:

java.lang.NoClassDefFoundError: javax/jws/WebService
at org.apache.cxf.jaxws.support.JaxWsImplementorInfo.initialize(JaxWsImplementorInfo.java:273)
at org.apache.cxf.jaxws.support.JaxWsImplementorInfo.<init>(JaxWsImplementorInfo.java:60)
at org.apache.cxf.jaxws.JaxWsClientFactoryBean.setServiceClass(JaxWsClientFactoryBean.java:43)
at org.apache.cxf.frontend.ClientProxyFactoryBean.setServiceClass(ClientProxyFactoryBean.java:224)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQProcess.callLiqAPI(LIQProcess.java:331)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQProcess.process(LIQProcess.java:154)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQJobManager.processJob(LIQJobManager.java:106)
at com.qnb.ib.loaniq.inbound.interfaces.process.LIQJobManager.main(LIQJobManager.java:132)
Caused by: java.lang.ClassNotFoundException: javax.jws.WebService
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more

需要帮助解决此问题。
谢谢

piah890a

piah890a1#

这些是我在构建路径中添加的jar,用于解决调用web服务的问题。fastinfoset-1.2.15.jar gmbal-api-only-3.1.0-b001.jar ha-api-3.1.9.jar istack-commons-runtime-3.0.7.jar javax.activation-1.2.0.jar javax.activation-api-1.2.0.jar javax.annotation-api-1.3.2.jar javax.jws-api-1.jar javax.xml.soap-api-1.4.0.jar jaxb-api-2.3.1.jar jaxws-api-2.3.1.jar jaxws-ri-2.3.1.pom jaxws-rt-2.3.1.jarmanagement-api-3.0.0-b012.jar mimepull-1.9.10.jar policy-2.7.5.jar saaj-impl-1.5.0.jar stax2-api-4.1.jar stax-ex-1.8.jar streambuffer-1.5.6.jar txw2-2.3.1.jar woodstox-core-5.1.0.jar
希望这能帮助那些在Java11中遇到类似问题的人

相关问题