Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception in JPA fetch  RSS feed

sudha murty
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JPA for db transactions.
My problem is, I am able to insert the data in the tables properly, but while fetching the data, it gives the following exception:

java.lang.NoClassDefFoundError: javax/persistence/Persistence

The error is on the line --
EntityManagerFactory emf = Persistence.createEntityManagerFactory("testjpa");

There are two classes in persistence.xml
The code snippet for insert and fetch is similar. I mean the entityManager initialization and all.
Please help.

Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!