3 Replies Latest reply on Jun 29, 2010 8:05 AM by gertv

    bundle not importing correct specified version of camel-core

    lcurry

      This is a question regarding strangeness i'm seeing with i try to get correct version of camel libraries imported by my bundle.

      I have a bundle called "exer-cbr" that I'm trying to deploy inside "4.2.0-01-00". This bundle requires earlier versions of Camel 1.6.x and I've set up my dependencies to reflect that.

       

      Below is the output of osgi:headers for the "exer-cbr" bundle

      =============================================

       

      karaf@root> osgi:headers  195

       

      Camel Exercises :: Content Based Router (195)

      -


      Manifest-Version = 1.0

      Export-Package = com.fusesource.camel.exercises.cbr;uses:="org.apache.camel.builder,org.apache.camel.model,org.apache.camel,o

      rg.apache.camel.builder.xml,org.slf4j,org.springframework.beans.factory"

      Bundle-Version = 0.0.1.SNAPSHOT

      Build-Jdk = 1.6.0_07

      Built-By = Lowry

      Tool = Bnd-0.0.238

      Bnd-LastModified = 1276285173946

      Bundle-Name = Camel Exercises :: Content Based Router

      Bundle-ManifestVersion = 2

      Created-By = Apache Maven Bundle Plugin

      Import-Package = com.fusesource.camel.exercises.cbr,org.apache.activemq;version="5.2.0.fuse",org.apache.camel;version="1.6.1.

      fuse",org.apache.camel.builder;version="1.6.1.fuse",org.apache.camel.builder.xml;version="1.6.1.fuse",org.apache.camel.compon

      ent.jms;version="1.6.1.fuse",org.apache.camel.model;version="1.6.1.fuse",org.slf4j;version="1.4.3",org.springframework.beans.

      factory;version="2.5"

      Bundle-SymbolicName = com.fusesource.camel-exercises-cbr

       

      =====================================================

       

      Note the "Import-Package" above specify org.apache.camel version="1.6.1.fuse" - buit for some reason at runtime it doesn't seem to import the appropriate version of camel-core. It tries to use the default installed 2.2.x version of camel-core.

       

      Output of packages:imports for the "exer-cbr" bundle

      ================================================

      karaf@root> packages:imports  195

      OPS4J Pax Logging - API (3): org.slf4j; version="1.5.6"

      Spring Beans (37): org.springframework.beans.factory; version="2.5.6.SEC01"

      activemq-core (87): org.apache.activemq; version="5.3.0.fuse-01-00"

      camel-core (98): org.apache.camel.builder; version="2.2.0.fuse-01-00"

      camel-core (98): org.apache.camel; version="2.2.0.fuse-01-00"

      camel-core (98): org.apache.camel.builder.xml; version="2.2.0.fuse-01-00"

      camel-core (98): org.apache.camel.model; version="2.2.0.fuse-01-00"

      camel-jms (156): org.apache.camel.component.jms; version="2.2.0.fuse-01-00"

       

      This causes various class errors whenever I try to install the bundle. See bottom of this mail for one such example of error i see. I've tried to add the older camel feature to the container to make sure the required features/bundles are there:

       

           features:addUrl  mvn:org.apache.camel.karaf/features/1.6.1.0-fuse/xml/features

           features:install camel-core 1.6.1.0-fuse

       

      Reason i did the above, I figured the default ESB container does not include the older version of the camel libraries so I thought if I added/installed them with above commands it would clear up the problem and the correct lcamel ibraries could be found and imported at runtime. But I still get (some equivalent) to below error when I try to 'osgi:install' the "exer-cbr" bundle. Anybody know why OSGI container wants to import and use the 2.2 version of camel-core even when I've explicitely set the camel 1.6.x libraries using the "Import-Package" inside the Meta file? What do i need to do to "kick" ESB to pick up the installed (earlier version) of camel-core bundle?

      Thanks,

      -Lowry

       

       

      15:15:35,494 | ERROR | xtenderThread-60 | ContextLoaderListener            | BundleApplicationContextListener   50 | Applicat

      ion context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.fusesource.camel-exercises-cbr, config=osgibundle:/MET

      A-INF/spring/*.xml))

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camelContext': Invocation of init met

      hod failed; nested exception is org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: Rou

      teBuilderRef[xpathRoute]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapabl

      eBeanFactory.java:1338)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableB

      eanFactory.java:473)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFact

      ory.java:409)

              at java.security.AccessController.doPrivileged(Native Method)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBea

      nFactory.java:380)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.j

      ava:222)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.jav

      a:308)

              at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:947)

       

              at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:7

      01)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1500(AbstractDelegate

      dExecutionApplicationContext.java:69)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecu

      tionApplicationContext.java:351)

              at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDele

      gatedExecutionApplicationContext.java:320)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$Complet

      eRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)

              at java.lang.Thread.run(Thread.java:619)

      Caused by: org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[xpathRou

      te]

              at org.apache.camel.spring.CamelContextFactoryBean.installRoutes(CamelContextFactoryBean.java:602)

              at org.apache.camel.spring.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:244)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCap

      ableBeanFactory.java:1369)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapabl

      eBeanFactory.java:1335)

              ... 18 more

      15:50:50,598 | WARN  | Timer-1          | SpringCamelContext               | .camel.spring.SpringCamelContext  127 | No sprin

      g-event endpoint enabled for: org.springframework.context.event.ContextClosedEvent[source=org.springframework.osgi.context.su

      pport.OsgiBundleXmlApplicationContext@1973271: display name [OsgiBundleXmlApplicationContext(bundle=com.fusesource.camel-exer

      cises-ftp, config=osgibundle:/META-INF/spring/*.xml)]; startup date ; root of context hierarchy

      ]

      15:50:50,598 | DEBUG | Timer-1          | FtpRouter                        | ce.camel.exercises.ftp.FtpRouter   71 | FtpRoute

      r shutting down.

      15:50:50,754 | DEBUG | Event Dispatcher | camel-exercises-ftp              | ?                                   ? | BundleEv

      ent STOPPED

      15:50:50,754 | DEBUG | Event Dispatcher | camel-exercises-cbr              | ?                                   ? | BundleEv

      ent STOPPED

      15:50:50,786 | INFO  |  Bundle Shutdown | Activator                        | org.apache.camel.osgi.Activator   203 | Camel ac

      tivator stopping

      15:50:50,786 | INFO  |  Bundle Shutdown | Activator                        | org.apache.camel.osgi.Activator   209 | Camel ac

      tivator stopped

      Jun 25, 2010 3:51:06 PM org.apache.felix.karaf.main.SimpleFileLock lock

      INFO: locking

      15:51:13,641 | ERROR | xtenderThread-55 | ContextLoaderListener            | BundleApplicationContextListener   50 | Applicat

      ion context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.fusesource.camel-exercises-cbr, config=osgibundle:/MET

      A-INF/spring/*.xml))

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camelContext': Invocation of init met

      hod failed; nested exception is org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: Rou

      teBuilderRef[xpathRoute]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapabl

      eBeanFactory.java:1338)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableB

      eanFactory.java:473)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFact

      ory.java:409)

              at java.security.AccessController.doPrivileged(Native Method)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBea

      nFactory.java:380)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.j

      ava:222)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.jav

      a:308)

              at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:947)

       

              at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:7

      01)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1500(AbstractDelegate

      dExecutionApplicationContext.java:69)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecu

      tionApplicationContext.java:351)

              at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDele

      gatedExecutionApplicationContext.java:320)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$Complet

      eRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)

              at java.lang.Thread.run(Thread.java:619)

      Caused by: org.apache.camel.CamelException: Cannot find any routes with this RouteBuilder reference: RouteBuilderRef[xpathRou

      te]

              at org.apache.camel.spring.CamelContextFactoryBean.installRoutes(CamelContextFactoryBean.java:602)

              at org.apache.camel.spring.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:244)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCap

      ableBeanFactory.java:1369)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapabl

      eBeanFactory.java:1335)

              ... 18 more

      15:51:15,466 | ERROR | xtenderThread-54 | ContextLoaderListener            | BundleApplicationContextListener   50 | Applicat

      ion context refresh failed (OsgiBundleXmlApplicationContext(bundle=com.fusesource.camel-exercises-ftp, config=osgibundle:/MET

      A-INF/spring/*.xml))

      org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: log:package com.fusesource.camel.exercises.ftp?l

      evel=DEBUG&showProperties=true&showHeaders=true due to: org.apache.camel.RuntimeCamelException: Could not auto create compone

      nt: log

              at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:357)

              at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:54)

              at org.apache.camel.model.RouteType.resolveEndpoint(RouteType.java:99)

              at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:106)

              at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:112)

              at org.apache.camel.model.SendType.resolveEndpoint(SendType.java:57)

              at org.apache.camel.model.SendType.createProcessor(SendType.java:51)

              at org.apache.camel.model.ProcessorType.createOutputsProcessor(ProcessorType.java:2028)

              at org.apache.camel.model.ProcessorType.createOutputsProcessor(ProcessorType.java:102)

              at org.apache.camel.model.InterceptorRef.createProcessor(InterceptorRef.java:66)

              at org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java:1912)

              at org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:106)

              at org.apache.camel.model.RouteType.addRoutes(RouteType.java:220)

              at org.apache.camel.model.RouteType.addRoutes(RouteType.java:89)

              at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:673)

              at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:664)

              at org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:165)

              at org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:160)

              at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:53)

              at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:606)

              at org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:95)

              at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:114)

              at org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:326)

              at org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:7

      8)

              at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)

              at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticast

      er.java:76)

              at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)

              at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)

              at org.springframework.osgi.context.support.AbstractOsgiBundleApplicationContext.finishRefresh(AbstractOsgiBundleAppl

      icationContext.java:235)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecu

      tionApplicationContext.java:358)

              at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)

              at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDele

      gatedExecutionApplicationContext.java:320)

              at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$Complet

      eRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:136)

              at java.lang.Thread.run(Thread.java:619)

      Caused by: org.apache.camel.RuntimeCamelException: Could not auto create component: log

              at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:189)

              at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:332)

              ... 33 more

      Caused by: java.lang.IllegalArgumentException: Type is not a Component implementation. Found: org.apache.camel.component.log.

      LogComponent

              at org.apache.camel.osgi.OsgiComponentResolver.resolveComponent(OsgiComponentResolver.java:74)

              at org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:178)

              ... 34 more

      22:40:21,295 | ERROR | :61616:Thread-33 | MulticastDiscoveryAgent          | ulticast.MulticastDiscoveryAgent  412 | Failed t

      o advertise our service: default.ActiveMQ-4.alive.%localhost%tcp://LowryPC:61616

      java.net.NoRouteToHostException: No route to host: Datagram send failed

              at java.net.PlainDatagramSocketImpl.send(Native Method)

              at java.net.DatagramSocket.send(DatagramSocket.java:612)

              at org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent.doAdvertizeSelf(MulticastDiscoveryAgent.

      java:405)

              at org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent.doTimeKeepingServices(MulticastDiscovery

      Agent.java:389)

              at org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent.run(MulticastDiscoveryAgent.java:351)

              at java.lang.Thread.run(Thread.java:619)