I have following CDI Bean:
@SessionScoped
public class ReportService implements Serializable {
private static final long serialVersionUID = 1L;
private MyDao myDao;
@Inject
public ReportService(MyDao myDao) {
this.myDao = myDao;
}
}
@RequestScoped
public class MyDao extends AbstractDao<Order> {
protected MyDao() {
}
@Inject
public MyDao(EntityManager em) {
super(em);
}
}
If i start my webapplication (Tomcat with Weld) the following Exception is thrown:
WELD-001435: Normal scoped bean class com.myorg.ReportService is not proxyable because it has no no-args constructor - Managed Bean [class com.myorg.ReportService] with qualifiers [@Any @Default].
How is it possible to use constructor injection in a SessionScoped Bean? Is it safe just to add a package-visible no-args constructor?
I already searched a lot, but i did not find any information about passivating a CDI Bean whitch uses Constructor Injection.
MyDaoa public class? Does it have a no-arg constructor? - Nico Van Belle