我刚开始研究 Camel,并从一些开箱即用的示例开始。使用 mvn 时效果很好camel:run
。我也在尝试将其打包为一个 uber jar 并能够从命令行执行它。
我正在使用 Maven shade 插件来构建 jar。当我尝试执行它时,我收到此错误:
Caused by: org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://cxf.apache.org/transports/http.
at org.apache.cxf.transport.DestinationFactoryManagerImpl.getDestinationFactory(DestinationFactoryManagerImpl.java:126)
at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:88)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:72)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:149)
我有这些依赖项以及其他一些依赖项:
<properties>
<camel.version>2.8.0-fuse-04-01</camel.version>
<cxf.version>2.4.3-fuse-02-02</cxf.version>
</properties>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
以下是在 maven shade 插件中定义转换器的方式:
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.apache.camel.spring.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
我不知道我错过了什么。有人可以帮我解决这个问题吗?请让我知道任何替代方法。