I had a service with unit tests utilizing JAXRSServerFactoryBean.  I believe it 
was using CXF 2.3.2.  I'm now setting up a new service using CXF 2.4.1, and I'm 
now getting the following when I run the test:

Jul 11, 2011 1:43:34 PM org.apache.cxf.transport.http.HTTPTransportFactory 
getDestination
SEVERE: Cannot find any registered HttpDestinationFactory from the Bus.

I've looked at the various examples in the wiki, and I've tried integrating 
what seems like the relevant pieces, but none of those appeared to make any 
difference.

I'm trying to set this up without using my Spring context (I know it uses 
Spring under the covers no matter what).

I'm currently calling the following utility method to create the server.  The 
"serviceBean" is my controller instance, the one I want to test.

--------------
    public static void create(Object serviceBean, String uri) {
        JAXRSServerFactoryBean  sf  = new JAXRSServerFactoryBean();

        BindingFactoryManager   manager = 
sf.getBus().getExtension(BindingFactoryManager.class);
        JAXRSBindingFactory     factory = new JAXRSBindingFactory();
        factory.setBus(sf.getBus());
        manager.registerBindingFactory(JAXRSBindingFactory.JAXRS_BINDING_ID, 
factory);
        
        Map<Object, Object> extensionsMap   = new HashMap<Object, Object>();
        extensionsMap.put("json", "application/json");
        extensionsMap.put("xml", "application/xml");

        sf.setExtensionMappings(extensionsMap);

        sf.setServiceBean(serviceBean);
        sf.getInInterceptors().add(new LoggingInInterceptor());
        sf.getOutInterceptors().add(new LoggingOutInterceptor());
        
        sf.setAddress(uri);
        
        sf.create();
    }
--------------

Reply via email to