• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

"No Persistence provider for EntityManger named..."

 
Mike London
Ranch Hand
Posts: 1227
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a JPA project that runs fine on my workstation, but when I copy it over to my work laptop, and try to run my Test.java file, I get this message:

Exception in thread "main" java.lang.ExceptionInitializationError
at ....

Caused by: javax.persistence.PersistenceException: No Persistence provider for Entity Manager named testJPA.

----

There seems to be a configuration file somewhere I'm missing.

I've updated the persistence.xml and put it into the resources/META-INF folder.

Any ideas why this might be happening and how to fix?

Thanks in advance.

Mike
 
Mike London
Ranch Hand
Posts: 1227
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm still getting messages that No Persistence provider for my EntityManager exists.

Looking at my persistence.xml file, the <persistence-unit name ..../> mentioned there matches the static initializer where I run the code:

emf=Persistence.createEntityManagerFactory("...");

Not sure what magic is needed here to get these to sync up.

Any suggestions would be appreciated.

Thanks.

mike
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you do not have a JPA provider on your classpath. You need a jar for your JPA implementation, i.e. eclipselink.jar or hibernate.jar, etc.
 
Mike London
Ranch Hand
Posts: 1227
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,

I'm thinking that the persistence.xml file could just be in the wrong folder too.

Will post back with updates.

Thanks.

mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic