[weld-dev] Issue with weld 2.1.0.Final on OSGI

Charles Moulliard cmoulliard at redhat.com
Fri Nov 8 13:11:59 EST 2013


Hi,

The following code which is working fine and returns a bean when we run 
Junit Test with DeltaSpike does not work when Weld 2.1.0.Final is 
deployed on Karaf (OSGI v4.3) with Pax-CDI. Apparently the bean is not 
retrieved when we call "beanManager.getBeans("


     protected CamelContext getCamelContext(String context, BeanManager 
beanManager) {
         if (camelContextMap == null) {
             Set<Bean<?>> beans = 
beanManager.getBeans(CamelContextMap.class, new AnyLiteral()); // return 
null
             Bean<?> bean = beanManager.resolve(beans); // return null
             CreationalContext<?> creationalContext = 
beanManager.createCreationalContext(bean);
             camelContextMap = (CamelContextMap) 
beanManager.getReference(bean, bean.getBeanClass(), creationalContext);
             ObjectHelper.notNull(camelContextMap, "Could not resolve 
CamelContextMap");
         }
         return camelContextMap.getCamelContext(context);
     }

Question : How does WeldContainer loads the class when we use getBeans 
as I suspect that we have a problem with the classloader used ?

Regards,

Charles


More information about the weld-dev mailing list