2 Replies Latest reply on Sep 26, 2013 1:41 PM by mschwery

    javax.naming.NameNotFoundException when invoking @PersistenceContext(unitName="persistence-pu")

    mschwery

      I'm getting an javax.naming.NameNotFoundException when invoking @PersistenceContext(unitName= inside a bean.

      The persistence.xml using is defined as follows:

       

      <persistence-unit name="-persistence-pu">
              <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
               <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
               <class>x.x.x.persistence.entities.RpEntity</class>
              <exclude-unlisted-classes>true</exclude-unlisted-classes>
              <properties>
                  <property name="eclipselink.target-database" value="oracle"/>
                  <property name="eclipselink.target-server" value="JBoss"/>
                  <property name="eclipselink.weaving" value="false"/>
                  <property name="eclipselink.logging.level" value="FINEST"/>          
              </properties>
          </persistence-unit>

       

      The bean is defined as the following:

       

      @Repository("rptDefDao")
      public class RptDAOBean implements RpDAO {

       

       
          @PersistenceContext(unitName="persistence-pu")
          private EntityManager em;

       

      This is a spring 3.04 app.

      Does anyone have any ideas.