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

--------------------------------------------------------------
Hi

  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">
    <jta-data-source>java:jdbc/esb_monitor_dev</jta-data-source>
    <class>...</class>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <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"/>
    </properties>
  </persistence-unit>
</persistence>


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


<datasources>
   <local-tx-datasource>

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

      <!-- for in-process persistent db, saved when jboss stops. The
      org.jboss.jdbc.DerbyDatabase mbean is necessary for properly db shutdown 
-->
      
<connection-url>jdbc:derby://localhost:3301/esb_monitor_dev;create=true</connection-url>

      <!-- The driver class -->
      <driver-class>org.apache.derby.jdbc.ClientDriver</driver-class>

      <!-- The login and password -->
      <user-name>ESB</user-name>
      <password>sa</password>

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

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

      <!-- The time before an unused connection is destroyed -->
      <idle-timeout-minutes>5</idle-timeout-minutes>

      <!-- 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 
-->
      <track-statements/>

      <!-- This mbean can be used when using in process persistent derby -->
   </local-tx-datasource>
</datasources>


And this is how i refer to the PUs:

    @PersistenceUnit(unitName="EsbMonitorPU") 
    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
[http://community.jboss.org/message/595352#595352]

Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to