5 Replies Latest reply on Oct 17, 2014 10:53 AM by Roger Lee

    WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers

    Roger Lee Apprentice

      I've downloaded the code from the book "JBoss Weld CDI for Java Platform" and used the chapter 9 source code as the basis for my CDI application. I'm trying to move from SEAM 2.x.to CDI.

       

      I'm attempting to inject an EntityManager (not even using it) in a very simple RESTEasy web service I've deployed onto JBoss WildFly 8.1 Final.

       

      I upgraded WildFly 8.1 Final to weld-2.2.5.Final as per the instructions.

       

      However when I try and deploy the EAR I get:

       

      19:01:17,349 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."NOTiFYPiN

      POiNT.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."NOTiFYPiNPOiNT.ear".WeldStartService: Fa

      iled to start service

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final

      ]

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]

              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]

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

      FYPiNPOiNTDB

        at injection point [BackedAnnotatedField] @Inject @NOTiFYPiNPOiNTDB private com.notifypinpoint.service.AbstractService.entityManager

        at com.notifypinpoint.service.AbstractService.entityManager(AbstractService.java:0)

       

       

              at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:372)

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

              at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)

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

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

              at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)

              at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)

              at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)

              at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)

              at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_60]

              ... 3 more

       

      My bean implements AbstractService and Users is an entity bean mapped to a table. Originally it was a Stateless Session Bean, but now just has 'RequestScoped'. Neither help/work.

       

      //@Stateless

      @RequestScoped

      //@LocalBean

      public class NOTiFYPiNPOiNTAuthenticationBean extends AbstractService<Users> {

       

        public NOTiFYPiNPOiNTAuthenticationBean() {

        super(Users.class);

        }

       

      AbstractService

       

      public abstract class AbstractService<T> {

          @Inject

          @NOTiFYPiNPOiNTDB

          private EntityManager entityManager;

       

         private Class<T> entityClass;

       

      public AbstractService(Class<T> entityClass) {

              this.entityClass = entityClass;

          }

       

       

          protected EntityManager getEntityManager() {

              return entityManager;

          }

       

      DatabaseProducers class:-

       

      public class DatabaseProducers {

          @PersistenceContext(unitName = "NOTiFYPiNPOiNTEntityManagerFactory")

          private EntityManager entityManager;

       

          @Produces

          @NOTiFYPiNPOiNTDB

          public EntityManager produceNOTiFYPiNPOiNTDatabase() {

              return entityManager;

          }

      }

       

      Googled the error and so many conflicting 'solutions', none seem to allow me to deploy my EAR.

       

      Any pointers? Thanks.

        • 1. Re: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers
          Martin Kouba Master

          Hi Roger, what's the structure of your EAR? This may be some visibility issue. Unless you have to use EAR I would go with WAR (it's simpler and sufficient for most applications).

          • 2. Re: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers
            Roger Lee Apprentice

            I've always used EARs from EJB 1.x to 3.1 so I stayed with them. I will be using EJBs at some point.

             

            Some of the classes are redundant and left over from the project I'm intending to migrate from SEAM to CDI. All  Seam JARs have been removed.

             

            Thanks for your response.

             

            EAR:-

            13/10/2014  08:41    <DIR>          .

            13/10/2014  08:41    <DIR>          ..

            13/10/2014  08:41    <DIR>          lib

            13/10/2014  08:41    <DIR>          META-INF

            10/10/2014  18:59        12,039,129 NOTiFYPiNPOiNT.war

            10/10/2014  18:59            52,796 NOTiFYPiNPOiNTJAR.jar

                          2 File(s)    12,091,925 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\lib

             

            13/10/2014  08:41    <DIR>          .

            13/10/2014  08:41    <DIR>          ..

            10/10/2014  18:59          163,650 antlr-runtime.jar

            10/10/2014  18:59          188,671 commons-beanutils.jar

            10/10/2014  18:59          559,366 commons-collections.jar

            10/10/2014  18:59          174,800 commons-digester.jar

            10/10/2014  18:59            83,613 commons-io.jar

            10/10/2014  18:59        2,827,451 groovy-all.jar

            10/10/2014  18:59        1,648,200 guava-11.0.2.jar

            10/10/2014  18:59          718,107 gwt-servlet.jar

            10/10/2014  18:59        3,007,949 gwt-user.jar

            10/10/2014  18:59          463,412 janino.jar

            10/10/2014  18:59          135,950 jboss-el.jar

            10/10/2014  18:59          388,864 mail.jar

            10/10/2014  18:59          741,061 mvel2.jar

            10/10/2014  18:59            25,496 slf4j-api.jar

            10/10/2014  18:59            9,753 slf4j-log4j12.jar

                          15 File(s)    11,136,343 bytes

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\META-INF

             

            13/10/2014  08:41    <DIR>          .

            13/10/2014  08:41    <DIR>          ..

            10/10/2014  18:59              767 application.xml

            10/10/2014  18:59              468 jboss-deployment-structure.xml

            10/10/2014  18:59              151 MANIFEST.MF

                          3 File(s)          1,386 bytes

             

             

            Unzipped NOTiFYPiNPOiNT.war:-

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59             6,743 addressBook.xhtml

            10/10/2014  18:59             1,978 blockedList.xhtml

            10/10/2014  18:59             1,018 dailyLog.xhtml

            10/10/2014  18:59             4,635 enterProjectTitleCompanyName.xhtml

            10/10/2014  18:59               664 error.xhtml

            10/10/2014  18:59             3,803 home.xhtml

            13/10/2014  08:49    <DIR>          img

            10/10/2014  18:59                82 index.html

            13/10/2014  08:49    <DIR>          layout

            10/10/2014  18:59             1,019 lessonsLog.xhtml

            10/10/2014  18:59               480 login.page.xml

            10/10/2014  18:59             2,137 login.xhtml

            13/10/2014  08:49    <DIR>          META-INF

            10/10/2014  18:59               944 pendingSmokeSignals.xhtml

            10/10/2014  18:59             6,112 projectMandate.xhtml

            10/10/2014  18:59             1,022 projectRoles.xhtml

            10/10/2014  18:59             4,325 projectTeam.xhtml

            10/10/2014  18:59             6,385 register.xhtml

            10/10/2014  18:59             4,528 sendSmokeSignal.xhtml

            10/10/2014  18:59             2,127 startingUpProject.xhtml

            13/10/2014  08:49    <DIR>          stylesheet

            10/10/2014  18:59             1,552 tabPanel.xhtml

            13/10/2014  08:49    <DIR>          WEB-INF

                          18 File(s)         49,554 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\img

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59             4,707 Adobe-icon.png

            10/10/2014  18:59             4,479 btnmanageroles.png

            10/10/2014  18:59             4,562 btnmanageusers.png

            10/10/2014  18:59             2,923 btnnewpermission.png

            10/10/2014  18:59             2,771 btnnewrole.png

            10/10/2014  18:59             2,795 btnnewuser.png

            10/10/2014  18:59               127 dtpick.gif

            10/10/2014  18:59             1,017 error.gif

            10/10/2014  18:59             8,695 Excel-icon.png

            10/10/2014  18:59               207 false.png

            10/10/2014  18:59             1,150 favicon.ico

            10/10/2014  18:59         1,397,291 IMAG0004.jpg

            10/10/2014  18:59            50,996 IMAG0004_bw_6_2g_resized.jpg

            10/10/2014  18:59               149 manytoone.gif

            10/10/2014  18:59         2,640,376 marbles.tif

            10/10/2014  18:59             8,264 MS-Word-2-icon.png

            10/10/2014  18:59               719 msgerror.png

            10/10/2014  18:59               796 msginfo.png

            10/10/2014  18:59               684 msgwarn.png

            10/10/2014  18:59               153 onetomany.gif

            10/10/2014  18:59             8,390 PowerPoint-icon.png

            10/10/2014  18:59            10,848 seamlogo.png

            10/10/2014  18:59             1,068 true.png

                          23 File(s)      4,153,167 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\layout

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59               499 display.xhtml

            10/10/2014  18:59               882 edit.xhtml

            10/10/2014  18:59             3,040 main.xhtml

            10/10/2014  18:59             2,631 menu.xhtml

            10/10/2014  18:59               688 sort.xhtml

            10/10/2014  18:59             2,159 template.xhtml

                           6 File(s)          9,899 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\META-INF

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59               103 MANIFEST.MF

                           1 File(s)            103 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\stylesheet

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59             3,049 theme.css

            10/10/2014  18:59             3,672 theme.xcss

            10/10/2014  18:59             2,038 useradmin.css

                           3 File(s)          8,759 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\WEB-INF

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            13/10/2014  08:49    <DIR>          classes

            10/10/2014  18:59             3,632 components.xml

            10/10/2014  18:59             1,491 faces-config.xml

            10/10/2014  18:59             1,365 jboss-web.xml

            13/10/2014  08:49    <DIR>          lib

            10/10/2014  18:59             2,995 pages.xml

            10/10/2014  18:59             5,321 web.xml

                           5 File(s)         14,804 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\WEB-INF\classes

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59               283 components.properties

            13/10/2014  08:49    <DIR>          stylesheet

                           1 File(s)            283 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\WEB-INF\classes\stylesheet

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59             3,672 theme.xcss

                           1 File(s)          3,672 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTWAR\WEB-INF\lib

             

             

            13/10/2014  08:49    <DIR>          .

            13/10/2014  08:49    <DIR>          ..

            10/10/2014  18:59           253,950 cssparser-0.9.5.jar

            10/10/2014  18:59         1,648,200 guava-11.0.2.jar

            10/10/2014  18:59            70,883 richfaces-components-api-4.3.3.Final.jar

            10/10/2014  18:59         7,085,252 richfaces-components-ui-4.3.3.Final.jar

            10/10/2014  18:59           151,904 richfaces-core-api-4.3.3.Final.jar

            10/10/2014  18:59           484,898 richfaces-core-impl-4.3.3.Final.jar

            10/10/2014  18:59            15,808 sac-1.3.jar

             

            Unzipped NOTiFYPiNPOiNTJAR.jar:-

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR

             

             

            13/10/2014  08:52    <DIR>          .

            13/10/2014  08:52    <DIR>          ..

            10/10/2014  18:59    <DIR>          com

            10/10/2014  18:59               115 import.sql

            10/10/2014  18:59    <DIR>          META-INF

            10/10/2014  18:59                 0 seam.properties

            10/10/2014  18:59               150 security.drl

                           3 File(s)            265 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59    <DIR>          notifypinpoint

                           0 File(s)              0 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59    <DIR>          annotations

            10/10/2014  18:59    <DIR>          commons

            10/10/2014  18:59    <DIR>          constants

            10/10/2014  18:59    <DIR>          ejb

            10/10/2014  18:59    <DIR>          encryption

            10/10/2014  18:59    <DIR>          entity

            10/10/2014  18:59    <DIR>          exception

            10/10/2014  18:59    <DIR>          interfaces

            10/10/2014  18:59    <DIR>          pojos

            10/10/2014  18:59    <DIR>          service

            10/10/2014  18:59    <DIR>          sql

            10/10/2014  18:59    <DIR>          utilities

            10/10/2014  18:59    <DIR>          valueobjects

            10/10/2014  18:59    <DIR>          webservices

                           0 File(s)              0 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\annotations

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59               489 NOTiFYPiNPOiNTDB.class

            10/10/2014  18:59               467 Transactional.class

                           2 File(s)            956 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\commons

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             1,548 NOTiFYSPiCEMailAuthenticator.class

            10/10/2014  18:59             2,890 ViViFYdCommons.class

                           2 File(s)          4,438 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\constants

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             3,137 HTMLConstants.class

            10/10/2014  18:59             6,072 ViViFYdConstants.class

                           2 File(s)          9,209 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\ejb

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             2,117 NOTiFYPiNPOiNTAuthenticationBean.class

            10/10/2014  18:59             1,808 NOTiFYPiNPOiNTResource.class

            10/10/2014  18:59             1,179 ScheduleSingletonBean.class

                           3 File(s)          5,104 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\encryption

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             9,487 EncryptionBean.class

            10/10/2014  18:59               733 EncryptionCommonBusiness.class

            10/10/2014  18:59               916 EncryptionException.class

            10/10/2014  18:59               279 EncryptionLocalBusiness.class

            10/10/2014  18:59               282 EncryptionRemoteBusiness.class

                           5 File(s)         11,697 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\entity

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             3,028 AndroidComponents.class

            10/10/2014  18:59             2,192 AndroidComponentsPK.class

            10/10/2014  18:59             4,792 ComponentParameters.class

            10/10/2014  18:59             3,759 ComponentParametersPK.class

            10/10/2014  18:59             3,271 FormAuditTrail.class

            10/10/2014  18:59             2,276 FormAuditTrailPK.class

            10/10/2014  18:59             4,371 FormComponents.class

            10/10/2014  18:59             3,235 FormComponentsPK.class

            10/10/2014  18:59             4,268 FormLayout.class

            10/10/2014  18:59             2,889 FormLayoutPK.class

            10/10/2014  18:59             4,803 Forms.class

            10/10/2014  18:59             2,545 Users.class

                          12 File(s)         41,429 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\exception

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59               766 ServiceException.class

                           1 File(s)            766 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\interfaces

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59               218 AuthenticatorCommonBusiness.class

            10/10/2014  18:59               272 AuthenticatorLocal.class

            10/10/2014  18:59               275 AuthenticatorRemote.class

            10/10/2014  18:59               250 MailCommonBusiness.class

            10/10/2014  18:59               245 MailLocal.class

            10/10/2014  18:59               248 MailRemote.class

            10/10/2014  18:59               161 NOTiFYSPiCECommonBusiness.class

            10/10/2014  18:59               266 NOTiFYSPiCELocal.class

            10/10/2014  18:59               269 NOTiFYSPiCERemote.class

                           9 File(s)          2,204 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\pojos

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59               987 ProjectTeamPOJO.class

                           1 File(s)            987 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\service

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             4,658 AbstractService.class

                           1 File(s)          4,658 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\sql

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             1,379 ViViFYdSQL.class

                           1 File(s)          1,379 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\utilities

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59               774 DatabaseProducers.class

                           1 File(s)            774 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\valueobjects

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59               925 MessageVO.class

            10/10/2014  18:59             2,297 PeopleVO.class

                           2 File(s)          3,222 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\com\notifypinpoint\webservices

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59               447 ApplicationConfig.class

                           1 File(s)            447 bytes

             

             

            Directory of C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR\META-INF

             

             

            10/10/2014  18:59    <DIR>          .

            10/10/2014  18:59    <DIR>          ..

            10/10/2014  18:59             7,722 ejb-jar.xml

            10/10/2014  18:59               151 MANIFEST.MF

            10/10/2014  18:59               600 orm.xml

            10/10/2014  18:59             1,994 persistence.xml

                           4 File(s)         10,467 bytes

             

             

                 Total Files Listed:

                          50 File(s)         98,002 bytes

                          53 Dir(s)  132,112,969,728 bytes free

             

             

            C:\eclipseProjects\NOTiFYPiNPOiNTWildFly\dist\NOTiFYPiNPOiNT\NOTiFYPiNPOiNTJAR>

            • 3. Re: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers
              Martin Kouba Master

              I've always used EARs from EJB 1.x to 3.1 so I stayed with them. I will be using EJBs at some point.

              Well, since EJB 3.1 (Java EE 6) you can use EJB components in a war.

               

              Let me check the structure...

              • 4. Re: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers
                Tomas Remes Expert

                Hi Roger,

                It appears that your deployment has no beans.xml which means that you have implicit bean archive Weld - CDI Reference Implementation which runs in "annotated" mode. This means that class DatabaseProducers  is not scanned by Weld/CDI, because this class doesn't have any bean defining annotation Contexts and Dependency Injection for the Java EE platform. This is the reason why your @Produces method is not called.  

                So you can make this class a bean or you can set mode to "all".

                • 5. Re: Re: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers
                  Roger Lee Apprentice

                  Tomas,

                   

                  In the chapter 9 example from Ken Finnignan's Book JBoss Weld CDi for java, which I've used as a basis. The DatabaseProducers class is:-

                   

                  package org.cdibook.chapter9.util;

                   

                  import org.cdibook.chapter9.annotations.BookDB;

                  import javax.enterprise.inject.Produces;

                  import javax.persistence.EntityManager;

                  import javax.persistence.PersistenceContext;

                   

                  public class DatabaseProducers {

                   

                      @PersistenceContext(unitName = "bookStore")

                      private EntityManager em;

                   

                      @Produces

                      @BookDB

                      public EntityManager produceBookDatabase() {

                          return em;

                      }

                  }


                  The beans.xml is:-


                  <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">

                      <interceptors>

                          <class>org.cdibook.chapter9.interceptor.SecurityInterceptor</class>

                          <class>org.cdibook.chapter9.interceptor.TransactionInterceptor</class>

                      </interceptors>

                  </beans>


                  I had an empty beans.xml and have now changed to:-


                  <?xml version="1.0" encoding="UTF-8"?>

                  <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"

                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"

                      version="1.1" bean-discovery-mode="all">

                      <scan>

                    <exclude name="org.jboss.weld.**" />

                    </scan>

                  </beans>

                  .

                  I annotated my DatabaseProducers class with @RequestScoped.


                  My EAR has now deployed successfully and I can "getEntityManager" from my abstract class.

                   

                  Many thanks,