我有一个通过 Java 配置的 Camel 环境:
@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;
}
}
我希望它创建一个 camel-route,监听网络服务器,由我实现。
public void configure() {
this.from("cxf:bean:beantest")
.log("Bean called successfully")
.end();
}
我真的无法让它工作。我相信(我希望)我的问题只是在“beanTest()”的配置中的某个地方,只是缺少该代码。
问题: 启动 Tomcat 我收到一个异常,堆栈引导我到这些行:
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)
第二:
我不确定 TestBean
到底应该是什么样子:
@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");
}
}
抱歉,Spring 对我来说是新手,很难找到 cxf、camel 和 spring-java-config 的示例。
最佳答案
你能检查一下 cxf-rt-transport-http 和 cxf-rt-transport-http-jetty 是否在你的类路径中吗?
关于java - 使用 Spring-Java 在 Camel 中配置 cxf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23996351/