我有一个自定义的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 .
1 回答
确保META-INF中的文件包含在JAR中 .
如果该文件丢失,则无法自动发现该组件,这就是您的问题 . 在为OSGi构建组件时,可能felix bundle插件不知何故不包含该文件 .
我建议仔细检查一下,如果包含文件,请查看内置的JAR .