You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "KARR, DAVID (ATTSI)" <dk...@att.com> on 2011/07/11 22:52:09 UTC
Building new service with newer CXF, now getting "Cannot find any
registered HttpDestinationFactory from the Bus."
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();
}
--------------
RE: Building new service with newer CXF, now getting "Cannot find
any registered HttpDestinationFactory from the Bus."
Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: Willem Jiang [mailto:willem.jiang@gmail.com]
> Sent: Monday, July 11, 2011 8:24 PM
> To: users@cxf.apache.org
> Subject: Re: Building new service with newer CXF, now getting "Cannot
> find any registered HttpDestinationFactory from the Bus."
>
> Hi,
>
> Did you put the cxf-rt-transport-http-jetty jar into your class path ?
> If you are using mvn, you can use mvn dependency:tree to check with it.
Duh. That was it. Thanks.
> On Tue Jul 12 04:52:09 2011, KARR, DAVID (ATTSI) wrote:
> > 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();
> > }
> > --------------
>
>
>
> --
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang
> Weibo: willemjiang
Re: Building new service with newer CXF, now getting "Cannot find
any registered HttpDestinationFactory from the Bus."
Posted by Willem Jiang <wi...@gmail.com>.
Hi,
Did you put the cxf-rt-transport-http-jetty jar into your class path ?
If you are using mvn, you can use mvn dependency:tree to check with it.
On Tue Jul 12 04:52:09 2011, KARR, DAVID (ATTSI) wrote:
> 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();
> }
> --------------
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang