Exception while accessing the Persistence unit ...?

#1

Hi,

I am new to ObjectDB I was trying your eclipse/jee6/glassfish tutorial. I am getting the following exception:

[#|2012-04-09T00:00:52.999-0400|SEVERE|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=27;_ThreadName=Thread-1;|java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName GuestbookPU
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.init(EntityManagerWrapper.java:121)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:162)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:456)
at guest.GuestDao.getAllGuests(GuestDao.java:27)

Can someone help me ? The only change I did to the code was add the unit name to the DAO class: (if I remove it then the exception thrown is the same with null for the Unit Name)

 

Thanks,
Allen

 

#2

Maybe the persistence.xml file has an error or maybe it is located in the wrong directory, because it seems that the persistence unit is unknown.

Try repeating the tutorial steps one by one carefully or download and use the ready to use Maven version of the tutorial.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Hi,

I have gone over the turorial few times.

Here is my persistence.xml and attached please find the eclipse project layout: (Note eclipse is deploying the application and I can access the web page but I am unable to do any Database operations.)

<?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="GuestbookPU" transaction-type="JTA">
    <provider>com.objectdb.jpa.Provider</provider>
    <properties>
      <property name="javax.persistence.jdbc.url" value="$objectdb/db/guests.odb"/>
      <property name="javax.persistence.jdbc.user" value="admin"/>
      <property name="javax.persistence.jdbc.password" value="admin"/>
    </properties>
  </persistence-unit>

</persistence>
#4

Please post a zip file with your complete Eclipse project.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

Attached please find the eclipse project in a zip file.

 

Thank you in advance.

#6

This is the actual project ... sorry!

#7

Hi,

When I deploy the eclipse generated war file I get the same result. All DB operations fail.

When I deploy the Maven generated war file everything works fine with GlassFish.


Any help would be greatly appreciated.

Thanks,

Best Wishes

#8

Hi,

Can you take a look at my eclipse project and let me know what I am doing wrong?

I really would like to get the development in eclipse going.

Thanks,
Best Wishes

#9

There are 2 problems with your persistence.xml file:

  • It has a wrong name - persistance.xml instead of persistence.xml
  • The transaction-type should be JTA instead of RESOURCE_LOCAL.
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#10

Thank you! Those corrections fixed the problem.


Post Reply

To post a reply and/or subscribe to update notifications - please login