1 Reply Latest reply on Jun 30, 2016 4:54 AM by Giancarlo Prestinari

    JBAS016069: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named  in deployment

    Frank Murmann Newbie

      Hi there,

       

      i am trying to run an application with JBoss 7.1 under Linux. Deploying and running it under Windows works fine. Under Linux I get following Exception when trying to access my datasource:

       

      JBAS016069: Error injecting persistence unit into CDI managed bean. Can't find a persistence unit named  in deployment

       

      Can anyone help?

       

      persistence.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence>

         <persistence-unit name="musicserverdb">

            <provider>org.hibernate.ejb.HibernatePersistence</provider>

            <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>

            <properties>

               <property name="hibernate.dialect"

                        value="org.hibernate.dialect.H2Dialect"/>

            </properties>

         </persistence-unit>

      </persistence>  

       

      relevant code of dao:

       

      @SuppressWarnings("unchecked")

      public abstract class GenericDao<E, PK extends Serializable> {

       

          @PersistenceContext(name = "musicserverdb")

          private EntityManager entityManager;

       

          public EntityManager getEntityManager() {

              return entityManager;

          }

       

          public void setEntityManager(final EntityManager entityManager) {

              this.entityManager = entityManager;

          }