I do a small test project with CDI. My application is composed of an EJB EAR and WAR, all deployed on Glassfish 4. I\'m using Hibernate 4.3.4 to access the database.
Java EE 7 has implicit bean archives by default, i.e. a bean class requires a scope annotation to be discovered as CDI bean.
@Named
is not a scope annotation. Try @Dependent
instead.
beans.xml
is no longer required in CDI 1.1/Java EE 7. If you do have one, then the exact version and the bean-discovery-mode
make a difference. See the Bean archives section of the CDI 1.1 spec.
As you didn't post your beans.xml
, it's hard to tell whether or not this file is part of the problem.