Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem while injecting EntityManager  RSS feed

 
Mona Yehia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an EJB bean TestBean



I tried using EntityManager to create a query, it throws null pointer exception.
Tried getting entityManager from EntityManagerFactory also null pointer exception, I don't know what's missing, here is my persistence.xml:



And yes it is located in META-INF folder.
Any help please??

The exception:
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your injection doesn't seem to be the problem, otherwise the NullPointerException would have been caused by your code, but instead it comes from inside the EntityManager.
 
Mona Yehia
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the problem
The JTA platform property was missing, I added this to my persistence.xml as I am using glassfish & it worked
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!