Use CXF JaxWsServerFactoryBean exception Cannot find any registered HttpDestinationFactory from the Bus

Solution 1:

Include cxf-rt-transports-http-jetty jar in the maven pom.xml will solve the problem.

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http-jetty</artifactId>
        <version>2.7.6</version>
    </dependency>

Solution 2:

For example, if you have below configuration and the address is defined with http appended to it, which is not a relative url to the CXFServlet configured, the above error will come.

<jaxrs:server id="helloRestService" address="http://...">
        <jaxrs:serviceBeans>
            <ref bean="helloService" />
        </jaxrs:serviceBeans>
</jaxrs:server>

Solution is to simply mention the relative url without http/https appended to address.

http://grokbase.com/t/camel/users/155f1smn4v/error-cannot-find-any-registered-httpdestinationfactory-from-the-bus

Solution 3:

Another solution which works with CSV 2.7.15: when you create the Bus, register an extension:

ServletDestinationFactory destinationFactory = new ServletDestinationFactory();
bus.setExtension(destinationFactory, HttpDestinationFactory.class);

Solution 4:

I had the same problem. And none of the google stuff was making sense. I found out in my case that I was missing the following in the spring context file:

   <import resource="classpath:META-INF/cxf/cxf.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />