2 Replies Latest reply on Jan 21, 2013 12:49 PM by jeetu

    EntityManager does not work when using errai-cdi and Infinispan-cdi

    jeetu

      Hi,

       

      I have a web app that uses errai-cdi and infinispan-cdi and i am now try to use the java persistence using the hibernate.

       

      I have a service implementation that will be used by the errai and i am injecting an entitymanager to this service implementation for persisting the state of a page.

       

      @ApplicationScoped

      @Service

      public class EbizInfraServiceImpl implements EbizInfraService{

       

          @Inject

          private EntityManager em;

       

      The app compiles fine and when i try to deploy it on the Jboss EAP 6.0, it throws the following WELD  deployment error

       

      10:22:20,243 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."Titan.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."Titan.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @Inject private com.clink.titan.controller.EbizInfraServiceImpl.em]

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

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_30]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_30]

          at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_30]

      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @Inject private com.clink.titan.controller.EbizInfraServiceImpl.em]

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

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

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

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

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

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

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

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

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

          ... 5 more

       

      I am using errai-cdi 2.1.0.Final version and Infinispan-cdi's 5.2.0.ALPHA2 version and hibernate's hibernate-jpa-2.0-api 1.0.1.Final version.

       

      Is there a problem with versions mismatch?

       

      I had a similar issue between errai-cdi and infinispan-cdi, i got it resolved with upgrading to the above versions.

       

      Attaching my pom.xml and server log for your reference.

       

      Regards

      Jithendra

        • 1. Re: EntityManager does not work when using errai-cdi and Infinispan-cdi
          cbrock

          This is actually a known issue with Infiinispan CDI. It is not currently compatible with Weld SE, which we use as our default development enviroment. You can work around this problem by setting up DevMode to use -noserver and deploy the server-side part of your app to JBoss AS7. That's really the only work around until that gets fixed.

          • 2. Re: EntityManager does not work when using errai-cdi and Infinispan-cdi
            jeetu

            Thanks Mike for your response. But i have some concerns.

             

            I had errai-cdi and Infinispan-cdi working fine together with the versions i have specified. I had issues with older versions of both. But after i upgraded errai-cdi from 2.0.0.Final to 2.1.0.Final and Infinispan-cdi from 5.1.3.Final to 5.2.0.ALPHA2, it all went fine.

             

            I had another forum for the above issue, to which nobody responded and i worked it out and updated the forum with my findings.

             

            When i then wanted persistence on my application, and added hibernate related dependencies, and did the coding, and tried deploying, then i started getting the above said WELD exceptions. So, is hibernate also not compatible with WELD SE?

             

            Regards

            Jithendra