Tuesday, March 1, 2016

The matching wildcard is strict, but no declaration can be found for element 'jaxrs:client'.



The Answer is in the Migration Guide

3.0 Migration Guide

JAX-RS

  • JAX-RS 2.0 has been completely implemented.
  • JAX-RS WADL auto-generation code has been moved to a new cxf-rt-rs-service-description module.
  • JAX-RS 2.0 Client API and CXF specific WebClient and Proxy client code is now available in a new cxf-rt-rs-client module. Important: the namespace for jaxrs:client elements has changed from "http://cxf.apache.org/jaxrs" to "http://cxf.apache.org/jaxrs-client"
  • CXF RequestHandler and ResponseHandler filters have been removed, please use JAX-RS 2.0 ContainerRequestFilter and ContainerResponseFilter and also WriterInterceptor and ReaderInterceptor when needed.
  • CXF JAX-RS Form extension has been dropped, please use JAX-RS 2.0 Form.
  • CXF JAX-RS ParameterHandler has been dropped, please use JAX-RS 2.0 ParamConverterProvider.
  • javax.annotation.Resource annotation can no longer be used to annotate JAX-RS context properties. Only javax.ws.rs.core.Context annotation is supported from now on.



Working Configuration
----------------------------

POM File 
-----------

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>3.0.0-milestone1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
<version>3.0.0-milestone1</version>
</dependency>
</dependencies>

Application-Context
------------------------------
<?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"
xmlns:jaxrs-client="http://cxf.apache.org/jaxrs-client"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd
                           http://www.springframework.org/schema/util
                           http://www.springframework.org/schema/util/spring-util.xsd
                           http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
                           http://cxf.apache.org/jaxrs-client http://cxf.apache.org/schemas/jaxrs-client.xsd">



<jaxrs-client:client id="webClient"
address="http://localhost:8080/LockManager/lock/acquireLock"
serviceClass="org.apache.cxf.jaxrs.client.WebClient">
<jaxrs-client:headers>
<entry key="Accept" value="application/json" />
</jaxrs-client:headers>
</jaxrs-client:client>
</beans>

1 comment: