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>
</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...