You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Peter van der Post <pe...@gmail.com> on 2021/09/08 15:33:50 UTC

JaxWsProxyFactoryBean fails with Java 11 / jakarta.jws.WebService based class

I’m in the process of upgrading an application from Java 8 to 11, because it requires Apache Wicket 9.
Application (libraries) uses Apache CXF 3.4.4

WebService classes are generated from WSDL and are based on jakarta.jws.WebService.
Web service client classes are instantiated with Spring using the org.apache.cxf.jaxws.JaxWsProxyFactoryBean class. This throws an exception:

org.springframework.beans.MethodInvocationException: Property 'serviceClass' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/jws/WebService

Based on the 3.4.4 notes on Java 11 support I had expected that the JaxWsProxyFactoryBean class would lean on jakarta.jws.WebService instead of javax.jws.WebService. This does not seem to be the case given the error message.

What am I missing here? What should be my next step?

thanks for your time,
Peter

Re: JaxWsProxyFactoryBean fails with Java 11 / jakarta.jws.WebService based class

Posted by Peter van der Post <pe...@gmail.com>.
Thank you Thomas and Freeman for your instant replies!

> Op 8 sep. 2021, om 17:42 heeft Thomas Matthijs <li...@selckin.be> het volgende geschreven:
> 
> Best to make everything use the versions cxf uses
> 
> https://search.maven.org/artifact/org.apache.cxf/cxf-parent/3.4.4/pom
> 
> <cxf.jakarta.jwsapi.version>2.1.0</cxf.jakarta.jwsapi.version>
> 
>     <dependency>
>                <groupId>jakarta.jws</groupId>
>                <artifactId>jakarta.jws-api</artifactId>
>                <version>${cxf.jakarta.jwsapi.version}</version>
>            </dependency>
> 
> Which is still javax.*
> 
> On Wed, 8 Sept 2021 at 17:33, Peter van der Post
> <pe...@gmail.com> wrote:
>> 
>> I’m in the process of upgrading an application from Java 8 to 11, because it requires Apache Wicket 9.
>> Application (libraries) uses Apache CXF 3.4.4
>> 
>> WebService classes are generated from WSDL and are based on jakarta.jws.WebService.
>> Web service client classes are instantiated with Spring using the org.apache.cxf.jaxws.JaxWsProxyFactoryBean class. This throws an exception:
>> 
>> org.springframework.beans.MethodInvocationException: Property 'serviceClass' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/jws/WebService
>> 
>> Based on the 3.4.4 notes on Java 11 support I had expected that the JaxWsProxyFactoryBean class would lean on jakarta.jws.WebService instead of javax.jws.WebService. This does not seem to be the case given the error message.
>> 
>> What am I missing here? What should be my next step?
>> 
>> thanks for your time,
>> Peter


Re: JaxWsProxyFactoryBean fails with Java 11 / jakarta.jws.WebService based class

Posted by Thomas Matthijs <li...@selckin.be>.
Best to make everything use the versions cxf uses

https://search.maven.org/artifact/org.apache.cxf/cxf-parent/3.4.4/pom

<cxf.jakarta.jwsapi.version>2.1.0</cxf.jakarta.jwsapi.version>

     <dependency>
                <groupId>jakarta.jws</groupId>
                <artifactId>jakarta.jws-api</artifactId>
                <version>${cxf.jakarta.jwsapi.version}</version>
            </dependency>

Which is still javax.*

On Wed, 8 Sept 2021 at 17:33, Peter van der Post
<pe...@gmail.com> wrote:
>
> I’m in the process of upgrading an application from Java 8 to 11, because it requires Apache Wicket 9.
> Application (libraries) uses Apache CXF 3.4.4
>
> WebService classes are generated from WSDL and are based on jakarta.jws.WebService.
> Web service client classes are instantiated with Spring using the org.apache.cxf.jaxws.JaxWsProxyFactoryBean class. This throws an exception:
>
> org.springframework.beans.MethodInvocationException: Property 'serviceClass' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/jws/WebService
>
> Based on the 3.4.4 notes on Java 11 support I had expected that the JaxWsProxyFactoryBean class would lean on jakarta.jws.WebService instead of javax.jws.WebService. This does not seem to be the case given the error message.
>
> What am I missing here? What should be my next step?
>
> thanks for your time,
> Peter

Re: JaxWsProxyFactoryBean fails with Java 11 / jakarta.jws.WebService based class

Posted by Freeman Fang <fr...@gmail.com>.
Hi Peter,

The CXF 3.4.4 is still using  javax. package instead of the jakarta.jws
package

And you need to ensure you have
               <dependency>
                    <groupId>jakarta.jws</groupId>
                    <artifactId>jakarta.jws-api</artifactId>
                    <version>2.1.0</version>
                </dependency>
in your project's dependencies chain.

Cheers
Freeman

On Wed, Sep 8, 2021 at 11:33 AM Peter van der Post <
peter.van.der.post@gmail.com> wrote:

> I’m in the process of upgrading an application from Java 8 to 11, because
> it requires Apache Wicket 9.
> Application (libraries) uses Apache CXF 3.4.4
>
> WebService classes are generated from WSDL and are based on
> jakarta.jws.WebService.
> Web service client classes are instantiated with Spring using the
> org.apache.cxf.jaxws.JaxWsProxyFactoryBean class. This throws an exception:
>
> org.springframework.beans.MethodInvocationException: Property
> 'serviceClass' threw exception; nested exception is
> java.lang.NoClassDefFoundError: javax/jws/WebService
>
> Based on the 3.4.4 notes on Java 11 support I had expected that the
> JaxWsProxyFactoryBean class would lean on jakarta.jws.WebService instead of
> javax.jws.WebService. This does not seem to be the case given the error
> message.
>
> What am I missing here? What should be my next step?
>
> thanks for your time,
> Peter