I cant dig into it for 2 weeks but you should go twice in the scanner and the second time with the webapp classloader. If the class cant be loaded you have another issue.
Can you system.out the classloaders (is it the webapp one the second time) + the class name please (we have some exclusions so maybe you have no luck) - Romain Le 27 août 2012 20:25, "jkastner" <jks...@karchedon.de> a écrit : > Hi, > > yes, I'm using the most recent version from the trunk. I also assembled two > simple test packages: > > http://openejb.979440.n4.nabble.com/file/n4657131/war_test.warwar_test.war > contains a single bean annotated with @Named, and an index.xhtml using this > bean; if the CDI scan was successful, the message "OK, CDI scan was > successful" appears at /war_test. > > http://openejb.979440.n4.nabble.com/file/n4657131/ear_test.earear_test.ear > just wraps this this WAR in an app module (web context /ear_test) > > > Now, the war_test works in TomEE 1.1.0, but the ear_test fails. > I did some debugging, and the most obvious difference to me is at the end > of > CDIScanner.init(): > > // here for ears we need to skip classes in the parent > classloader > final ClassLoader scl = ClassLoader.getSystemClassLoader(); > final boolean filterByClassLoader = > > "true".equals(SystemInstance.get().getProperty(OPENEJB_CDI_FILTER_CLASSLOADER, > "true")); > for (String className : beans.managedClasses) { > if (ejbClasses.contains(className)) continue; > final Class clazz = load(className, classLoader); > if (clazz == null) { <== **TRUE FOR EAR_TEST** > continue; > } > > final ClassLoader cl = clazz.getClassLoader(); > // 1. this classloader is the good one > // 2. the classloader is the appclassloader one and we are > in the ear parent > if (!filterByClassLoader > || comparator.isSame(cl) || (cl.equals(scl) && > startupObject.getWebContext() == null)) { > classes.add(clazz); > } > } > > In both cases, the bean is listed in beans.managedClasses. But for the EAR, > the bean cannot be loaded by the provided ClassLoader, and hence is never > added to classes. > > > -- Johannes > > > > -- > View this message in context: > http://openejb.979440.n4.nabble.com/Deployment-of-CDI-beans-does-not-work-for-WARs-wrapped-in-an-EAR-tp4657110p4657131.html > Sent from the OpenEJB Dev mailing list archive at Nabble.com.