Hi, Does camel-cdi start before the sample?
- Romain Le 13 juin 2012 17:34, "Charles Moulliard" <[email protected]> a écrit : > Hi, > > I have deployed 2 bundles in Apache KarafEE ( > https://svn.apache.org/repos/asf/openejb/trunk/openejb/osgi/apache-karafee/). > One contains the project camel-cdi (including a META-INF/beans.xml file) > and the other an example. When OpenEJB scans the example bundle, it > discovers annotated class presented here > > package com.fusesource.cdi.camel.simple; > > import org.apache.camel.component.cdi.CdiCamelContext; > import org.slf4j.Logger; > import org.slf4j.LoggerFactory; > > import javax.annotation.PostConstruct; > import javax.annotation.PreDestroy; > import javax.ejb.Singleton; > import javax.ejb.Startup; > import javax.inject.Inject; > > > /** > * User: charlesmoulliard > * Date: 16/02/12 > */ > @Singleton > @Startup > public class BootStrap { > > Logger logger = LoggerFactory.getLogger(BootStrap.class); > > @Inject > CdiCamelContext camelCtx; > > @Inject > SimpleCamelRoute simpleRoute; > > But the following error is generated : > > Caused by: org.apache.openejb.OpenEJBRuntimeException: > javax.enterprise.inject.UnsatisfiedResolutionException: Api type > [org.apache.camel.component.cdi.CdiCamelContext] is not found with the > qualifiers > Qualifiers: [@javax.enterprise.inject.Default()] > for injection into Field Injection Point, field name : camelCtx, Bean Owner > : [BootStrap, Name:null, WebBeans Type:ENTERPRISE, API > Types:[com.fusesource.cdi.camel.simple.BootStrap,java.lang.Object], > Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]] > at > org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:341)[125:org.apache.openejb.core-osgi:4.1.0.SNAPSHOT] > at > org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:134)[125:org.apache.openejb.core-osgi:4.1.0.SNAPSHOT] > ... 11 more > Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Api type > [org.apache.camel.component.cdi.CdiCamelContext] is not found with the > qualifiers > Qualifiers: [@javax.enterprise.inject.Default()] > for injection into Field Injection Point, field name : camelCtx, Bean Owner > : [BootStrap, Name:null, WebBeans Type:ENTERPRISE, API > Types:[com.fusesource.cdi.camel.simple.BootStrap,java.lang.Object], > Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]] > at > org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException(InjectionExceptionUtils.java:92)[97:openwebbeans-impl:1.1.4] > at > org.apache.webbeans.container.ResolutionUtil.checkResolvedBeans(ResolutionUtil.java:98)[97:openwebbeans-impl:1.1.4] > at > org.apache.webbeans.container.InjectionResolver.checkInjectionPoints(InjectionResolver.java:197)[97:openwebbeans-impl:1.1.4] > at > org.apache.webbeans.container.BeanManagerImpl.validate(BeanManagerImpl.java:1156)[97:openwebbeans-impl:1.1.4] > at > org.apache.openejb.cdi.BeansDeployer.validate(BeansDeployer.java:268)[125:org.apache.openejb.core-osgi:4.1.0.SNAPSHOT] > at > org.apache.openejb.cdi.BeansDeployer.validateInjectionPoints(BeansDeployer.java:221)[125:org.apache.openejb.core-osgi:4.1.0.SNAPSHOT] > at > org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:298)[125:org.apache.openejb.core-osgi:4.1.0.SNAPSHOT] > ... 12 more > > Is it because the CdiCamelContext has not been instantiated when it calls the > @Inject ? What could be the workaround ? > > Regards, > > Charles Moulliard > > Apache Committer > > Blog : http://cmoulliard.blogspot.com > Twitter : http://twitter.com/cmoulliard > Linkedin : http://www.linkedin.com/in/charlesmoulliard > Skype: cmoulliard > >
