0 Replies Latest reply on Nov 23, 2009 2:16 PM by wellingtonsampaio

    Components.xml could not find persistence-unit-jndi-name

    wellingtonsampaio

      Hi all,


      Seam could not find the persistence:managed-persistence-context when injecting the EntityManager in the managed bean.


      The problem is that the entity manager factory is not bound in JNDI by the persistence.xml.
      Could anyone help me?


      The erro stack is:


      Caused by: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/MyEntityManagerFactory
           at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:245)
      



      components.xml


      <persistence:managed-persistence-context
           name="entityManager"
           auto-create="true"
           persistence-unit-jndi-name="java:/MyEntityManagerFactory">
      </persistence:managed-persistence-context>
      



      persistence.xml


      <persistence-unit name="MyPersistenceUnit">
           <provider>org.hibernate.ejb.HibernatePersistence</provider>
           <jta-data-source>java:/MyDatasource</jta-data-source>
           <class>package.Car</class>
           <properties>
                   <property name="hibernate.dialect" value="org.hibernate.dialect.SybaseAnywhereDialect"></property>
                   <property name="hibernate.show_sql" value="true"></property>
                   <property name="hibernate.format_sql" value="true"></property>
                   <property name="jboss.entity.manager.factory.jndi.name" value="java:/MyEntityManagerFactory"></property>
              </properties>
      </persistence-unit>