Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
Ranch Hand
Posts: 54
  • 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...
 
Greenhorn
Posts: 25
  • 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
  • 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
  • Likes 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
  • 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
  • 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
 
Greenhorn
Posts: 2
  • 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
  • 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
  • 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!
 
Ranch Hand
Posts: 514
1
Eclipse IDE Java
  • 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
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic