Hi,
hotdeployment and updateing of bundles containing routes in general need to
be handled with care ;)
The camel-core bundle usually takes care of managing the routes available
within all other bundles, if you update another bundle, the old route is
still referenced from the core bundle and therefore still available and
will collide with a new "hot-deployed" route. For this the camel-core
bundle needs to be refreshed for it to have a new bundle-wiring to the new
available routes and to ditch the reference to the "old" ones.

regards, Achim


2014-03-27 22:31 GMT+01:00 Pascal Klink <pascal.kl...@web.de>:

>
>
> Hi everyone,
>
> I finally found the issue.
> The good news first: The problem is not the camel route and context
> intialization using blueprint. The Problem was using the hot deploy feature
> of karaf. I only recieved the exceptions when I overwrote the bundles in
> the hot deploy folder in order to let karaf load them again. When I removed
> the bundles from the hot deploy folder first and then copied the new
> versions of the bundles into the hot deploy folder - everything works just
> fine.
> Now the "bad" one: I have absolutely no idea why these Exceptions only
> occur when I directly overwrite the bundles in the hot deploy feature. So
> if this is a common flaw of the hot deploy feature in karaf and somebody
> could explain it to me - I would be very thankful for that.
>
> Greetings,
> Pascal
>
>
>  > Gesendet: Dienstag, 25. März 2014 um 17:50 Uhr
>  > Von: "Charlie Mordant" <cmorda...@gmail.com>
>  > An: users@camel.apache.org
>  > Betreff: Re: Re: Camel with Karaf
>  > Hi,
>  >
>  > For some component, you have to export them as Osgi services, then
>  > referencing in your bp.xml as the prefix you use it in your route.
>  >
>  >
>  > I would do so for the SQL component:
>  >
>  > <reference id="sql" interface="org.apache.camel.Component"
>  > availability="mandatory" filter="(component-type=sql)">
>  >
>  > Regards,
>  >
>  >
>  >
>  >
>  > 2014-03-25 17:01 GMT+01:00 Pascal Klink <pascal.kl...@web.de>:
>  >
>  > > Hi Christpoh,
>  > >
>  > > I'm running on JDK 7. Other bundles are starting up perfectly when
> having
>  > > no dependencies to camel so there aren't any other issues around
> except
>  > > this one (I hope I answered b) as you expected - I was not excatly
> sure
>  > > what you meant with the question).
>  > >
>  > > Greetings,
>  > > Pascal
>  > >
>  > > > Gesendet: Dienstag, 25. März 2014 um 16:16 Uhr
>  > > > Von: cemmersb <cemme...@gmail.com>
>  > > > An: users@camel.apache.org
>  > > > Betreff: Re: Camel with Karaf
>  > > > Hi Pascal,
>  > > >
>  > > > one quick question, are you using JDK 8.0?
>  > > >
>  > > > I'm facing a similar behaviour when running Karaf on JDK 8.0 -
> without
>  > > any Camel:
>  > > >
>  > > > org.osgi.service.blueprint.container.ComponentDefinitionException:
>  > > java.lang.IllegalArgumentException
>  > > > at
>  > >
> org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:122)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:681)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:378)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:245)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:235)[7:org.apache.aries.blueprint.core:1.4.0]
>  > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[10:org.apache.aries.util:1.1.0]
>  > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[10:org.apache.aries.util:1.1.0]
>  > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[10:org.apache.aries.util:1.1.0]
>  > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[10:org.apache.aries.util:1.1.0]
>  > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[10:org.apache.aries.util:1.1.0]
>  > > > at
>  > >
> org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.jar:]
>  > > > at
>  > >
> org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)[org.apache.felix.framework-4.0.3.jar:]
>  > > > at
>  > >
> org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)[org.apache.felix.framework-4.0.3.jar:]
>  > > > at
>  > >
> org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)[org.apache.felix.framework-4.0.3.jar:]
>  > > > at
>  > >
> org.apache.felix.framework.Felix.startBundle(Felix.java:1923)[org.apache.felix.framework-4.0.3.jar:]
>  > > > at
>  > >
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)[org.apache.felix.framework-4.0.3.jar:]
>  > > > at
>  > >
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)[org.apache.felix.framework-4.0.3.jar:]
>  > > > at java.lang.Thread.run(Thread.java:744)[:1.8.0]
>  > > >
>  > > > Can you please double check the following:
>  > > >
>  > > > a) Which JDK are you running at?
>  > > > b) Are there any other, similar issues around?
>  > > >
>  > > > Best,
>  > > >
>  > > > Christoph
>  > > >
>  > > > On 25 Mar 2014, at 16:08, Pascal Klink <pascal.kl...@web.de> wrote:
>  > > >
>  > > > > Hi everyone,
>  > > > >
>  > > > > I have some problems getting a Bundle, which is using Camel, to
> run
>  > > on my Karaf (Version 2.3.0, Camel Version 2.13.0). I think this is
> because
>  > > I'm doing something wrong with the Import Statements in the Manifest
> file.
>  > > This is the pom.xml of my Bundle:
>  > > > >
>  > > > > <?xml version="1.0" encoding="UTF-8"?>
>  > > > > <project xmlns="http://maven.apache.org/POM/4.0.0";
>  > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>  > > > > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>  > > http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>  > > > > <modelVersion>4.0.0</modelVersion>
>  > > > >
>  > > > > <groupId>com.kneipenapp</groupId>
>  > > > > <artifactId>web-service</artifactId>
>  > > > > <name>WebService</name>
>  > > > > <version>0.0.1</version>
>  > > > > <packaging>bundle</packaging>
>  > > > >
>  > > > > <dependencies>
>  > > > >
>  > > > > <!-- Database connection -->
>  > > > > <dependency>
>  > > > > <groupId>commons-dbcp</groupId>
>  > > > > <artifactId>commons-dbcp</artifactId>
>  > > > > <version>2.0</version>
>  > > > > </dependency>
>  > > > >
>  > > > > <dependency>
>  > > > > <groupId>commons-pool</groupId>
>  > > > > <artifactId>commons-pool</artifactId>
>  > > > > <version>2.2</version>
>  > > > > </dependency>
>  > > > >
>  > > > > <dependency>
>  > > > > <groupId>com.mysql</groupId>
>  > > > > <artifactId>mysql-driver</artifactId>
>  > > > > <version>5.1.29</version>
>  > > > > </dependency>
>  > > > >
>  > > > > <!-- Camel -->
>  > > > > <dependency>
>  > > > > <groupId>org.apache.camel</groupId>
>  > > > > <artifactId>camel-core</artifactId>
>  > > > > <version>2.13.0</version>
>  > > > > <scope>provided</scope>
>  > > > > </dependency>
>  > > > >
>  > > > > <dependency>
>  > > > > <groupId>org.apache.camel</groupId>
>  > > > > <artifactId>camel-sql</artifactId>
>  > > > > <version>2.13.0</version>
>  > > > > <scope>provided</scope>
>  > > > > </dependency>
>  > > > >
>  > > > > <!-- Http Handler exposing -->
>  > > > > <dependency>
>  > > > > <groupId>org.glassfish.grizzly</groupId>
>  > > > > <artifactId>grizzly-http</artifactId>
>  > > > > <version>2.3.11</version>
>  > > > > <scope>provided</scope>
>  > > > > </dependency>
>  > > > >
>  > > > > <!-- Jersey -->
>  > > > > <dependency>
>  > > > > <groupId>org.glassfish.jersey.containers</groupId>
>  > > > > <artifactId>jersey-container-servlet</artifactId>
>  > > > > <version>2.7</version>
>  > > > > </dependency>
>  > > > >
>  > > > > </dependencies>
>  > > > >
>  > > > > <build>
>  > > > > <plugins>
>  > > > > <plugin>
>  > > > > <groupId>org.apache.felix</groupId>
>  > > > > <artifactId>maven-bundle-plugin</artifactId>
>  > > > > <extensions>true</extensions>
>  > > > > <configuration>
>  > > > > <instructions>
>  > > > > <Embed-Dependency>
>  > > > > *;scope=compile|runtime
>  > > > > </Embed-Dependency>
>  > > > > <Import-Package>
>  > > > > !*,
>  > > > > org.osgi.framework,
>  > > > > </Import-Package>
>  > > > > <Dynamic-Import-Package>
>  > > > > org.glassfish.grizzly.http,
>  > > > > org.apache.camel.*,
>  > > > > javax.management,
>  > > > > javax.sql
>  > > > > </Dynamic-Import-Package>
>  > > > > </instructions>
>  > > > > </configuration>
>  > > > > </plugin>
>  > > > > </plugins>
>  > > > > </build>
>  > > > >
>  > > > >
>  > > > > </project>
>  > > > >
>  > > > > And here is the route and context I am initiliazing when the
> bundle
>  > > is started (I'm using camel-blueprint):
>  > > > >
>  > > > > <!-- The camel context which will hold the routes -->
>  > > > > <camelContext id="context" xmlns="
>  > >
> http://camel.apache.org/schema/blueprint[http://camel.apache.org/schema/blueprint]
> ">
>  > > > > <routeContextRef ref="newElementContext"/>
>  > > > > </camelContext>
>  > > > >
>  > > > > <routeContext id="newElementContext" xmlns="
>  > >
> http://camel.apache.org/schema/blueprint[http://camel.apache.org/schema/blueprint]
> ">
>  > > > > <route id="newElement">
>  > > > > <from uri="direct:insertElement"/>
>  > > > > <to uri="sql:insert into orders (:#id, :#item, :#amount,
>  > > :#description, false)"/>
>  > > > > </route>
>  > > > > </routeContext>
>  > > > >
>  > > > > I have installed the camel, camel-core, camel-spring,
> camel-blueprint
>  > > and camel-sql features so that normally the referenced packages
> should be
>  > > imported. However, I'm facing a NullPointerException when starting the
>  > > bundle:
>  > > > >
>  > > > > org.osgi.service.blueprint.container.ComponentDefinitionException:
>  > > java.lang.NullPointerException
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:115)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_25]
>  > > > > at
> java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_25]
>  > > > > at
>  > >
> org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:746)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:863)[78:org.apache.camel.camel-blueprint:2.13.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:515)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:353)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:259)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:222)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[11:org.apache.aries.util:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[11:org.apache.aries.util:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[11:org.apache.aries.util:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[11:org.apache.aries.util:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[11:org.apache.aries.util:1.1.0]
>  > > > > at
>  > >
> org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.jar:]
>  > > > > at
>  > >
> org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)[org.apache.felix.framework-4.0.3.jar:]
>  > > > > at
>  > >
> org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)[org.apache.felix.framework-4.0.3.jar:]
>  > > > > at
>  > >
> org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)[org.apache.felix.framework-4.0.3.jar:]
>  > > > > at
>  > >
> org.apache.felix.framework.Felix.startBundle(Felix.java:1923)[org.apache.felix.framework-4.0.3.jar:]
>  > > > > at
>  > >
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)[org.apache.felix.framework-4.0.3.jar:]
>  > > > > at
>  > >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1247)[6:org.apache.felix.fileinstall:3.2.6]
>  > > > > at
>  > >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1219)[6:org.apache.felix.fileinstall:3.2.6]
>  > > > > at
>  > >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1208)[6:org.apache.felix.fileinstall:3.2.6]
>  > > > > at
>  > >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:503)[6:org.apache.felix.fileinstall:3.2.6]
>  > > > > at
>  > >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[6:org.apache.felix.fileinstall:3.2.6]
>  > > > > Caused by: java.lang.NullPointerException
>  > > > > at
>  > >
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1432)
>  > > > > at
>  > >
> org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
>  > > > > at
>  > >
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
>  > > > > at
> java.lang.ClassLoader.loadClass(ClassLoader.java:411)[:1.7.0_25]
>  > > > > at
> java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.7.0_25]
>  > > > > at java.lang.Class.forName0(Native Method)[:1.7.0_25]
>  > > > > at java.lang.Class.forName(Class.java:270)[:1.7.0_25]
>  > > > > at
>  > >
> org.apache.aries.proxy.impl.interfaces.ProxyClassLoader.isInvalid(ProxyClassLoader.java:109)[10:org.apache.aries.proxy.impl:1.0.1]
>  > > > > at
>  > >
> org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator.getProxyInstance(InterfaceProxyGenerator.java:84)[10:org.apache.aries.proxy.impl:1.0.1]
>  > > > > at
>  > >
> org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:72)[10:org.apache.aries.proxy.impl:1.0.1]
>  > > > > at
>  > >
> org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:75)[10:org.apache.aries.proxy.impl:1.0.1]
>  > > > > at
>  > >
> org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingProxy(AbstractProxyManager.java:40)[10:org.apache.aries.proxy.impl:1.0.1]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:306)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > at
>  > >
> org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:99)[7:org.apache.aries.blueprint.core:1.1.0]
>  > > > > ... 30 more
>  > > > >
>  > > > > I'm quite sure that this is really about the camel karaf
> components,
>  > > since the org.apache.camel.blueprint.handler.CamelNamespaceHandler is
>  > > involved in the StackTrace.
>  > > > > Can anybody help me out here?
>  > > > >
>  > > > > Greetings,
>  > > > > Pascal
>  > > > >
>  > >
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Reply via email to