Sammy
Sammy

Reputation: 1218

Configuring cxf in camel with Spring-Java

I have a Camel-Environment, which is configured via Java:

@Configuration

@ImportResource({ "classpath:META-INF/cxf/cxf.xml" })
public class MyConfiguration extends AnotherConfiguration {

    @Autowired
    private SomeClass someClass;
    ...

    @Bean(name = "beantest")
    public CxfEndpoint beanTest() {
        final CxfEndpoint cxfEndpoint = new CxfEndpoint();
        cxfEndpoint.setAddress("http://localhost:9000/myservice");
        cxfEndpoint.setServiceClass(TestBean.class);
        return cxfEndpoint;
    }
}

I would like it create a camel-route, that listens to a webserver, which is implemented by me.

public void configure() {
    this.from("cxf:bean:beantest")
        .log("Bean called successfully")
        .end();
}

I really can't get this working. I believe (I hope), that my problem is just somewhere in the configuration in 'beanTest()' and that just that code is missing.

Problem: Starting Tomcat I receive an Exception, the stack leads me to these lines:

Caused by: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.
    at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:296)
    at org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:142)
    at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:93)

2nd: I am not sure, what exactly TestBean has to look like:

@WebService(name = "testingTheBean", targetNamespace = "http://webservices.test/")
public class TestBean {
    @WebMethod()
    public void wscall(@WebParam(name = "parameter") final String parameter) {
        System.out.println("WS-Call successfull");
    }
}

Sorry, Spring is new to me and examples for cxf, camel and spring-java-config are hard to find.

Upvotes: 1

Views: 5594

Answers (2)

Marek
Marek

Reputation: 388

Import cxf-rt-transports-http-jetty in the maven pom.xml.

This will solve the problem.

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

Upvotes: 1

Willem Jiang
Willem Jiang

Reputation: 3291

Can you check if the cxf-rt-transport-http and cxf-rt-transport-http-jetty is in your class path?

Upvotes: 4

Related Questions