2 Replies Latest reply on Aug 8, 2007 2:33 AM by Luis Daniel Rangel Tovar

    SEAM2 fails to inject EntityManager

    Luis Daniel Rangel Tovar Newbie

      Trying to migrate from jBoss4.0.5.GA+Seam1.2.1.GA to jBoss4.2.1.GA+Seam2.0.0.B1, after updating lots of code, app deploys properly, but when I try to acces initial page, an EntityHome complains and sends me to error page:

      In attribute requires non-null value: complexHome.entityManager


      at this arbitrary piece of code:

      @Name("complexHome")
      public class ComplexHome extends GenericEntityHome<Complex> {
      
       @In EntityManager entityManager ;
      
       ...
      


      I believe it fails here due to life cycle but has nothing to do with this (works nice and smooth with old jBoss + old seam). App has deployed properly, logs do not report any errors, components.xml looks like this (fragment):

      Components.xml (fragment)
      
      <core:managed-persistence-context name="entityManager"
       auto-create="true" persistence-unit-jndi-name="java:/EntityManagerFactories/LaboraemPersistenceFactory" />


      ... and EJTool's "JNDI Browser" (http://www.ejtools.org/) reports:

      java:/
       ConnectionFactory (org.jboss.mq.SpyConnectionFactory)
       DefaultDS
       DefaultJMSProvider (org.jboss.jms.jndi.JNDIProviderAdapter)
       EntityManagerFactories
       LaboraemPersistenceFactory (org.jboss.ejb3.entity.InjectedEntityManagerFactory)
       EntityManagers
       LaboraemPersistence (org.jboss.ejb3.entity.TransactionScopedEntityManager)
       JmsXA (org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
      ... (more) ...


      ... so, the persistence unit has been deployed, I'm using the same injection I used for old seam, as seen in examples (even seam2 examples), so I believe things should work, yet, they don't :(

      Am I missing something ? Anybody ?

      Here's a bit of the stacktrace:

      org.jboss.seam.RequiredException: In attribute requires non-null value: complexHome.entityManager
       at org.jboss.seam.Component.getValueToInject(Component.java:2042)
       at org.jboss.seam.Component.injectAttributes(Component.java:1481)
       at org.jboss.seam.Component.inject(Component.java:1302)