You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Robert Dean <Ro...@bd.com> on 2020/11/19 17:53:35 UTC

Blueprint RouteContext Error

I have been learning Karaf and Camel for about 8 months. I am working on designing my first Karaf / Camel solution. I am trying to understand how I can split up the solution with multiple blueprint xml files. At this point I am just trying to get the examples from 2015 working. I am using Karaf 4.2.8 and Camel 3.4.0.  I am getting an error on the loading of the Camel Context. I am using two (2) xml files.

I have been looking at this type of sample:  http://camel.465427.n5.nabble.com/blueprint-routeContext-tag-prevents-Camel-from-starting-td5770023.html

Installed Camel components: (all show started)

  *   xml-specs-api                     2.9.0
  *   camel-core                          3.4.0
  *   camel-blueprint                 3.4.0
  *   camel-jms                            3.4.0
  *   camel-mllp                          3.4.0
  *   camel-stream                     3.4.0

ContextMain.xml
<?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">

    <import resource="global_routes.xml" />

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <routeContextRef ref="globalroutes" />
    </camelContext>
</blueprint>

global_routes.xml
<?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">
    <routeContext id="globalroutes" xmlns="http://camel.apache.org/schema/blueprint">
        <route>
            <from uri="timer:globals?period=1000"/>
            <setBody>
                <simple>global message [${date:now:yyyy-MM-dd HH:mm:ss}]</simple>
            </setBody>
            <to uri="stream:out"/>
       </route>
    </routeContext>
</blueprint>

Here is the error from Hawtio:
Timestamp
2020-11-19 09:27:28
Level
ERROR
Logger
org.apache.aries.blueprint.container.BlueprintContainerImpl
Class
org.apache.aries.blueprint.container.BlueprintContainerImpl
Method
doRun
File
BlueprintContainerImpl.java:460
Thread
fileinstall-/home/administrator/dev/karaf-4.2.8/deploy
Message
Unable to start container for blueprint bundle ContextMain.xml/0.0.0
Stack Trace
·         org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to validate xml
·         at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:349) ~[!/:1.10.2]
·         at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:336) ~[!/:1.10.2]
·         at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:365) [!/:1.10.2]
·         at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:298) [!/:1.10.2]
·         at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:311) [!/:1.10.2]
·         at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:280) [!/:1.10.2]
·         at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276) [!/:1.10.2]
·         at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:266) [!/:1.10.2]
·         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) [!/:1.10.2]
·         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) [!/:1.10.2]
·         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) [!/:1.10.2]
·         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) [!/:1.10.2]
·         at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) [!/:1.10.2]
·         at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179) [org.apache.felix.framework-5.6.12.jar:?]
·         at org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730) [org.apache.felix.framework-5.6.12.jar:?]
·         at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485) [org.apache.felix.framework-5.6.12.jar:?]
·         at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579) [org.apache.felix.framework-5.6.12.jar:?]
·         at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) [org.apache.felix.framework-5.6.12.jar:?]
·         at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) [org.apache.felix.framework-5.6.12.jar:?]
·         at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [!/:3.6.4]
·         at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [!/:3.6.4]
·         at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [!/:3.6.4]
·         at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [!/:3.6.4]
·         at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [!/:3.6.4]
·         Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://www.osgi.org/xmlns/blueprint/v1.0.0":import}'. One of '{"http://www.osgi.org/xmlns/blueprint/v1.0.0":description, "http://www.osgi.org/xmlns/blueprint/v1.0.0":type-converters, "http://www.osgi.org/xmlns/blueprint/v1.0.0":service, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference-list, "http://www.osgi.org/xmlns/blueprint/v1.0.0":bean, "http://www.osgi.org/xmlns/blueprint/v1.0.0":reference, WC[##other:"http://www.osgi.org/xmlns/blueprint/v1.0.0"]}' is expected.
·         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204) ~[?:?]
·         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135) ~[?:?]
·         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) ~[?:?]
·         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) ~[?:?]
·         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) ~[?:?]
·         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:511) ~[?:?]
·         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3587) ~[?:?]
·         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1971) ~[?:?]
·         at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:829) ~[?:?]
·         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:276) ~[?:?]
·         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:243) ~[?:?]
·         at com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:189) ~[?:?]
·         at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:108) ~[?:?]
·         at javax.xml.validation.Validator.validate(Validator.java:124) ~[?:?]
·         at org.apache.aries.blueprint.parser.Parser.validate(Parser.java:346) ~[!/:1.10.2]
·         ... 23 more
OSGi Properties
Bundle Name
org.apache.aries.blueprint.core
Bundle ID
57
Bundle Version
1.10.2


Thank you for any help,
Joe Dean
Staff Engineer
Technology Solution | Software Engineering
Office: 858.617.5125
10020 Pacific Mesa Blvd, San Diego, CA 92121
[CorpLogo]
Learn more about BD<http://bd.com/>

PTO Alert: Nov 13th | Nov 20th

*******************************************************************
IMPORTANT MESSAGE FOR RECIPIENTS IN THE U.S.A.:
This message may constitute an advertisement of a BD group's products or services or a solicitation of interest in them. If this is such a message and you would like to opt out of receiving future advertisements or solicitations from this BD group, please forward this e-mail to optoutbygroup@bd.com. [BD.v1.0]
*******************************************************************
This message (which includes any attachments) is intended only for the designated recipient(s). It may contain confidential or proprietary information and may be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message. If you received this in error, please notify the sender by reply e-mail and delete this message. Thank you.
*******************************************************************
Corporate Headquarters Mailing Address: BD (Becton, Dickinson and Company) 1 Becton Drive Franklin Lakes, NJ 07417 U.S.A.

Re: Blueprint RouteContext Error

Posted by John Taylor <jt...@gmail.com>.
Hi Joe,
That error you see is that the blueprint xml file failed validation, and
that is because import is not a valid element in the blueprint schema.

Invalid content was found starting with element '{"
http://www.osgi.org/xmlns/blueprint/v1.0.0":import}'.

Indeed, importing other xml documents into blueprint isn't allowed at all.
You're using the fileinstall blueprint deployer (files dropped into deploy)
and that will mean each file is generated into one osgi bundle (see
http://karaf.apache.org/manual/latest/#_deployers )
The way I run camel-in-karaf includes blueprint deployer as well, where
each bundle (blueprint file) defines a camel context. If i need
communication across bundles / contexts in the same karaf env, that's done
either through messaging (JMS) or with direct-vm, although those are not
the only options.

-John



On Thu, Nov 19, 2020 at 2:57 PM Robert Dean <Ro...@bd.com> wrote:

> I have been learning Karaf and Camel for about 8 months. I am working on
> designing my first Karaf / Camel solution. I am trying to understand how I
> can split up the solution with multiple blueprint xml files. At this point
> I am just trying to get the examples from 2015 working. I am using Karaf
> 4.2.8 and Camel 3.4.0.  I am getting an error on the loading of the Camel
> Context. I am using two (2) xml files.
>
>
>
> I have been looking at this type of sample:
> http://camel.465427.n5.nabble.com/blueprint-routeContext-tag-prevents-Camel-from-starting-td5770023.html
>
>
>
> *Installed Camel components: (all show started)*
>
>    - xml-specs-api                     2.9.0
>    - camel-core                          3.4.0
>    - camel-blueprint                 3.4.0
>    - camel-jms                            3.4.0
>    - camel-mllp                          3.4.0
>    - camel-stream                     3.4.0
>
>
>
> *ContextMain.xml*
>
> <?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">
>
>
>
>     <import resource="global_routes.xml" />
>
>
>
>     <camelContext xmlns="http://camel.apache.org/schema/blueprint">
>
>         <routeContextRef ref="globalroutes" />
>
>     </camelContext>
>
> </blueprint>
>
>
>
> *global_routes.xml*
>
> <?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">
>
>     <routeContext id="globalroutes" xmlns="
> http://camel.apache.org/schema/blueprint">
>
>         <route>
>
>             <from uri="timer:globals?period=1000"/>
>
>             <setBody>
>
>                 <simple>global message [${date:now:yyyy-MM-dd
> HH:mm:ss}]</simple>
>
>             </setBody>
>
>             <to uri="stream:out"/>
>
>        </route>
>
>     </routeContext>
>
> </blueprint>
>
>
>
> *Here is the error from Hawtio:*
>
> Timestamp
>
> 2020-11-19 09:27:28
>
> Level
>
> ERROR
>
> Logger
>
> org.apache.aries.blueprint.container.BlueprintContainerImpl
>
> Class
>
> org.apache.aries.blueprint.container.BlueprintContainerImpl
>
> Method
>
> doRun
>
> File
>
> BlueprintContainerImpl.java:460
>
> Thread
>
> fileinstall-/home/administrator/dev/karaf-4.2.8/deploy
>
> Message
>
> Unable to start container for blueprint bundle ContextMain.xml/0.0.0
>
> Stack Trace
>
> ·         org.osgi.service.blueprint.container.ComponentDefinitionException:
> Unable to validate xml
>
> ·         at
> org.apache.aries.blueprint.parser.Parser.validate(Parser.java:349)
> ~[!/:1.10.2]
>
> ·         at
> org.apache.aries.blueprint.parser.Parser.validate(Parser.java:336)
> ~[!/:1.10.2]
>
> ·         at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:365)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:298)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:311)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:280)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:266)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
> [!/:1.10.2]
>
> ·         at
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
> [!/:1.10.2]
>
> ·         at
> org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)
> [org.apache.felix.framework-5.6.12.jar:?]
>
> ·         at
> org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)
> [org.apache.felix.framework-5.6.12.jar:?]
>
> ·         at
> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)
> [org.apache.felix.framework-5.6.12.jar:?]
>
> ·         at
> org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
> [org.apache.felix.framework-5.6.12.jar:?]
>
> ·         at
> org.apache.felix.framework.Felix.startBundle(Felix.java:2174)
> [org.apache.felix.framework-5.6.12.jar:?]
>
> ·         at
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
> [org.apache.felix.framework-5.6.12.jar:?]
>
> ·         at
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260)
> [!/:3.6.4]
>
> ·         at
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233)
> [!/:3.6.4]
>
> ·         at
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
> [!/:3.6.4]
>
> ·         at
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
> [!/:3.6.4]
>
> ·         at
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> [!/:3.6.4]
>
> ·         Caused by: org.xml.sax.SAXParseException:
> cvc-complex-type.2.4.a: Invalid content was found starting with element '{"
> http://www.osgi.org/xmlns/blueprint/v1.0.0":import}'. One of '{"
> http://www.osgi.org/xmlns/blueprint/v1.0.0":description, "
> http://www.osgi.org/xmlns/blueprint/v1.0.0":type-converters, "
> http://www.osgi.org/xmlns/blueprint/v1.0.0":service, "
> http://www.osgi.org/xmlns/blueprint/v1.0.0":reference-list, "
> http://www.osgi.org/xmlns/blueprint/v1.0.0":bean, "
> http://www.osgi.org/xmlns/blueprint/v1.0.0":reference, WC[##other:"
> http://www.osgi.org/xmlns/blueprint/v1.0.0"]}' is expected.
>
> ·         at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:135)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:511)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3587)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1971)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:829)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.beginNode(DOMValidatorHelper.java:276)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:243)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.jaxp.validation.DOMValidatorHelper.validate(DOMValidatorHelper.java:189)
> ~[?:?]
>
> ·         at
> com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorImpl.validate(ValidatorImpl.java:108)
> ~[?:?]
>
> ·         at javax.xml.validation.Validator.validate(Validator.java:124)
> ~[?:?]
>
> ·         at
> org.apache.aries.blueprint.parser.Parser.validate(Parser.java:346)
> ~[!/:1.10.2]
>
> ·         ... 23 more
>
> *OSGi Properties*
>
> Bundle Name
>
> org.apache.aries.blueprint.core
>
> Bundle ID
>
> 57
>
> Bundle Version
>
> 1.10.2
>
>
>
>
>
> Thank you for any help,
>
> *Joe Dean*
>
> Staff Engineer
>
> Technology Solution | Software Engineering
>
> Office: 858.617.5125
>
> 10020 Pacific Mesa Blvd, San Diego, CA 92121
>
> *[image: CorpLogo]*
>
> *Learn more about BD* <http://bd.com/>
>
>
>
> *PTO Alert: Nov 13th | Nov 20th*
>
> *******************************************************************
> IMPORTANT MESSAGE FOR RECIPIENTS IN THE U.S.A.:
> This message may constitute an advertisement of a BD group's products or
> services or a solicitation of interest in them. If this is such a message
> and you would like to opt out of receiving future advertisements or
> solicitations from this BD group, please forward this e-mail to
> optoutbygroup@bd.com. [BD.v1.0]
> *******************************************************************
> This message (which includes any attachments) is intended only for the
> designated recipient(s). It may contain confidential or proprietary
> information and may be subject to the attorney-client privilege or other
> confidentiality protections. If you are not a designated recipient, you may
> not review, use, copy or distribute this message. If you received this in
> error, please notify the sender by reply e-mail and delete this message.
> Thank you.
> *******************************************************************
> Corporate Headquarters Mailing Address: BD (Becton, Dickinson and Company)
> 1 Becton Drive Franklin Lakes, NJ 07417 U.S.A.
>