Whenever I try to get an EntityManagerFactory from an app, I get seemingly contradictory parse errors:
javax.persistence.PersistenceException: Invalid persistence.xml. Error parsing XML (line-1 : column -1): cvc-complex-type.3.2.2: Attribute 'version' is not allowed to appear in element 'persistence'. Error parsing XML (line-1 : column -1): cvc-complex-type.4: Attribute 'version' must appear on element 'persistence'. Error parsing XML (line-1 : column -1): cvc-complex-type.3.2.2: Attribute 'name' is not allowed to appear in element 'persistence-unit'. Error parsing XML (line-1 : column -1): cvc-complex-type.4: Attribute 'name' must appear on element 'persistence-unit'. .... the persistence.xml file has been stripped back to:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="proxy_test"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <properties> <property name="hibernate.show_sql" value="true"/> </properties> </persistence-unit> </persistence> .... the callstack at this point is: at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:145) at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:168) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:314) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32) at com.authentipay.mps.db.test.HibernateTest.main(HibernateTest.java:20)
I'm using 3.6.2 final, but have also tried various flavours of 3.5.
This perhaps looks like a namespace issue, but I have scavenged persistence.xml namespace declarations from all over the web, none of them have helped. If I break the persistence.xml in other ways then the logging changes, so I'm sure it's finding this xml file.
My (eclipse) project references both hibernate3.jar and hibernate-jpa-2.0-api-1.0.0.Final.jar on the bulid path, from hibernate-distribution-3.6.2.Final.
Any help would be hugely appreciated. Thanks, Phil
|