camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bijoy <>
Subject Issues with cxfrs using json
Date Fri, 28 Mar 2014 08:20:15 GMT

I'm trying to expose a REST webservice which takes json as input and also
provide response as json. I wanted to package the application as war and to
deploy on external jetty container. I'm facing two problem implementing

1. The json object which comes along with REST request is not being mapped
to Exchange body and while accessing the exchange body I'm getting
NullPointerException. But sending json object as response is working fine.
2. To use JSONProvider I had to include following dependency...
But adding above dependency is running internal jetty container(on random
port) on top of external jetty container(running on 8080) instance. I tried
to exclude jetty-* artifacts from the dependency but getting exception while
deploying the app. It seems the modules are inter-dependent so can't be

Any guidance to solve the issues is much appreciated. 

 <import resource="classpath:META-INF/cxf/cxf.xml" />   
  <jaxrs:server id="restServer" staticSubresourceResolution="true">
      <ref bean="restServices"/>
     <ref bean="jsonProvider"/> 

<bean id="jsonProvider"
<bean id="processRequest" class="sample.RequestProcessor"/> 

<camel:camelContext id="sampleContext" autoStartup="true"
 <camel:route id="httpRequest" startupOrder="2">
           <camel:process ref="processRequest"/>

public void process(Exchange exchange) throws Exception {
RequestPOJO req = exchange.getIn().getBody(RequestPOJO.class); *//getting
NullPointerException here*

@XmlRootElement(name = "createRequest")
public class RequestPOJO {
	String orderId;
	String timeStamp;
	public String getOrderId() {
		return reRatingOrderId;
	public void setOrderId(String orderId) {
		this.orderId = orderId;
	public String getTimeStamp() {
		return timeStamp;
	public void setTimeStamp(String timestamp) {
		this.timeStamp = timestamp;


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message