I am running SchemaExportTask and I get an error telling me that there is an "invalid byte 2 of 2-byte UTF-8 sequence" when it tries processing my .class file. The class file has been compiled using Java 1.5.
Below is the Ant target I am using to run this task:
Code:
<!-- Generate the database schemas for all mapping files in our class tree -->
<target name="schema"
depends="prepare"
description="Generate database schemas from the O/R mapping files">
<!-- Teach Ant how to use Hibernate's schema generation tool -->
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="project.class.path"/>
<!-- Run the schema export task -->
<schemaexport config="${class.root}/hibernate.cfg.xml"
quiet="no"
text="no"
drop="no">
<!-- Make sure we don't overwrite the FIRMS or TRADERS schemas -->
<fileset dir="${class.root}">
<exclude name="**/Firm.hbm.xml"/>
<exclude name="**/Trader.hbm.xml"/>
</fileset>
</schemaexport>
</target>
I have the 3.0.2 hibernate3.jar in my lib directory so I suppose I am using the lastest hbm2ddl. Also I have deleted the tables from the database so I should be starting fresh there.
Thanks in advance for any suggestions.
--James
Hibernate version: 3.0.2
Mapping documents:Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.harborsideplus.grover.hibernate.ErrorSettings"
table="ERROR_SETTINGS">
<id name="errorSettingsId"
column="ERROR_SETTINGS_ID"
type="long">
<generator class="increment"/>
</id>
<property name="blockEmail"
column="BLOCK_EMAIL"
type="boolean"
not-null="true"/>
<property name="timeFilterInterval"
column="TIME_FILTER_INTERVAL"
type="long"
not-null="false"/>
<property name="timeFilterCount"
column="TIME_FILTER_COUNT"
type="int"
not-null="false"/>
<property name="associationId"
column="ASSOCIATION_ID"
type="string"
not-null="true"/>
<set name="errorTextFilters"
inverse="true"
cascade="all-delete-orphan">
<key column="ERROR_SETTINGS_ID"/>
<one-to-many class="com.harborsideplus.grover.hibernate.ErrorTextFilter"/>
</set>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.harborsideplus.grover.hibernate.ErrorTextFilter"
table="ERROR_TEXT_FILTERS">
<id name="errorTextFilterId"
column="ERROR_TEXT_FILTER_ID"
type="int">
<generator class="increment"/>
</id>
<property name="filterString"
column="FILTER_STRING"
type="string"/>
<many-to-one name="errorSettings"
column="ERROR_SETTINGS_ID"
class="com.harborsideplus.grover.hibernate.ErrorSettings"
not-null="true"/>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
[schemaexport] 19:05:56,196 ERROR Configuration:230 - Could not configure datastore from file: C:\hs
p\grover-hibernate\target\classes\com\harborsideplus\grover\hibernate\ErrorSettings.class
[schemaexport] org.dom4j.DocumentException: Invalid byte 2 of 2-byte UTF-8 sequence. Nested exception: Invalid byte 2 of 2-byte UTF-8 sequence.
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:484)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:264)
[schemaexport] at org.hibernate.cfg.Configuration.addFile(Configuration.java:224) [schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.java:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[schemaexport] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[schemaexport] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[schemaexport] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
[schemaexport] Nested exception:
[schemaexport] java.io.UTFDataFormatException: Invalid byte 2 of 2-byte UTF-8 sequence.
[schemaexport] at org.apache.xerces.impl.io.UTF8Reader.invalidByte(Unknown Source)
[schemaexport] at org.apache.xerces.impl.io.UTF8Reader.read(Unknown Source)
[schemaexport] at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
[schemaexport] at org.apache.xerces.impl.XMLEntityScanner.skipString(Unknown Source)
[schemaexport] at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
[schemaexport] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[schemaexport] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
[schemaexport] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[schemaexport] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:465)
[schemaexport] at org.dom4j.io.SAXReader.read(SAXReader.java:264)
[schemaexport] at org.hibernate.cfg.Configuration.addFile(Configuration.java:224)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(SchemaExportTask.jav
a:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExportTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[schemaexport] at org.apache.tools.ant.Task.perform(Task.java:364)
[schemaexport] at org.apache.tools.ant.Target.execute(Target.java:341)
[schemaexport] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[schemaexport] at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
[schemaexport] at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
[schemaexport] at org.apache.tools.ant.Main.runBuild(Main.java:673)
[schemaexport] at org.apache.tools.ant.Main.startAnt(Main.java:188)
[schemaexport] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
[schemaexport] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Name and version of the database you are using:Oracle 9