-->
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.  [ 8 posts ] 
Author Message
 Post subject: SchemaExport not working - Could not read mapping document
PostPosted: Mon Nov 28, 2005 12:59 am 
Newbie

Joined: Mon Nov 28, 2005 12:43 am
Posts: 9
hibernate-3.1


I am just learning Hibernate. I am trying to use Hibernate tools to generate some DDL.

I get the following error:
BUILD FAILED
C:\projects\htest\build.xml:30: Schema text failed: Could not read mapping document from file: C:\projects\htest\src\AuctionItem.hbm.xml

Up this point, Log4J was indicating success(I think):
C:\projects\htest>ant schemaexport
Buildfile: build.xml

schemaexport:
[schemaexport] 21:56:10,759 INFO Environment:474 - Hibernate 3.1 rc3
[schemaexport] 21:56:10,759 INFO Environment:489 - loaded properties from resou
rce hibernate.properties: {hibernate.connection.username=root, hibernate.connect
ion.password=****, hibernate.cglib.use_reflection_optimizer=true, hibernate.dial
ect=org.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://lo
calhost/test, hibernate.connection.driver_class=com.mysql.jdbc.Driver}
[schemaexport] 21:56:10,759 INFO Environment:520 - using CGLIB reflection optim
izer
[schemaexport] 21:56:10,759 INFO Environment:550 - using JDK 1.4 java.sql.Times
tamp handling
[schemaexport] 21:56:10,837 INFO Configuration:238 - Reading mappings from file
: C:\projects\htest\src\AuctionItem.hbm.xml
[schemaexport] 21:56:11,055 INFO HbmBinder:265 - Mapping class: org.hibernate.a
uction.AuctionItem -> AuctionItem

I have copied AuctionItem.hbm.xml and AuctionItem.java from the Hibernate Samples (eg) into a project/src directory.

I am using the SchemaExport ant task from the docs:
<target name="schemaexport">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="class.path"/>

<schemaexport
properties="hibernate.properties"
quiet="no"
text="no"
drop="no"
delimiter=";"
output="schema-export.sql">
<fileset dir="src">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>


I get the same error with any mapping xml I provide.

Thanks in advance for any assistance or guidance.



[Hibernate.properties]
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.connection.url=jdbc:mysql://localhost/test
hibernate.connection.username=user
hibernate.connection.password=*********
hibernate.dialect=org.hibernate.dialect.MySQLDialect


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 2:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
run with ant -debug to get the full stacktrace.

I assume its simply because you dont have the pojo classes in the classpath.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 1:34 pm 
Newbie

Joined: Mon Nov 28, 2005 12:43 am
Posts: 9
Thanks for the quick reply - I am trying to run schemaexport on a similar machine (different configuration at work).

I did not have the pojos in the classpath before, now I do but I get:


schemaexport:
[schemaexport] 10:17:05,296 ERROR Configuration:232 - Could not configure datast
ore from file: F:\scratch\src\rgc\Message.hbm.xml
[schemaexport] org.dom4j.DocumentException: hibernate.sourceforge.net Nested exc
eption: hibernate.sourceforge.net
[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:22
6)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.getConfiguration(
SchemaExportTask.java:195)
[schemaexport] at org.hibernate.tool.hbm2ddl.SchemaExportTask.execute(SchemaExp
ortTask.java:135)
[schemaexport] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va: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.net.UnknownHostException: hibernate.sourceforge.net
[schemaexport] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
[schemaexport] at java.net.Socket.connect(Socket.java:507)

I think this may be caused because my current environment accesses the net through an http proxy. Can I configure schemaexport to use an http proxy for the dtd lookup?

Thanks again for your help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 1:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no - you most likely have references to hibernate 2 DTD's instead of Hibernate 3 DTD's

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 3:25 pm 
Newbie

Joined: Mon Nov 28, 2005 12:43 am
Posts: 9
Woot!

You are truly the hibernate master! I finally got it working.....


Thanks again for your help


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 3:17 pm 
Beginner
Beginner

Joined: Tue Nov 02, 2004 1:34 pm
Posts: 45
max wrote:
no - you most likely have references to hibernate 2 DTD's instead of Hibernate 3 DTD's


Oh man! I just came and searched and found this thread. I had no idea I was supposed to change the dtd in my existing hbm's when I upgraded from 2 to 3.

I had no problems until today, when all of a sudden I started getting the connection timeout error -- on previously working code.

Did the search, found this thread, changed my 40 .hbm files to 3.0 instead of 2.0 -- and MAN -- my start time shrank to near nothing.

It's been such a hassle stopping and starting my app anytime I changed a public method or property....watching each of the data classes take it's time to load.

No more! It's lightening fast.

Lee


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 3:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Lesson learned: Always read the migration and/or installation guide when upgrading major versions of software - this one is the *very* first item in that documentation.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 10, 2006 5:10 pm 
Beginner
Beginner

Joined: Tue Nov 02, 2004 1:34 pm
Posts: 45
max wrote:
Lesson learned: Always read the migration and/or installation guide when upgrading major versions of software - this one is the *very* first item in that documentation.


My bad. While not the FIRST thing on the list I see at: http://www.hibernate.org/250.html#A26 -- it is there -- and I overlooked it.

All is good now :)

Lee


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.