-->
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.  [ 3 posts ] 
Author Message
 Post subject: Facing problem with hibernate with weblogic7
PostPosted: Mon Mar 21, 2005 11:15 am 
Newbie

Joined: Mon Mar 21, 2005 10:54 am
Posts: 2
Hi,

I am trying to use Hibernate 2 with Weblogic 7 and am facing a strange problem, I have kept my hibernate2.jar in \WEB-INF\lib and the hibernate.cfg.xml in the \WEB-INF\Classes folder and when I try to build a session factory using the following line

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

I get the following error.

<Mar 21, 2005 8:25:51 PM IST> <Error> <HTTP> <101017> <[ServletContext(id=1721585,name=TestAPP,context-path=/TestAPP)] Root cause of ServletException
org.hibernate.MappingException: Error reading resource: com/test/TestTable.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:447)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1381)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1353)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1335)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1302)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
at jsp_servlet.__getdata._jspService(__getdata.java:118))

Also i am having the "TestTable.hbm.xml" and TestTable.class under web-inf/classes/com/test


Any thoughts would be really helpful.

Thanks,
Jack


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 21, 2005 12:17 pm 
Newbie

Joined: Wed Feb 16, 2005 10:47 am
Posts: 1
Location: Italy, Rome
If you want to customize your configuration file you must to define your configuration:

private static String CONFIG_FILE_LOCATION = "/hibernate.cfg.xml";

then you must to istantiate your coonfiguration:

private static final Configuration cfg = new Configuration();


and then:

cfg.configure(CONFIG_FILE_LOCATION);
sessionFactory = cfg.buildSessionFactory();


with all the try / catch

^____^


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 22, 2005 12:47 am 
Newbie

Joined: Mon Mar 21, 2005 10:54 am
Posts: 2
The error is when hibernate configures the mapping resource. Its not able to locate the TestTable.hbm.xml document. If i remove the <mapping resource="com/test/TestTable.hbm.xml"/> in the hibernate.cfg.xml it doen't throw any error. Below is the error i get when i add the mapping resource in hibernate config file.

The TestTable.hbm.xml and TestTable.class is located in the WEB-INF/classes/com/test. Below is the exception. It throws the error even when i try to add the resource using addResource() or addClass().

org.hibernate.MappingException: Error reading resource: com/test/TestTable.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:447)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1381)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1353)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1335)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1302)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
at jsp_servlet.__getdata._jspService(__getdata.java:119)


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