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