0
votes

I have a custom Camel component packaged in a separate jar. As advised here:

http://camel.apache.org/how-do-i-add-a-component.html

I created a file a META-INF/services/org/apache/camel/component/aq (aq is the component scheme name) containing:

class=<full class name>

Everything works When I run a test program standalone. However, when I try deploying it into a container (servicemix, karaf) it cannot resolve the component scheme name:

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

Also, when I register the component explicitly:

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

it works fine, including ServiceMix.

1
How did you deploy the component? Can you check if your route is loaded after the bundle is started. - Willem Jiang
The route works fine as long as I explicitly reference the deployed component as above. - Ya.
Does your component bundle have the osgi export service head org.apache.camel.spi.ComponentResolver;component=aq just as other camel components does? - Willem Jiang

1 Answers

0
votes

Make sure that file in META-INF is included in the JAR.

If that file is missing then the component cannot be auto discovered, and that is your problem. As you build a component for OSGi, then maybe the felix bundle plugin somehow does not include that file.

I suggest to double check this, and look inside the built JAR if the file is included.