Below is the routes configuration
@Component
public class CamelRoutes extends RouteBuilder {
@Override
public void configure() throws Exception {
from("cxfrs://bean://rsServer").log("hello camel");
}
}
Below is the CXF configuration
@Configuration
public class CxfConfig {
@Bean
public SpringJAXRSServerFactoryBean rsServer() {
SpringJAXRSServerFactoryBean factory = new SpringJAXRSServerFactoryBean();
factory.setResourceClasses(CamelResource.class);
factory.setAddress("/rest");
return factory;
}
}
Below is the resource class
@Path("/camelresource")
public class CamelResource {
@GET
@Path("/hellocamel")
public String helloCamel() {
System.out.println("hello how are you.");
return "helloCamel()";
}
}
server started.
http://localhost:8080/cxf
on calling rest api "http://localhost:8080/cxf/rest/camelresource/hellocamel" I am getting below error
No message body writer has been found for class org.apache.cxf.message.MessageContentsList, ContentType: text/html
Please suggest what is an issue. furthermore I want to return response from hellocamel endpoint. early response will be highly appreciated.
Need solution, with example