2 Replies Latest reply on Dec 17, 2011 8:27 AM by iabughosh

    @inject produced EntityManager fails with AS 7.1

    iabughosh Master

      Dears,

      I've a dependency producer class like this :

      public class DocXDependency implements Serializable {

       

                private static final long serialVersionUID = 1L;

       

                @Produces @PersistenceContext(unitName="MyPC")

                @DB EntityManager em;

       

       

                @Produces @Log Logger getLogger(InjectionPoint ip) {

                          return Logger.getLogger(ip.getMember().getDeclaringClass().getSimpleName());

                }

      }

       

      where @DB is a custom qualifier.

       

       

      i'm trying to inject the entity manager in a CDI managed bean like this :

      @Inject @DB private EntityManager em;

       

      it fails with this error:

      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@DB] at injection point [[field] @Inject @DB private (some class path).em]

      at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:274)

      at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:243)

      at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:106)

      at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:126)

      at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:345)

      at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:330)

      at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)

      at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82)

      at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)

      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824)

      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759)

      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

      at java.lang.Thread.run(Thread.java:636)

      "}

       

      that was working with AS 6, does anyone knows why ?!.

       

      thanks in advance.