0 Replies Latest reply on Jan 31, 2011 12:41 PM by yangju.richard.yang.pearson.com

    Seam 3 persistence (3.0.0.Beta2): producer injected PC not visible to classes in a different jar

    yangju.richard.yang.pearson.com

      We use jboss 6 Final and exploded war archive. I followed seam 3 persistence doc and added a producer in the common jar inside web-inf lib directory:



       @CentralRepo
          @SeamManaged
          @ConversationScoped
          @Produces
          @PersistenceUnit(unitName = "myUnit")
          EntityManagerFactory centralEmf;




      Then from a class in a different jar, I inject this PC



      @Inject
          @CentralRepo   
          private EntityManager myEm;



      I got exception in deployment:



      2011-01-31 09:37:17,078 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (RMI TCP Connection(2)-127.0.0.1) Error installing to Start: name=vfs:///C:/projects/eclipseWorkspaces/ePenMain/.metadata/.plugins/org.jboss.ide.eclipse.as.core/JBoss_6.0_Runtime_Server1295730125093/deploy/epen-account-setup.war_WeldBootstrapBean state=Create: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@CentralRepo] at injection point [[field] @Inject @CentralRepo private com.pearson.epen.test.service.impl.TestServiceImpl.centralEm]
              at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:305)
              at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:139)
              at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:162)
              at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:377)
              at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:363)
              at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:388)
              at org.jboss.weld.integration.deployer.env.helpers.BootstrapBean.boot(BootstrapBean.java:92)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:60)
              at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:168)
              at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:257)
              at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:125)
              at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
              at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:202)
              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)




      However, if I move the producer class to the same jar of the injecting class, then it works.


      Why is that? I want the producer to be in a common jar so all class from any jar can see inject entity manager by this producer. Is there any solution? By the way, in my persistence.xml I have


      <jar-file/>



      to refer to the common jar, so classpath is not an issue.