In my cxf webservice invocation while I set the JaxWsProxyFactoryBean service class, I get a fatal error whose trace I have given below. I am migrating my code from java 8 to java 11.
I have set all the required library jars,cxf bundle and jax-ws jars at my build path but still I am unable to resolve the error. Here is my code:
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);
Error:
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
Need help resolving this issue.
Thanks
These are the jars I have added in my build path to resolve the issue with calling the Web Services.
Hope this helps those who are facing similar issue in java 11