You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by kliu4 <kl...@masonlive.gmu.edu> on 2014/08/29 15:57:01 UTC

nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam

Dear all,

I faced following error when I create a restful service using Spring + CXF:

   org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:

PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam


I tried to find the solution but can not find any similar solutions. Following is my bean.xml:


<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xmlns:jaxrs="http://cxf.apache.org/jaxrs"

  xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://cxf.apache.org/jaxrs

http://cxf.apache.org/schemas/jaxrs.xsd">



  <!-- do not use import statements if CXFServlet init parameters link to this beans.xml -->



  <import resource="classpath:META-INF/cxf/cxf.xml" />

  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />



  <jaxrs:server id="customerService" address="/service1">

    <jaxrs:serviceBeans>

      <ref bean="customerBean" />

    </jaxrs:serviceBeans>

  </jaxrs:server>



  <bean id="customerBean" class="cxfweb.CustomerService" />

</beans>

And following is my pom.xml dependencies;

<dependencies>

<!-- Spring -->

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-web</artifactId>

<version>4.0.6.RELEASE</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-context</artifactId>

<version>4.0.6.RELEASE</version>

</dependency>

<!-- CXF -->

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-frontend-jaxws</artifactId>

<version>3.0.1</version>

</dependency>

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-frontend-jaxrs</artifactId>

<version>3.0.1</version>

</dependency>

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-transports-http</artifactId>

<version>3.0.1</version>

</dependency>

   <dependency>

        <groupId>javax.ws.rs<http://javax.ws.rs/></groupId>

        <artifactId>javax.ws.rs-api</artifactId>

        <version>2.0</version>

      </dependency>


<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>3.8.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>javax.ws.rs<http://javax.ws.rs/></groupId>

<artifactId>javax.ws.rs-api</artifactId>

<version>2.0-m01</version>

</dependency>

</dependencies>


I am wondering if you could help me. Thanks very much?



Kai Liu
Ph.D. student
Department of Geography and GeoInformation Science
George Mason University

RE: nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam

Posted by kliu4 <kl...@masonlive.gmu.edu>.
?Thanks for pointing this out. There are duplicate dependencies? in my pom.xml, I delete one and it works now.


Thanks.




Kai Liu
Ph.D. student
Department of Geography and GeoInformation Science
George Mason University
________________________________
From: Kai Liu <kl...@gmail.com>
Sent: Friday, August 29, 2014 12:14 PM
To: kliu4
Subject: Fwd: nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam



---------- Forwarded message ----------
From: Sergey Beryozkin <sb...@gmail.com>>
Date: Fri, Aug 29, 2014 at 12:02 PM
Subject: Re: nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam
To: users@cxf.apache.org<ma...@cxf.apache.org>


Hi

I think you have JAXRS 1.1 API loaded somewhere too.
Or may it is to do with the wrong artifact name ?

"<groupId>javax.ws.rs<http://javax.ws.rs><http://javax.ws.rs/></groupId>"



Cheers, Sergey

On 29/08/14 14:57, kliu4 wrote:
Dear all,

I faced following error when I create a restful service using Spring + CXF:

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:

PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam


I tried to find the solution but can not find any similar solutions. Following is my bean.xml:


<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

   xmlns:jaxrs="http://cxf.apache.org/jaxrs"

   xsi:schemaLocation="

http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans.xsd

http://cxf.apache.org/jaxrs

http://cxf.apache.org/schemas/jaxrs.xsd">



   <!-- do not use import statements if CXFServlet init parameters link to this beans.xml -->



   <import resource="classpath:META-INF/cxf/cxf.xml" />

   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />



   <jaxrs:server id="customerService" address="/service1">

     <jaxrs:serviceBeans>

       <ref bean="customerBean" />

     </jaxrs:serviceBeans>

   </jaxrs:server>



   <bean id="customerBean" class="cxfweb.CustomerService" />

</beans>

And following is my pom.xml dependencies;

<dependencies>

<!-- Spring -->

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-web</artifactId>

<version>4.0.6.RELEASE</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-context</artifactId>

<version>4.0.6.RELEASE</version>

</dependency>

<!-- CXF -->

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-frontend-jaxws</artifactId>

<version>3.0.1</version>

</dependency>

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-frontend-jaxrs</artifactId>

<version>3.0.1</version>

</dependency>

<dependency>

<groupId>org.apache.cxf</groupId>

<artifactId>cxf-rt-transports-http</artifactId>

<version>3.0.1</version>

</dependency>

    <dependency>

         <groupId>javax.ws.rs<http://javax.ws.rs><http://javax.ws.rs/></groupId>

         <artifactId>javax.ws.rs-api</artifactId>

         <version>2.0</version>

       </dependency>


<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>3.8.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>javax.ws.rs<http://javax.ws.rs><http://javax.ws.rs/></groupId>

<artifactId>javax.ws.rs-api</artifactId>

<version>2.0-m01</version>

</dependency>

</dependencies>


I am wondering if you could help me. Thanks very much?



Kai Liu
Ph.D. student
Department of Geography and GeoInformation Science
George Mason University





Re: nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

I think you have JAXRS 1.1 API loaded somewhere too.
Or may it is to do with the wrong artifact name ?
"<groupId>javax.ws.rs<http://javax.ws.rs/></groupId>"



Cheers, Sergey
On 29/08/14 14:57, kliu4 wrote:
> Dear all,
>
> I faced following error when I create a restful service using Spring + CXF:
>
>     org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerService': Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
>
> PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'serviceBeans' threw exception; nested exception is java.lang.NoClassDefFoundError: javax/ws/rs/BeanParam
>
>
> I tried to find the solution but can not find any similar solutions. Following is my bean.xml:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
>    xmlns:jaxrs="http://cxf.apache.org/jaxrs"
>
>    xsi:schemaLocation="
>
> http://www.springframework.org/schema/beans
>
> http://www.springframework.org/schema/beans/spring-beans.xsd
>
> http://cxf.apache.org/jaxrs
>
> http://cxf.apache.org/schemas/jaxrs.xsd">
>
>
>
>    <!-- do not use import statements if CXFServlet init parameters link to this beans.xml -->
>
>
>
>    <import resource="classpath:META-INF/cxf/cxf.xml" />
>
>    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>
>
>    <jaxrs:server id="customerService" address="/service1">
>
>      <jaxrs:serviceBeans>
>
>        <ref bean="customerBean" />
>
>      </jaxrs:serviceBeans>
>
>    </jaxrs:server>
>
>
>
>    <bean id="customerBean" class="cxfweb.CustomerService" />
>
> </beans>
>
> And following is my pom.xml dependencies;
>
> <dependencies>
>
> <!-- Spring -->
>
> <dependency>
>
> <groupId>org.springframework</groupId>
>
> <artifactId>spring-web</artifactId>
>
> <version>4.0.6.RELEASE</version>
>
> </dependency>
>
> <dependency>
>
> <groupId>org.springframework</groupId>
>
> <artifactId>spring-context</artifactId>
>
> <version>4.0.6.RELEASE</version>
>
> </dependency>
>
> <!-- CXF -->
>
> <dependency>
>
> <groupId>org.apache.cxf</groupId>
>
> <artifactId>cxf-rt-frontend-jaxws</artifactId>
>
> <version>3.0.1</version>
>
> </dependency>
>
> <dependency>
>
> <groupId>org.apache.cxf</groupId>
>
> <artifactId>cxf-rt-frontend-jaxrs</artifactId>
>
> <version>3.0.1</version>
>
> </dependency>
>
> <dependency>
>
> <groupId>org.apache.cxf</groupId>
>
> <artifactId>cxf-rt-transports-http</artifactId>
>
> <version>3.0.1</version>
>
> </dependency>
>
>     <dependency>
>
>          <groupId>javax.ws.rs<http://javax.ws.rs/></groupId>
>
>          <artifactId>javax.ws.rs-api</artifactId>
>
>          <version>2.0</version>
>
>        </dependency>
>
>
> <dependency>
>
> <groupId>junit</groupId>
>
> <artifactId>junit</artifactId>
>
> <version>3.8.1</version>
>
> <scope>test</scope>
>
> </dependency>
>
> <dependency>
>
> <groupId>javax.ws.rs<http://javax.ws.rs/></groupId>
>
> <artifactId>javax.ws.rs-api</artifactId>
>
> <version>2.0-m01</version>
>
> </dependency>
>
> </dependencies>
>
>
> I am wondering if you could help me. Thanks very much?
>
>
>
> Kai Liu
> Ph.D. student
> Department of Geography and GeoInformation Science
> George Mason University
>