9 Replies Latest reply on Apr 16, 2018 5:06 AM by Wolfgang Mayer

    Can't find persistence unit named in deployment

    Sana Korejo Newbie

      Hi all,

       

      I am getting this error while starting Wildfly server (version 12).  I do have a persistence.xml with persistence unit. What am i doing wrong in the below code? It was working fine with Glassfish.

       

      Error:

       

      Component class my.package.services.ClassAFacade for component ClassAFacade has errors:

      WFLYJPA0033: Can't find a persistence unit named war_PU in deployment "\my.war\"

       

      ClassAFacade:

       

      @PersistenceContext(unitName = "war_PU" )

      private EntityManager em;

       

      persistence.xml:

       

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

      <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://java.sun.com/xml/ns/persistence  http://java.sun.com/xml/ns/persistence/persistence_2.0.xsd">

      <persistence-unit name="war_PU" transaction-type="JTA"></provider>

      <jta-data-source>java:/jdbc/mydb</jta-data-source>

      <class>my.package.entities.ClassA</class>

      <exclude-unlisted-classes>false</exclude-unlisted-classes>

      <properties>

      <property name="eclipselink.logging.level" value="INFO"/>

      </properties>

      </persistence-unit>

      </persistence>

       

      Kind Regards,

      Sana