Apache camel Camel:org.apache.Camel.ResolveEndpointFailedException:未找到具有scheme的组件

Apache camel Camel:org.apache.Camel.ResolveEndpointFailedException:未找到具有scheme的组件,apache-camel,Apache Camel,我有一个定制的Camel组件打包在一个单独的jar中。如下文所述: http://camel.apache.org/how-do-i-add-a-component.html 我创建了一个文件META-INF/services/org/apache/camel/component/aq(aq是组件方案名称),其中包含: class=<full class name> 另外,当我显式注册组件时: CamelContext context = getContext();

我有一个定制的Camel组件打包在一个单独的jar中。如下文所述:

http://camel.apache.org/how-do-i-add-a-component.html
我创建了一个文件META-INF/services/org/apache/camel/component/aq(aq是组件方案名称),其中包含:

class=<full class name>
另外,当我显式注册组件时:

    CamelContext context = getContext();
    context.addComponent("aq", new AQComponent(context));

它工作正常,包括ServiceMix。

确保META-INF中的文件包含在JAR中

如果该文件丢失,则无法自动发现该组件,这就是您的问题。当您为OSGi构建一个组件时,可能felix bundle插件不包含该文件


我建议仔细检查一下,如果包含该文件,请查看构建的JAR。

您是如何部署该组件的?您是否可以检查捆绑包启动后是否加载了路由。只要我如上所述明确引用部署的组件,路由就可以正常工作。您的组件捆绑包是否具有osgi导出服务头org.apache.camel.spi.ComponentResolver;component=aq就像其他camel组件一样?是的,META-INF目录与jar捆绑在一起,其中包含所有文件。
    CamelContext context = getContext();
    context.addComponent("aq", new AQComponent(context));