camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: CXFRS does not process JSON
Date Wed, 25 Jul 2012 12:11:23 GMT
Hi
On 25/07/12 11:12, hom wrote:
> In order to configure the JSONProvider, I switched to the server approach:
>
>       <jaxrs:server id="providerPOXJSON" address="/xyz/json">
>          <jaxrs:serviceBeans>
>              <ref component-id="providerAdapter"/>
>          </jaxrs:serviceBeans>
>          <jaxrs:providers>
>            <ref component-id="jsonProvider" />
>          </jaxrs:providers>
>      </jaxrs:server>
>
>     <bean id="providerAdapter" class="org.xyz.json.ProviderAdapter"/>
>
>      <bean id="jsonProvider"
> class="org.apache.cxf.jaxrs.provider.JSONProvider">

The complete class name is 
"org.apache.cxf.jaxrs.provider.json.JSONProvider" in CXF 2.6.1, I can 
see the docs wrongly referring to the old package in a couple of places, 
will get that fixed now.
You'll also need to add
<dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-rs-extension-providers</artifactId>
             <version>2.6.1</version>
         </dependency>
<dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <version>1.3.1</version>
         </dependency>


Note in Camel you can do
<jaxrs:server id="providerPOXJSON" address="camel://direct:xyzJSON">

I've also seen a cxfrs rsServer component having a <providers> element, 
but I haven't tried.

HTH, Sergey

> 	<property name="namespaceMap">
> 	<map>
> 	<entry key="DoItRequest" value="{http://xyz/types}DoItRequest"/>
> 	</map>
> 	</property>
>      </bean>
>
> When I deploy this I get the following error:
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.cxf.jaxrs.provider.JSONProvider not found by
> org.apache.cxf.cxf-rt-frontend-jaxrs [132]
> 	at
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:787)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)[org.apache.felix.framework-3.0.9.jar:]
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
> 	at
> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.resolver.WireImpl.getClass(WireImpl.java:99)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.ModuleImpl.searchImports(ModuleImpl.java:1390)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:722)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:71)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1768)[org.apache.felix.framework-3.0.9.jar:]
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)[:1.6.0_24]
> 	at
> org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:645)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1619)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:900)[org.apache.felix.framework-3.0.9.jar:]
> 	at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:384)[10:org.apache.aries.blueprint:0.3.1]
> 	at
> org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:381)[10:org.apache.aries.blueprint:0.3.1]
> 	at
> org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:113)[10:org.apache.aries.blueprint:0.3.1]
> 	at
> org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:110)[10:org.apache.aries.blueprint:0.3.1]
>
>
> It seems that cxf-rt-frontend-jaxrs does not have access to the JSONProvider
> class. The bundle does not import the required package.
>
> Do you have an idea how to fix that?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/CXFRS-does-not-process-JSON-tp5716343p5716449.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



Mime
View raw message