【问题标题】:Camel: org.apache.camel.ResolveEndpointFailedException: No component found with scheme骆驼:org.apache.camel.ResolveEndpointFailedException:没有找到带有方案的组件
【发布时间】:2014-11-03 05:08:10
【问题描述】:

我有一个自定义的 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>

当我独立运行测试程序时,一切正常。但是,当我尝试将其部署到容器(servicemix、karaf)时,它无法解析组件方案名称:

org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route7: Route(route7)[[From[aq:oprDequeuer]] -> [WireTap[properties:... because of Failed to resolve endpoint: aq://queue1 due to: No component found with scheme: aq

另外,当我显式注册组件时:

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

它工作正常,包括 ServiceMix。

【问题讨论】:

  • 你是如何部署组件的?你能在bundle启动后检查你的路由是否加载了吗?
  • 只要我像上面那样明确引用部署的组件,路由就可以正常工作。
  • 您的组件包是否像其他骆驼组件一样具有 osgi 导出服务头 org.apache.camel.spi.ComponentResolver;component=aq?

标签: apache-camel


【解决方案1】:

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

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

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

【讨论】:

  • 是的,META-INF 目录与包含所有文件的 jar 捆绑在一起。
猜你喜欢
  • 2017-11-16
  • 2018-08-27
  • 2015-07-07
  • 1970-01-01
  • 1970-01-01
  • 2015-01-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多