You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Hatem <ha...@live.ca> on 2014/12/13 16:29:23 UTC

Web Application, JPA, persistence.xml

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.

Re: Web Application, JPA, persistence.xml

Posted by Rick Curtis <cu...@gmail.com>.
> 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 <ha...@live.ca> 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*