I am trying to get a proxy working correctly with Blueprint inside OSGi (being done via Karaf), and being built via gradle.
My blueprint file (names have been changed to protect the innocent):
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<!-- Service proxy export for the Camel direct proxy route -->
<service id="postRoutableMessageService" interface="foo.bar.intf.RoutableMessagePoster" ref="postRoutableMessageProxy" ranking="1000">
<service-properties>
<entry key="protocol">
<value type="java.lang.String">Direct</value>
</entry>
</service-properties>
</service>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<proxy id="postRoutableMessageProxy" serviceUrl="direct:postRoutableMessage" serviceInterface="foo.bar.intf.RoutableMessagePoster"/>
<!-- Load all routes from the specified package -->
<package>foo.bar.foo</package>
</camelContext>
</blueprint>
Right now, this blueprint file is unacceptable. When I build via gradle to run a (very) simple test, I get this error:
[ERROR] 2015-03-26 17:58:54,284 [Blueprint Extender: 1] org.apache.aries.blueprint.container.BlueprintContainerImpl doRun - Unable to start blueprint container for bundle OMDDProxyRouteTest org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate xml
. . .
Caused by: org.xml.sax.SAXParseException; cvc-complex-type.2.4.a: Invalid content was found starting with element 'package'. One of '{"http://camel.apache.org/schema/blueprint":template, "http://camel.apache.org/schema/blueprint":consumerTemplate, "http://camel.apache.org/schema/blueprint":proxy, "http://camel.apache.org/schema/blueprint":export, "http://camel.apache.org/schema/blueprint":errorHandler, "http://camel.apache.org/schema/blueprint":routeBuilder, "http://camel.apache.org/schema/blueprint":routeContextRef, "http://camel.apache.org/schema/blueprint":restContextRef, "http://camel.apache.org/schema/blueprint":threadPoolProfile, "http://camel.apache.org/schema/blueprint":threadPool, "http://camel.apache.org/schema/blueprint":endpoint, "http://camel.apache.org/schema/blueprint":dataFormats, "http://camel.apache.org/schema/blueprint":redeliveryPolicyProfile, "http://camel.apache.org/schema/blueprint":onException, "http://camel.apache.org/schema/blueprint":onCompletion, "http://camel.apache.org/schema/blueprint":intercept, "http://camel.apache.org/schema/blueprint":interceptFrom, "http://camel.apache.org/schema/blueprint":interceptSendToEndpoint, "http://camel.apache.org/schema/blueprint":restConfiguration, "http://camel.apache.org/schema/blueprint":rest, "http://camel.apache.org/schema/blueprint":route}' is expected.
I am extremely confused by this, because it is complaining about the tag inside the Camel Context. I use this exact same syntax elsewhere (just a different package), and there is no problem.
The final 'error' that everything finally comes to a crashing end on is:
java.lang.RuntimeException: Gave up waiting for service (objectClass=org.apache.camel.CamelContext)
Which makes sense since the element is inside the element.
Still, I have no idea why this fails. If I remove the package element, all is fine and the test runs and passes, so it really is just this stinking element (or the way it interacts with somebody).
Help me Obi-wan Kenobi, you're my only hope (maybe).
Secondary question: Have I correctly defined the proxied endpoint & its necessary exposed service?