Web Application, JPA, persistence.xml

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Web Application, JPA, persistence.xml

Hatem
Hi Everyone,
I am mumbling so far with Geronimo 3.0.1, Eclipse Luna 4.0, and wanted to develop a JPA aware JSF page with data helper class.
1. I've problem with persistence.xml doesnt seem to be seen by Geronimo , my understanding is that it should be placed under WEB-INF/classes/persistence.xml to be recognized..so it is.
but deployment always returns the following error:
At least one deployment problem:
org.apache.geronimo.common.DeploymentException: At least one deployment problem:
        at org.apache.geronimo.common.DeploymentException.cleanse(DeploymentException.java:87)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:150)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              :
              :
org.apache.geronimo.common.DeploymentException: No default PersistenceUnit specified, and none located
        at org.apache.geronimo.persistence.builder.PersistenceRefBuilder.findPersistenceUnitQuery(PersistenceRefBuilder.java:225)
        at
        :


my persistence.xml (tried on WEB-INF\classes\persistence.xml  and WEB-INF\persistence.xml) none seems to solve the problem
<?xml version="1.0" encoding="UTF-8" ?>
<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="QueueStationPU"  >
        <description>This unit manages orders within a queue station.
        </description>
        <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>jdbc/QueueStationDS</jta-data-source>
        <class>com.hahlabs.mf.model.entity.OrderEntity</class>
        <class>com.hahlabs.mf.model.entity.PatientEntity</class>
        <class>com.hahlabs.mf.model.entity.ActivityLogEntity</class>       
    </persistence-unit>
</persistence>


the part of code that references the above persistence-unit is the helper class that actually stores a record in the database
@Stateless
public class PatientRegistry extends MFObject  {
        @PersistenceContext(unitName="QueueStationPU")
        EntityManager em;
...
}
I wanted to use CMB with resource injection...

no entries related to persistence in either web.xml or geronimo-web.xml or whatso ever



Any help in this area is much appreciated!
Reply | Threaded
Open this post in threaded view
|

Re: Web Application, JPA, persistence.xml

Rick Curtis
> understanding is that it should be placed under WEB-INF/classes/persistence.xml
Try WEB-INF/classes/META-INF/persistence.xml

Thanks,
Rick

On Sat, Dec 13, 2014 at 9:29 AM, Hatem <[hidden email]> wrote:
Hi Everyone,
I am mumbling so far with Geronimo 3.0.1, Eclipse Luna 4.0, and wanted to
develop a JPA aware JSF page with data helper class.
1. I've problem with persistence.xml doesnt seem to be seen by Geronimo , my
understanding is that it should be placed under
WEB-INF/classes/persistence.xml to be recognized..so it is.
but deployment always returns the following error:
At least one deployment problem:
org.apache.geronimo.common.DeploymentException: At least one deployment
problem:
        at
org.apache.geronimo.common.DeploymentException.cleanse(DeploymentException.java:87)
        at org.apache.geronimo.deployment.Deployer.deploy(Deployer.java:150)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              :
              :
org.apache.geronimo.common.DeploymentException: No default PersistenceUnit
specified, and none located
        at
org.apache.geronimo.persistence.builder.PersistenceRefBuilder.findPersistenceUnitQuery(PersistenceRefBuilder.java:225)
        at
        :


my persistence.xml (tried on WEB-INF\classes\persistence.xml  and
WEB-INF\persistence.xml) none seems to solve the problem
<?xml version="1.0" encoding="UTF-8" ?>
<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="QueueStationPU"  >
        <description>This unit manages orders within a queue station.
        </description>

<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
        <jta-data-source>jdbc/QueueStationDS</jta-data-source>
        <class>com.hahlabs.mf.model.entity.OrderEntity</class>
        <class>com.hahlabs.mf.model.entity.PatientEntity</class>
        <class>com.hahlabs.mf.model.entity.ActivityLogEntity</class>
    </persistence-unit>
</persistence>


the part of code that references the above persistence-unit is the helper
class that actually stores a record in the database
@Stateless
public class PatientRegistry extends MFObject  {
        @PersistenceContext(unitName="QueueStationPU")
        EntityManager em;
...
}
I wanted to use CMB with resource injection...

no entries related to persistence in either web.xml or geronimo-web.xml or
whatso ever



Any help in this area is much appreciated!




--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/Web-Application-JPA-persistence-xml-tp3988610.html
Sent from the Users mailing list archive at Nabble.com.


--
Rick Curtis