Done a comparaison between beanTypes resolved when running a junit test using weld 2.1.0.Final + DeltaSpike + camel vs Weld 2.1.0.Final + Camel + PaxCDI on Karaf and it appears that my class CamelContextBean is not listed. This is why I get a NPE. So I supect again a classloading issue when WeldContainer loads the classes of a bundle including also classes to be imported from another bundle ....

https://gist.github.com/7384007 <https://gist.github.com/7384007>

 On 08/11/13 19:15, Charles Moulliard wrote:
FYI


-------- Original Message --------
Subject:     Issue with weld 2.1.0.Final on OSGI
Date:     Fri, 08 Nov 2013 19:11:59 +0100
From:     Charles Moulliard <[email protected]>
To: [email protected], Antoine Sabot-Durand <[email protected]>, Jason Porter <[email protected]>, Peter Muir <[email protected]>



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





_______________________________________________
weld-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/weld-dev

Reply via email to