-->
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: org.hibernate.MappingException: Resource not found
PostPosted: Mon Jan 30, 2006 3:25 pm 
Newbie

Joined: Thu Jan 26, 2006 5:12 pm
Posts: 5
I am rather new to Hibernate!

I have a class file and the related hbm file in the same directory.
net/elnk/abtestframework/model/ABTarget.class
net/elnk/abtestframework/model/ABTarget.hbm.xml


new Configuration().configure() detects the cfg file in the classpath but is unable to find the Resource hbm file.
What is it that I am doing wrong?
I have run out of ideas at this point!!! Any help would be really appreciated.

CGF file
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<property name="show_sql">false</property>
<property name="cglib.use_reflection_optimizer">false</property>
<property name="cache.provider_class">net.sf.ehcache.hibernate.Provider</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.url">jdbc:mysql://localhost:3306/abtestdb</property>
<property name="connection.username">abtest</property>
<property name="connection.password">abtest</property>
<property name="c3p0.min_size">5</property>
<property name="c3p0.max_size">20</property>
<property name="c3p0.timeout">1800</property>
<property name="c3p0.max_statements">50</property>

<mapping resource="net/elnk/abtestframework/model/ABTest.hbm.xml"/>
<mapping resource="net/elnk/abtestframework/model/ABTarget.hbm.xml"/>
<mapping resource="net/elnk/abtestframework/model/ABTestTarget.hbm.xml"/>
</session-factory>
</hibernate-configuration>




Hibernate version:

hibernate3.jar

Mapping documents:

<?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="net.elnk.abtestframework.model.ABTarget" table="ABTARGETS">
<id name="id" column="ID">
<generator class="native"/>
</id>
<property name="description">
<column name="TARGET_DESCRIPTION">
<comment>Description of the AB Target, Ex Open PSP</comment>
</column>
</property>

<property name="appName">
<column name="APPLICATION_NAME">
<comment>Name of the Application to which this belongs</comment>
</column>
</property>

<property name="targetId">
<column name="TARGET_ID">
<comment>User defined ID for the Target Ex 800 for Open PSP</comment>
</column>
</property>

</class>

</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():

SessionFactory sf = new Configuration().configure().buildSessionFactory();

Full stack trace of any exception that occurs:

org.hibernate.MappingException: Resource: net/earthlink/abtestframework/model/ABTest.hbm.xml not found
at org.hibernate.cfg.Configuration.addResource(Configuration.java:478)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1453)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1421)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1402)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1378)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1298)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1284)
at net.earthlink.abtestframework.splitter.filter.SplitterFilter.init(SplitterFilter.java:80)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:266)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:327)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3165)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3622)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363)
at org.apache.catalina.core.StandardService.start(StandardService.java:497)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)


Name and version of the database you are using:

mysql 5.0

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 4:37 pm 
Newbie

Joined: Thu Jan 26, 2006 5:12 pm
Posts: 5
Well, I found the issue.

Since I am running within tomcat, the jar file for my app was missing the *.hbm.xml files. I updated my jar file and getResourceAsStream is now happy.

Still a long way to go:)


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.