The following class is not a managed bean, for lack of a default constructor:

public class NotABean {
    public NotABean(int i) {}
}

But the class is a legal (albeit trivial) injection target.

When constructing an injection target for this class, OWB logs a spurious message:

AnnotatedType<NotABean> annotatedType = beanManager.createAnnotatedType(NotABean.class);

InjectionTarget<NotABean> injectionTarget = beanManager.createInjectionTarget(annotatedType);

07.01.2013 21:35:53 org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl defineConstructor INFO: No suitable constructor found for injection target class : [class org.ops4j.pax.exam.regression.cdi.ice.NotABean]. produce() method does not work!

This is confusing for end users. Moreover, the implementation of createInjectionTarget() has the following line

InjectionTargetBean<T> bean = webBeansContext.getWebBeansUtil().defineManagedBean(type);

While the INFO message might be debatable, this looks plain wrong to me: you are constructing a Bean<T> for a T which is not a managed bean.

The problem occured while using Wicket on TomEE [1].

Is this a TODO for OWB, or just a user misconception?

[1] http://comments.gmane.org/gmane.comp.java.openejb.user/10062

Best regards,
Harald


Reply via email to