1 Reply Latest reply on Nov 18, 2006 5:08 PM by murilo_fla

    PersistenceUnit error

    micheral

      Hello

      I hope someone can help me. I get the following error on deployment of my bean.ear file on jboss-4.0.4RC1:

      16:53:41,795 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=calc
      ulator_ejb.jar
      java.lang.RuntimeException: Field javax.persistence.EntityManager org.jboss.tutorial.stateless.bean
      .CalculatorBean.em @PersistenceUnit in error: EMPTY STRING unitName but there is no deployments in
      scope


      I can see, that the error occurs in the JNDI. When the server tries to locate my EntityManager.


      @PersistenceContext
      EntityManager em;


      Here is my persistence.xml:

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
      version="1.0">
      <persistence-unit name="manager1" transaction-type="JTA">
      org.hibernate.ejb.HibernatePersistence
      <jta-data-source>java:/MySqlDS</jta-data-source>
      <mapping-file>ormap.xml</mapping-file>
      <jar-file>bean.jar</jar-file>
      org.jboss.tutorial.entity.bean.Order
      org.jboss.tutorial.entity.bean.LineItem






      </persistence-unit>


      Regards Ralph Michelsen, Denmark

        • 1. Re: PersistenceUnit error
          murilo_fla

          Hi There.
          I was with this same problem, and after many hours, I found out what was wrong, at least, in my case.
          In my case this error ocurred because the EJB jar file was not very fine. I am creating the jar file using the ant "jar" task, and I was inserting the META-INF subdirectory using the "zipfileset" task. Althought I was able to open the jar file and see the META-INF inside it, I got some warnings about it in the Linux command line zip command.
          When I changed the "zipfileset" for the "fileset" task, the problem desapeared. See my ant tasks:
          before:





          after (with the conf files properly moved):






          I know this case is very specific, but maybe you should check your JAR file's META-INF integrity.
          Remembering that in my case it was not very clear that it had inconsistency, because graphical Zip programs could read it nicely.

          Cheers
          Murilo