-->
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.  [ 2 posts ] 
Author Message
 Post subject: my first try failed
PostPosted: Tue Apr 13, 2004 10:56 am 
Newbie

Joined: Tue Apr 13, 2004 9:07 am
Posts: 1
hiii
hibernate version is 2.1
i just begin to run a simple example but the following exception raised
exception

javax.servlet.ServletException: Error reading resource: Cat.hbm.xml
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
org.apache.jsp.pool_jsp._jspService(pool_jsp.java:149)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

net.sf.hibernate.MappingException: Error reading resource: Cat.hbm.xml
net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:307)
net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:957)
net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:909)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:845)
net.sf.hibernate.cfg.Configuration.configure(Configuration.java:831)
org.apache.jsp.pool_jsp._jspService(pool_jsp.java:137)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

my source code is

Properties props = new Properties();
props.setProperty("hibernate.connection.datasource", "java:comp/env/jdbc/myoracle");
props.setProperty("hibernate.dialect", "net.sf.hibernate.dialect.OracleDialect");

Configuration cfg cfg = new Configuration()
.addClass(com.aacom.hibernate.persistence.Cat.class)
.setProperties(props);


SessionFactory sessions = cfg.configure().buildSessionFactory();
Session sess = sessions.openSession();

and the mapping document contains
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">


<hibernate-mapping>

<class name="com.aacom.hibernate.persistence.Cat" table="CAT">
<id name="id" type="string" unsaved-value="null">
<column name="CAT_ID" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>
<property name="name">
<column name="NAME" sql-type="varchar(16)" not-null="true"/>
</property>
<property name="sex">
<column name="SEX" sql-type="CHAR(1)"/>
</property>
<property name="weight">
<column name="WEIGHT" sql-type="number(4,2)"/>
</property>
</class>
</hibernate-mapping>
avd i'm using hibernate2.1 and oracle9i as a database
and i'm woander what's the posible cause of this error


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 15, 2004 7:16 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Are you sure that Cat.hbm.xml is in the same directory as your Cat.class?

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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