Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

jax-ws

cxf

When use Apache CXF JaxWsServerFactoryBean in console mode (try to start the server by java command line) Will get exception like below:

Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.
        at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:295)
        at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:143)
        at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:93)
        at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:72)
        at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:160)

When same service impl used in Tomcat via Spring, it works.

<jaxws:endpoint id="abc" implementor="com.AbcServicePortTypeImpl" address="/abc">
like image 436
Anderson Mao Avatar asked Nov 29 '12 02:11

Anderson Mao


3 Answers

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>
like image 89
sendon1982 Avatar answered Nov 14 '22 06:11

sendon1982


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

like image 36
Kartik Narayana Maringanti Avatar answered Nov 14 '22 05:11

Kartik Narayana Maringanti


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);
like image 5
Aaron Digulla Avatar answered Nov 14 '22 06:11

Aaron Digulla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!