-->
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: Could not read mappings from resource: *.hbm.xml
PostPosted: Sun Dec 04, 2005 4:32 pm 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
org.hibernate.MappingException: Could not read mappings from resource: FileToSave.hbm.xml
org.hibernate.cfg.Configuration.addResource(Configuration.java:483)
org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1421)
org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1389)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1370)
org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1346)
org.hibernate.cfg.Configuration.configure(Configuration.java:1266)
org.hibernate.cfg.Configuration.configure(Configuration.java:1252)
Upload.doPost(Upload.java:49)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:419)
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 4:49 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
make sure the resource path to FileToSave.hbm.xml in hibernte.cfg.xml matches the actual location of FileToSave.hbm.xml in the classpath.


Top
 Profile  
 
 Post subject: Could not read mappings from resource: *.hbm.xml
PostPosted: Sun Dec 04, 2005 5:38 pm 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
Here is my source folders:

quickstart
|
|__WEB-INF
|
|__classes
|__hibernate.cfg.xml, FileToSave.hbm.xml, Upload.java
|
|__lib
|__(hibernate3.jar, and its dependents)

org.hibernate.MappingException: Could not read mappings from resource: FileToSave.hbm.xml

PLEASE HELP !!!

I don't have any classpath. What is the classpath for this running under Tomcat??


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 5:43 pm 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
...This is hibernate.cfg.xml file---
<session-factory>
<property name="connection.url">jdbc:mysql://localhost/quickstart</property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="connection.username"></property>
<property name="connection.password"></property>
<property name="connection.pool_size">12</property>
<property name="show_sql">false</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<!--mapping resource="Cat.hbm.xml"/-->
<mapping resource="FileToSave.hbm.xml"/>
</session-factory>
</hibernate-configuration>

------------This is FileToSave.hbm.xml-----------
<hibernate-mapping>
<class name="FileToSave" table="FileToSave">
<!-- the unique identifier for the cat -->
<id name="name" type="string" unsaved-value="null">
<column name="NAME" sql-type="char(32)" not-null="true"/>
</id>
<property name="type" type="string" unsaved-value="null">
<column name="TYPE" sql-type="varchar(32)" not-null="true"/>
</property>
<property name="size" type="int"/>
</class>
</hibernate-mapping>
--------------


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 5:50 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 12:34 am
Posts: 28
Where is FileToSave.java at?

Make sure that the name attribute in FileToSave.hbm.xml is pointing to where this class is. Something like below.

<class name="org.file.FileToSave" table="filetosave" schema="public">


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 6:08 pm 
Beginner
Beginner

Joined: Thu Oct 20, 2005 12:34 am
Posts: 28
mineame wrote:
Where is FileToSave.java at?

Make sure that the name attribute in FileToSave.hbm.xml is pointing to where this class is. Something like below.

<class name="org.file.FileToSave" table="filetosave" schema="public">


I meant to say FileToSave.class


Top
 Profile  
 
 Post subject: Could not read mappings from resource: *.hbm.xml
PostPosted: Sun Dec 04, 2005 6:13 pm 
Beginner
Beginner

Joined: Sun Dec 04, 2005 4:28 pm
Posts: 24
Here is my source folders:

quickstart
|
|__WEB-INF
|
|__classes
|__hibernate.cfg.xml, FileToSave.hbm.xml, Upload.java, FileToSave.java, Upload.class, FileToSave.class
|
|__lib
|__(hibernate3.jar, and its dependents)

org.hibernate.MappingException: Could not read mappings from resource: FileToSave.hbm.xml

PLEASE HELP !!!

I don't have any classpath. What is the classpath for this running under Tomcat??

Does this got anything to do with the location of hibernate3.jar ???


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 8:43 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
the mapping document is invalid, and I'm quite sure the *full* stack trace will say this. remove @unsaved-value from the property element.

don't worry about the classpath. in tomcat, everything under lib or classes will be magically located by the application. the location of FileToSave.class and FileToSave.hbm.xml are ok, but it is probably move all of your classes out of the default package (put org.foo.whatever in front of them).


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.