[jboss-user] [EJB3] - UNRESOLVED Demands 'persistence.unit:unitName=...

Matthias Becker do-not-reply at jboss.com
Thu Mar 24 10:18:12 EDT 2011

Matthias Becker [http://community.jboss.org/people/drake2711] created the discussion

"UNRESOLVED Demands 'persistence.unit:unitName=..."

To view the discussion, visit: http://community.jboss.org/message/595352#595352


  i am new to JBoss and EJBs in general so plase help  :) 

  Every time i try to deploy my application i get erros indicateing that the persistance unit cannot be found:
* UNRESOLVED Demands 'persistence.unit:unitName=EsbMonitorEAR-0.0.1-SNAPSHOT.ear/#EsbMonitorPU' **
* 14:51:40,882 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=*persistence.unit:unitName=EsbMonitorEAR-0.0.1-SNAPSHOT.ear/#EsbMonitorPU* state=Create: javax.persistence.PersistenceException: [PersistenceUnit: EsbMonitorPU] class or package not found

and the following kind of demands:
* and demands:
14:51:27,287 INFO  [org.jboss.ejb3.deployers.JBossASKernel]     persistence.unit:unitName=*EsbMonitorEAR-0.0.1-SNAPSHOT.ear/#EsbMonitorPU*; Required: Described

where does this name come from?
The persistence.xml (i had to place it in the META-INF of the EAR-file) looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" 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_2_0.xsd">
  <persistence-unit name="EsbMonitorPU" transaction-type="JTA">
      <property name="eclipselink.ddl-generation" value="create-tables"/>
      <property name="hibernate.hbm2ddl.auto" value="update" />
      <property name="jboss.entity.manager.jndi.name" value="java:/EsbMonitorPU"/>
      <property name="jboss.entity.manager.factory.jndi.name" value="java:/EsbMonitorPUFactory"/>

This is the DS-File wich is localed in the server\default\deploy directory:


      <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
      <!-- Datasources are not available outside the virtual machine -->

      <!-- for in-process persistent db, saved when jboss stops. The
      org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db shutdown -->

      <!-- The driver class -->

      <!-- The login and password -->

      <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->

      <!-- The maximum connections in a pool/sub-pool -->

      <!-- The time before an unused connection is destroyed -->

      <!-- Whether to check all statements are closed when the connection is returned to the pool,
           this is a debugging feature that should be turned off in production -->

      <!-- This mbean can be used when using in process persistent derby -->

And this is how i refer to the PUs:

    private EntityManagerFactory factory;
    @PersistenceContext(unitName = "EsbMonitorPU")
    private EntityManager em;
    protected final EntityManager getEntityManager() {
        if (em == null) {
            em = factory.createEntityManager();
        return em;

I assembled all this code from various sources in the iNet but nothing works so far.

Any Ideas? How ist this courios "*EsbMonitorEAR-0.0.1-SNAPSHOT.ear/#EsbMonitorPU*" name assembled? Is my Maven configuration responsible for that? If so i dont understand how...

I use JBoss 6.0.0Final

Thank you
BTW: If i run it directly from Eclipse, everything works fine...

Reply to this message by going to Community

Start a new discussion in EJB3 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110324/f1db57e7/attachment.html 

More information about the jboss-user mailing list