org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'mySessionFactory' defined in ServletContext
resource
[/WEB-INF/appcontext/databaseContext.xml]: Initialization of bean
failed; nested exception is net.sf.hibernate.MappingException:
org.dom4j.DocumentException:
Error on line 198 of document : <Line 198, Column 11>: XML-20124:
(Fatal Error) An attribute cannot appear more than once in the same
start tag. Nested exception: <Line 198, Column 11>: XML-20124:
(Fatal Error) An attribute cannot appear more than once in the same
start
tag.
The document databaseContext.xml only ends at line 186, which suggests
the error is coming from elsewhere.
Any ideas?
--
"Don't take the name of root in vain."
Jeff Mutonho
Cape Town
South Africa
GoogleTalk : ejbengine
Skype : ejbengine
Registered Linux user number 366042
I used XML Spy to validate the generated hbm.xml files and found
out that indeed
one of my hbm.xml , namely Person.hbm.xml , file is failing validation
in XML Spy .The offending part is "unique" attribute which appears
twice in the following entry :
<many-to-one
name="contactDetails"
class="za.co.introspect.portal.ContactDetails"
cascade="save-update"
outer-join="auto"
update="true"
insert="true"
unique="true"
column="contactdetails_id"
not-null="false"
unique="true"
/>
These hbm.xml files are being generated using the xdoclet tool.I'm
using both Ant and Maven to build my application's ear files.The ear
file build by Ant deploys successfully even and the Maven one fails ,
even though they both have the same NOT-WELL formed Person.hbm.xml.
Initially I thought there's a difference in version between the dom4j
jars in the ear files , but both are using the same one ,
dom4j-1.6.1.jar.
How then is it possible that the NOT-WELL formed Person.hbm.xml
passes validation in the Ant generated ear file , but fails in the
Maven generated ear file?What could I be over looking here?
Why is xdoclet generating the two "unique" fields ? The code looks like :
/**
* @return the contact details linked to the person
* @hibernate.many-to-one class="za.co.introspect.portal.ContactDetails"
* cascade="save-update"
* column="contactdetails_id" not-null="false" unique="true"
*/
public ContactDetails getContactDetails() {
return contactDetails;
}
public void setContactDetails(ContactDetails contactDetails) {
this.contactDetails = contactDetails;
}