在我的骆驼应用程序中,我在java中创建cxf端点:
CxfEndpoint cxf = new CxfEndpoint(rtdmUrl, new CxfComponent(this.getContext()));
cxf.setServiceClass(EventPortType.class);
process.process(rtdmSetNameFactory.get(eventName)).to(cxf).process(handleRtdmAnswer);如果试着走这条路,我会得到:
Exception in thread "main" org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: End
point[http://localhost:8088/mockEventSoapBinding]. Reason: org.apache.cxf.service.factory.ServiceConstructionException:
Could not resolve a binding for null
...
Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/soap/ registered.但是,如果我从eclipse内部运行main[] (在@Test中使用相同的配置调用),那么它工作得很好!?
我的jar是用maven程序集插件(带有所有依赖项的可执行jar )构建的,我希望/认为这只是一个配置问题,或者与我如何设置cxf端点有关。
赏金猎人的附加信息I创建了一个复制错误的最小示例:loeser/cxftests/src
它包含一个调用main()的测试,如果您更改了路由中的路径(它会创建每个文件的交换,但是文件内容会被忽略),这个测试就可以工作了。我使用soapUi (上面存储库中的项目文件)来模拟web服务。在我的机器上,测试工作正常,但是运行mvn package,然后从目标文件夹运行java -jar cxfTests-1.0-SNAPSHOT-jar-with-dependencies.jar失败。我刚刚尝试过: mvn测试也在运行
这是依赖树:
[INFO] com.sas:cep-adapter-java:jar:1.0-SNAPSHOT
[INFO] +- com.sas:dfESP-component:jar:1.0-SNAPSHOT:compile
[INFO] | \- dfx-esp-api:api:jar:2.2-post:compile
[INFO] +- com.sas.o2:RTDM_general_client:jar:0.0.1-SNAPSHOT:compile
[INFO] +- com.google.inject:guice:jar:3.0:compile
[INFO] | +- javax.inject:javax.inject:jar:1:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- com.google.inject.extensions:guice-multibindings:jar:3.0:compile
[INFO] +- com.google.guava:guava:jar:16.0.1:compile
[INFO] +- joda-time:joda-time:jar:2.3:compile
[INFO] +- org.apache.camel:camel-core:jar:2.13.1:compile
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.2.6:compile
[INFO] +- org.apache.camel:camel-ftp:jar:2.13.1:compile
[INFO] | +- com.jcraft:jsch:jar:0.1.50:compile
[INFO] | \- commons-net:commons-net:jar:3.3:compile
[INFO] +- org.apache.camel:camel-cxf:jar:2.13.1:compile
[INFO] | +- org.apache.camel:camel-spring:jar:2.13.1:compile
[INFO] | | +- org.springframework:spring-aop:jar:3.2.8.RELEASE:compile
[INFO] | | \- org.springframework:spring-tx:jar:3.2.8.RELEASE:compile
[INFO] | +- org.apache.camel:camel-cxf-transport:jar:2.13.1:compile
[INFO] | +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.7.11:compile
[INFO] | | +- org.apache.cxf:cxf-api:jar:2.7.11:compile
[INFO] | | | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.2.1:compile
[INFO] | | | | \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | | | +- org.apache.ws.xmlschema:xmlschema-core:jar:2.1.0:compile
[INFO] | | | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] | | | \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] | | +- org.apache.cxf:cxf-rt-core:jar:2.7.11:compile
[INFO] | | +- javax.ws.rs:javax.ws.rs-api:jar:2.0-m10:compile
[INFO] | | +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.7.11:compile
[INFO] | | \- org.apache.cxf:cxf-rt-transports-http:jar:2.7.11:compile
[INFO] | +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:2.7.11:compile
[INFO] | | +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] | | +- asm:asm:jar:3.3.1:compile
[INFO] | | +- org.apache.cxf:cxf-rt-frontend-simple:jar:2.7.11:compile
[INFO] | | \- org.apache.cxf:cxf-rt-ws-addr:jar:2.7.11:compile
[INFO] | | \- org.apache.cxf:cxf-rt-ws-policy:jar:2.7.11:compile
[INFO] | | \- org.apache.neethi:neethi:jar:3.0.3:compile
[INFO] | +- org.apache.cxf:cxf-rt-rs-security-oauth:jar:2.7.11:compile
[INFO] | | \- net.oauth.core:oauth-provider:jar:20100527:compile
[INFO] | | \- net.oauth.core:oauth:jar:20100527:compile
[INFO] | +- org.springframework:spring-core:jar:3.2.8.RELEASE:compile
[INFO] | | \- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] | +- org.springframework:spring-beans:jar:3.2.8.RELEASE:compile
[INFO] | +- org.springframework:spring-context:jar:3.2.8.RELEASE:compile
[INFO] | | \- org.springframework:spring-expression:jar:3.2.8.RELEASE:compile
[INFO] | +- org.apache.cxf:cxf-rt-features-clustering:jar:2.7.11:compile
[INFO] | \- org.apache.cxf:cxf-rt-bindings-soap:jar:2.7.11:compile
[INFO] | \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.7.11:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.7:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.7:compile
[INFO] +- org.slf4j:jul-to-slf4j:jar:1.7.7:compile
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.apache.camel:camel-test:jar:2.13.0:test
[INFO] +- junit:junit:jar:4.11:test
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] +- org.mockftpserver:MockFtpServer:jar:2.4:compile
[INFO] +- org.jukito:jukito:jar:1.4:compile
[INFO] | +- org.mockito:mockito-core:jar:1.9.5:compile
[INFO] | | \- org.objenesis:objenesis:jar:1.0:compile
[INFO] | \- com.google.inject.extensions:guice-assistedinject:jar:3.0:compile
[INFO] \- org.hamcrest:hamcrest-all:jar:1.3:compile 我的主要方法如下:
public static void main(final String... args) throws Exception {
Injector i;
if (args.length < 1 || Strings.isNullOrEmpty(args[0])) {
i = Guice.createInjector(new CepModule());
} else {
i = Guice.createInjector(new CepModule(args[0]));
}
OurMain main = i.getInstance(OurMain.class);
// eliminates logging to java.util.logger
SLF4JBridgeHandler.removeHandlersForRootLogger();
// redirects all java.util.logger stuff to slf4j
SLF4JBridgeHandler.install();
//i.getInstance(RouteControl.class).startAll();
main.enableHangupSupport();
main.run();
} 如前所述,在eclipse中工作的测试只是使用与抛出此错误的测试相同的配置文件运行此方法(从控制台java -jar thejat.jar运行)。
发布于 2014-06-30 14:17:50
我在一条不那么干净的道路上找到了一个答案,但最后的提示来自于这里:http://cxf.547215.n5.nabble.com/Error-on-using-camel-cxf-quot-No-binding-factory-http-schemas-xmlsoap-org-soap-registered-but-works--td5745738.html
程序集插件似乎扰乱了配置文件(以不特定的顺序覆盖)。所以解决办法是不要用它!但是使用像这里这样的遮阳插件:How to package an Apache CXF application into a monolithic JAR with the Maven "shade" plugin
(corneil回答)
我唯一的问题是:我不知道如何正确地选择文件和变压器。我需要他们所有人吗?哪个文件产生了我的特定错误?
发布于 2015-07-01 13:40:55
在将cxf从2.3.1迁移到2.6.6时,我也有类似的错误。在我的例子中,就像以前一样:
程序集插件似乎扰乱了配置文件(以不特定的顺序覆盖)。所以解决办法是不要用它!但是使用像这里这样的遮阳插件:How to package an Apache CXF application into a monolithic JAR with the Maven "shade" plugin
但我只应该尝试添加:
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/cxf/bus-extensions.txt</resource> </transformer>
(在那篇文章中也回答),不是所有的变形人,我不需要构建工具
发布于 2015-02-18 11:49:48
一个解决方案也是使用cxf-bundle-极小。这与程序集插件一起工作。尽管jar文件变得更大。
https://stackoverflow.com/questions/24430342
复制相似问题