-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
3.0.3.Final
-
None
Hello:
I am from Oracle Wls team and working on Weld3 / Wls integration, a cdi-tck case failed in my test, the case is:
org.jboss.cdi.tck.tests.context.passivating.broken.producer.field.enterprise.EnterpriseBeanWithIllegalDependencyTest
The stack trace is like:
Caused by: java.lang.RuntimeException: CDI deployment failure: WELD-001413: The bean Session bean [class org.jboss.cdi.tck.tests.context.passivating.broken.producer.field.enterprise.ConstructorInjectionCorralBroken with qualifiers [@Any @Default]; local interfaces are [ConstructorInjectionCorralBroken] declares a passivating scope but has a non-passivation-capable dependency Managed Bean [class org.jboss.cdi.tck.tests.context.passivating.broken.producer.field.enterprise.Cow] with qualifiers [@Any @Default]: at org.jboss.weld.bootstrap.Validator.validateInjectionPointPassivationCapable(Validator.java:466) at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:400) at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:287) at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:140) at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:161) at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:518) at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:504) at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:479) at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:480) at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:90) at com.oracle.injection.provider.weld.WeldInjectionContainer.start(WeldInjectionContainer.java:150)
The cdi-tck code is like:
package org.jboss.cdi.tck.tests.context.passivating.broken.producer.field.enterprise; public class Cow { } public class CowProducer { @Produces @British public Cow cow = new Cow(); } @Stateful @SessionScoped public class ConstructorInjectionCorralBroken extends Corral { private Cow cow; public ConstructorInjectionCorralBroken(){} @Inject public ConstructorInjectionCorralBroken(@British Cow cow){ this.cow = cow; } ... }
In deployment, the qualifier @British is missing in constructor injection point creation, so a @Default Cow injects into wrongly, which is not passivation capable and causes the exception.
And the reason of qualifier missing is:
package org.jboss.weld.module.ejb; ... class InternalEjbDescriptor<T> extends ForwardingEjbDescriptor<T> { ... public Class<? extends T> getImplementationClass() { if (delegate instanceof SubclassedComponentDescriptor) { SubclassedComponentDescriptor<T> descriptor = Reflections.<SubclassedComponentDescriptor<T>>cast(delegate); Class<? extends T> implementationClass = descriptor.getComponentSubclass(); if (implementationClass != null) { return implementationClass; } } return delegate.getBeanClass(); } }
Firstly it tries to get component subclass, if there is no one, it gets original bean class. in this condition, Wls provides a subclass indeed, however, which has no annotation information (as we don't need them in subclass), this causes qualifier missing from the constructor injection point.
My question is: why do we not use bean class here directly? as it always has annotations.
Thanks.