File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JPA Certification (OCEJPA) and the fly likes JPA Could not find Entity Manager. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » JPA Certification (OCEJPA)
Bookmark "JPA Could not find Entity Manager." Watch "JPA Could not find Entity Manager." New topic
Author

JPA Could not find Entity Manager.

Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi All,

I dontknow what the error mean, please help me...

I could not run any examples of JPA.

I just downloaded the example from java2s and its not working,

I know its problem in my system, But i dont know where to fix.


[java] 0 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA
[java] 16 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.1.GA
[java] 31 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
[java] 31 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
[java] 47 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[java] 109 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA
[java] 109 [main] INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.4.0.GA
[java] 130353 [main] ERROR org.hibernate.ejb.packaging.PersistenceXmlLoader - Error parsing XML: XML InputStream(154) The element type "meta" mus
t be terminated by the matching end-tag "</meta>".
[java] java.lang.ExceptionInInitializerError
[java] Caused by: javax.persistence.PersistenceException: Unable to configure EntityManagerFactory
[java] at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
[java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
[java] at Main.<clinit>(Main.java:10)
[java] Caused by: org.xml.sax.SAXParseException: The element type "meta" must be terminated by the matching end-tag "</meta>".
[java] at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:249)
[java] at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
[java] at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:70)
[java] at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:89)
[java] at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:222)
[java] ... 4 more
[java] Could not find the main class: Main. Program will exit.
[java] Exception in thread "main"

Thanks,
Bennet Xavier X.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30753
    
156

Can you show your persistence.xml file? It sounds like it might have mismatched XML tags.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bennet Xavier
Ranch Hand

Joined: Jun 19, 2008
Posts: 162
Hi Jeanne,

Only word which comes to my mind is "Wow"..

that was the problem. the <persistence> tag with wrong dtd mapping.

Thank You so much,

Bennet Xavier X.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPA Could not find Entity Manager.