cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Arnold <>
Subject Dependencies for CXF unit testing
Date Fri, 17 Jan 2014 15:01:19 GMT
I'm running into a curious dependency issue running unit tests using CXF 
endpoints. My test sets up a basic REST service using the local 
transport (i.e. local://myservice) via Camel and then attempts to use it 
via a proxy generated by JAXRSClientFactory. My pom includes camel-cxf, 
cxf-rt-frontend-jaxrs, and cxf-rt-transports-local. The oddity is that 
when the service only handles "native" java objects (e.g. String) 
everything works fine, but if it's handling JAXB bound objects it errors 
out with:
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
     at java.lang.reflect.Constructor.newInstance(
     at org.apache.cxf.jaxrs.client.AbstractClient.convertToWebApplicationException(
     at org.apache.cxf.jaxrs.client.ClientProxyImpl.checkResponse(
     at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(
     at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(
     at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(
     at com.sun.proxy.$Proxy22.getBook(Unknown Source)
     <snip surefire/maven stack...>

unless I add cxf-rt-transports-http-jetty to my pom's dependencies. Also 
enabled TRACE logging on org.apache.cxf.* but no messages indicating why 
the server is erroring out.  Any idea why it requires the jetty 
transport to function property?

Details: CXF 2.7.8, Camel 2.12.2, Java 1.7.0_45
Full unit test for reference:

public class DataBindingTest extends CamelTestSupport {

     private LibraryBean libBean = new LibraryBean();

     public void dataBindingTest() throws Exception {
         LibraryService client = JAXRSClientFactory.create("local://rest", LibraryService.class);

         Book bookResp = client.getBook("1984");
         Book expect = null;
         for (Book b : libBean.books) {
             if (b.getName().equals("1984")) {
                 expect = b;
         assertEquals(expect, bookResp);

     protected CamelContext createCamelContext() throws Exception {
         CamelContext cc = super.createCamelContext();
         cc.addComponent("activemq", activeMQComponent("vm://localhost?broker.persistent=false"));
         return cc;

     protected JndiRegistry createRegistry() throws Exception {
         JndiRegistry jr = super.createRegistry();
         jr.bind("libraryBean", libBean);
         return jr;

     protected RouteBuilder createRouteBuilder() {
         return new RouteBuilder() {
             public void configure() {




  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message