3 Replies Latest reply on May 20, 2014 2:40 AM by mkouba

    in Weld 2.1.1 (Wildfly) EntityManger producer does not seem to work right

    yangju

      Sorry, the issue that was initially reported was because some jars were not included in the war by eclipse.

      Please ignore this reported issue.

       

      Thanks.

      -------------------------------------------------------------------------------------------------

       

      I have mulitple datasources defined in persistence.xml. So I have qualifier EM producer for each of the datasource (JPA emf) such as:

       

        @CentralEM

          @Produces

          @PersistenceContext(unitName = Constants.DB1)

          EntityManager db1;

      and

           @SetupEM

          @Produces

          @PersistenceContext(unitName = Constants.DB2)

          EntityManager db2;

       

      Then I use in code such as a default scoped bean:

            @Inject

          @CentralEM

          EntityManager em;

       

      This works fine until recently we upgraded our app server to Wildfly which uses CDI 1.1 and Weld 2.x. Previous version is Weld 1.x

      The error I got is something like:

       

      Exception 0 :

      org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers @CentralEM

        at injection point [BackedAnnotatedField] @Inject @CentralEM com.pearson.epen.util.PerformancePeekHandlerImpl.em

        at com.pearson.epen.util.PerformancePeekHandlerImpl.em(PerformancePeekHandlerImpl.java:0)

      WELD-001475: The following beans match by type, but none have matching qualifiers:

        - Resource Producer Field [EntityManager] with qualifiers [@SetupEM @Any] declared as [[BackedAnnotatedField] @SetupEM @Produces @PersistenceContext com.pearson.epen.cdi.producer.CentralEMProducer.em],

        - Resource Producer Field [EntityManager] with qualifiers [@SetupEM @Any] declared as [[BackedAnnotatedField] @SetupEM @Produces @PersistenceContext com.pearson.epen.cdi.producer.SetupEMProducer.em]

       

       

      Could you tell me what could be wrong?

       

      Thanks.

       

      Richard

      :