I am looking for compatible combination of org.apache.cxf:cxf-spring-boot-starter-jaxws
with jaxws-api
/jaxws-ri
on Java 10+.
Our application works fine on Java 8.
Also on Java 9 & 10 with --add-modules=java.se.ee
.
But, when i remove this option and add following dependecies:
compile group: 'javax.xml.ws', name: 'jaxws-api', version: '2.3.0' compile group: 'com.sun.xml.ws', name: 'jaxws-ri', version: '2.3.0.2', ext: 'pom' compile group: 'com.sun.xml.ws', name: 'jaxws-rt', version: '2.3.0.2', ext: 'pom'
common dependencies (with/without --add-modules in java 9/10, or java 8):
compile('org.apache.cxf:cxf-spring-boot-starter-jaxws:3.2.6')
I become:
Caused by: java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z at org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.isOperation(JaxWsServiceConfiguration.java:190) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.isValidMethod(ReflectionServiceFactoryBean.java:1962) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.createInterface(ReflectionServiceFactoryBean.java:999) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:461) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:695) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:530) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211) at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460) at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255) at ..... at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:564) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ... 44 more
Note sure about sprint boot, but to get JAXWS working in Java 11, I used
<profiles> <!-- add back the jaxws SOAP dependendies which were removed in JDK11 --> <profile> <id>jdk11</id> <activation> <jdk>[11,)</jdk> </activation> <!-- tested working with OpenJDK 11.0.8 --> <dependencies> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-rt</artifactId> <version>2.3.3</version> <type>pom</type> </dependency> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>rt</artifactId> <version>2.3.3</version> </dependency> </dependencies> </profile> </profiles>
The documentation regarding this removal (JEP 320) has a topic called Risks and Assumptions followed by Java EE modules in which they suggest alternatives for the removals, like jaxws-ri and jaxb-ri.
In my case I was using the javax.jws package in Java 8 and it got removed in Java 11. So as the JEP suggests, I just had to add the following dependency to get it working again on Java 11:
<dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-ri</artifactId> <version>2.3.2</version> <type>pom</type> </dependency>
In your case you may need other dependencies as well, just take a look at the JEP suggestions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With