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
|