• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Could not resolve a persistence unit corresponding to the persistence-context-ref-name

 
pallavi chaudhari
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I am new to EJB. I just trying to develop one simple application which includes Stateless session bean & Entity bean in netbeans IDE using GlassFish server. when i deploy the application i am getting "Could not resolve a persistence unit corresponding to the persistence-context-ref-name [SessionBeanUsed.BankServiceBean/em] in the scope of the module called" this exception.
I am giving my code below.





where i am going wrong???

Thanks in advance...
 
Dan Kempten
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm no expert but could you show the contents of persistence.xml in your project?
check out whether you create tables or create and drop tables.
Here's mine.

And persistence context type?


 
pallavi chaudhari
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="TestEntity-ejbPU" transaction-type="JTA">
<provider>oracle.toplink.essentials.PersistenceProvider</provider>
<jta-data-source>checkPU</jta-data-source>
<properties>
<property name="toplink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>
 
Dan Kempten
Greenhorn
Posts: 25
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<jta-data-source>checkPU</jta-data-source>

is CheckPU the name of your jdbc database?
 
pallavi chaudhari
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes,while creating JNDI source i have given that name
 
pallavi chaudhari
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pallavi chaudhari wrote:Yes,while creating JNDI source i have given that name


This problem solved........thanks
 
loren nicolas
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pallavi chaudhari wrote:
pallavi chaudhari wrote:Yes,while creating JNDI source i have given that name


This problem solved........thanks


--> could you please post the details on how you have solved it? I'm facing the same problem right now... appreciate your quick response.. tnx!
 
pallavi chaudhari
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please,make sure that you have given same persistance unit name as you created.

i was facing "Could not resolve a persistence unit corresponding to the persistence-context-ref-name" beacuse i have not given persistence unit name proper.

 
loren nicolas
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx! i was able to solve it too. we have different problems. mine is that i have more than one persistent.xml found on the war file. anyway thanks alot!
 
Volodymyr Lysenko
Ranch Hand
Posts: 511
1
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

I had half an hour of beating my fist against the table because of this complete nonsense too!



It was resolved by changing this:

into this:

If only I were always far from such things
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic