Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

spring boot - Migration JAXWS application from Java 8 to Java 11

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...