-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Crazy XML parse error on persistence.xml when running as app
PostPosted: Mon Apr 11, 2011 10:08 am 
Newbie

Joined: Mon Apr 11, 2011 9:48 am
Posts: 2
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


Top
 Profile  
 
 Post subject: Re: Crazy XML parse error on persistence.xml when running as app
PostPosted: Tue Apr 12, 2011 5:38 am 
Newbie

Joined: Mon Apr 11, 2011 9:48 am
Posts: 2
For anyone interested, this problem went away when I removed a bunch of jar files I was using for apache axis (not axis2). Perhaps some other parser from there was getting used.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.