• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate schema export SAXParser error

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting the following error while running the schema export ant task.
Hibernate version 2.03. If anybody has any idea about this please post a reply. It appears as if the parser is complaining that the xml file isn't conforming to the DTD but I am puzzled why. Some other vital information is at the end of the stack trace. I am willing to send any more information if someone would like to help me.

please scroll down a little for complete stacktrace
SEVERE: Error parsing XML: D:\<path shortened>\AccountInformationTypeImpl.hbm.xml(32)
org.xml.sax.SAXParseException: Attribute "access" must be declare
d for element type "property".



The .hbm.xml file was generated by XDoclet 1.2.1.
here is an excerpt from the .hbm.xml file.


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="com.package.AccountInformationTypeImpl"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="id"
type="string"
length="36"
unsaved-value="any"
>
<generator class="assigned">
</generator>
</id>

<property
name="externalAccountNumber"
type="java.lang.String"
update="true"
insert="true"
access="property"
column="externalAccountNumber"
/>




Complete stacktrace
SEVERE: Error parsing XML: D:\<path shortened>\AccountInformationTypeImpl.hbm.xml(32)
org.xml.sax.SAXParseException: Attribute "access" must be declare
d for element type "property".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseExce
ption(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Sour
ce)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown S
ource)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown S
ource)
at org.apache.xerces.impl.dtd.XMLDTDValidator.addDTDDefaultAttrs
AndValidate(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement
(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElem
ent(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragmen
tContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDoc
ument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown So
urce)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown So
urce)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Sou
rce)
at org.dom4j.io.SAXReader.read(SAXReader.java:339)
at org.dom4j.io.SAXReader.read(SAXReader.java:219)
at net.sf.hibernate.cfg.Configuration.addFile(Configuration.java
:155)
at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.getConfigurati
on(SchemaExportTask.java:184)
at net.sf.hibernate.tool.hbm2ddl.SchemaExportTask.execute(Schema
ExportTask.java:128)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)

at org.apache.tools.ant.Project.executeTargets(Project.java:1063
)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Jul 21, 2004 10:04:20 AM net.sf.hibernate.util.XMLHelper$ErrorLog
ger error

-----------------------------------------------------------------------------------
ANT task for schema export

<schemaexport
properties="${hibernate.properties}"
quiet="yes"
text="yes"
drop="no"
delimiter=";"
output="${database}/schema.sql">
<fileset dir="${hibernate.mapping}">
<include name="**/Account*.hbm.xml"/>
</fileset>
</schemaexport>
-----------------------------------------------------------------------------------
hibernate.properties relevant section

## HypersonicSQL

hibernate.dialect net.sf.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.username sa
hibernate.connection.password
hibernate.connection.url jdbc:hsqldb atabase/hsql/test
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now that is wierd. hibernate-mapping-2.0.dtd does define an implied attribute of the PROPERTY element calles ACCESS. And the hibernate docs state that one of the anticipated values is "property". I can't say why this is happening, but the obvious way round it is to delete the access attribute. I'd post this on the forum at hibernate's site - see if one of the developers can explain. Let us know what you find out.
 
santosh kulkarni
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul for the reply. One of my colleagues had the same suggestion of removing the access tags, it does work. I have not seen any reply to my post on the hibernate forum yet. Now I am stuck at hyperjaxb not creating hibernate xdoclet tags for public static classes , but that goes into another post:-)
Santosh
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by santosh kulkarni:
Now I am stuck at hyperjaxb not creating hibernate xdoclet tags for public static classes , but that goes into another post:-)



If you really mean HyperJAXB, would you please provide more details?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic