Error added: 2008-09-16T11:59:17Z
fOR ME THE PROBLEM WAS ON WHERE MY META-INF WAS IN...IT WAS NOT IN THE SRC ! I PLACED IT ON SRC THAN IT WORKED FINE.
If you use EclipseLink and you use Maven 2 remember you need the artifacts javax.persistence and eclipselink: <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>javax.persistence</artifactId> <version>2.0.0</version> </dependency> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>eclipselink</artifactId> <version>2.0.0</version> </dependency> Your persistence.xml should be placed in: resources\META-INF\ For example, if you defined the persistence unit like this: <persistence-unit name="myPU" transaction-type="RESOURCE_LOCAL"> You have to create with: EntityManagerFactory emf = Persistence.createEntityManagerFactory("myPU");
If using Netbeans 6.8, the problem arose after I edited the PU in the persistence.xml file. This caused Netbeans to create two entitymanager references, one called entitymanager and the second called entitymanager1. Do a find for \"entitymanager1\" and if this is your problem too then you will need to edit some files by hand (not in Netbeans remember to close the project in Netbeans first) Go to the src\\name-of-your-project\\resources folder and find the properties file(s) mentioned in the search for entitymanager1 above. Open the files with notepad and edit. Find the line that says entityManager.persistenceUnit= Make sure that what follows the equal sign is accurate for the name of your PU. Cut and paste from persistence.xml file if need be. Next, edit the java files where the following line appears javax.persistence.Persistence.createEntityManagerFactory(\"\").createEntityManager() In the quotations above should appear your PU as mentioned above. Delete any reference to entitymanager1 you find. This worked for me, but be careful editing. And good luck with it. It is worth persisting!
name="CargaOrganigrama" transaction-type="RESOURCE_LOCAL" And I'm calling EntityManagerFactory emf = javax.persistence.Persistence.createEntityManagerFactory("cargaOrganigrama");
Assuming you have one declared in persistence.xml, there are 2 common problems. 1. You don\'t have the hibernate-entitymanager jars. 2. The persistence.xml is in the wrong place. It needs to be in META-INF, but for me (using Netbeans 6), it had to be in src/conf/ not in web/META-INF/ I assume it gets copied to META-INF during build
[HACK] If using Spring, create a LocalContainerEntityManagerFactoryBean and set persistenceProviderClass property to your persistence provider - look for the contents of /META-INF/services/javax.persistence.spi.PersistenceProvider in the corresponding jar(for me it was hibernate-entitymanager.xx.jar).
in my case remember that it is persistence.xml not persistance.xml
A solution that worked for me: Using Hyperjaxb, which autogenerates a persistence-unit name if one is not supplied to it at runtime, can generate a name that exceeds a recognizable length. Solution for me was to provide persistence-unit name to hyperjaxb for it to use in generated persistence.xml file.
If you\'re trying to run your app from Eclipse and have your persistence.xml at src/main/resources check your build path. It may be excluding this folder.
uninstall netbeans and install second time i m sure problem will bsoved
I am using netbeans 6.9. The solution that i found was to change Persistence library from TopLink to Hibernate. This can be done after opening persistence.xml from netbeans, and congiguring it properly.(it's very easy) Then you have to add hibernate JPA to project's libraries. After these thinks, it works!
fOR ME THE PROBLEM WAS ON WHERE MY META-INF WAS IN...IT WAS NOT IN THE SRC ! I PLACED IT ON SRC THAN IT WORKED FINE.
Format your pc
put the persistence.xml in src directory
Try to check that the name of the PersistenceUnitName in the source code matches the one in the persistence.xml
Put persistence.xml in WEB-INF\\classes\\META-INF
In addition to Answer 1, in your persistence.xml, below your <persistence-unit ...> add \"<provider>org.hibernate.ejb.HibernatePersistence</provider>\" or the provider of your choice.
the persistence.xml must be inside of src directory ;-(
yhil
fdfgdfgd
you need to add hibernate or toplink jar into Lib. check it. if you are building EJB3 project,it will happen!
In addition to Answer 8, needed to say that PU means the \"persistence-unit name\" which is found in the persistence.xml file
For me, \'twas the location of the persistence.xml. Confusion cleared up here : http://javahowto.blogspot.com/2007/06/where-to-put-persistencexml-in-web-app.html
and don\'t think you can call it something else than persistence.xml, like for instance testPersistence.xml :)
One way this exception can occur is when you have persistence.jar on your classpath but not the JPA provider jar. Make sure you have both persistence.jar and eclipselink.jar on your classpath.
One way this exception can occur is when you have persistence.jar on your classpath but not the JPA provider jar. Make sure you have both persistence.jar and eclipselink.jar on your classpath.
you need to add hibernate or toplink jar into Lib. check it. if you are building EJB3 project,it will happen!
If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people
struggling with this too.
If you want to be notified via email when this is solved, enter your email address here: