-->
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: JBoss unable to locate mapping xml files
PostPosted: Fri Oct 10, 2003 2:27 pm 
Newbie

Joined: Fri Oct 10, 2003 1:57 pm
Posts: 2
Hello,

I have been banging my head against a problem that seems to be a JBoss -Hibernate class loader problem for a couple days now. (Note, for reason I don't care to go into, I can not use the JBoss MBean configuration option.)

I am trying to configure my hibernate session factory in the following way:

Configuration cfg = new Configuration().addClass(PurchaseOrderImpl.class);
SessionFactory sessFac = cfg.buildSessionFactory();

When I fire up my application in jboss I get the following stack trace:

Code:
net.sf.hibernate.MappingException: Resource: com/partnet/netops2/domain/events/PurchaseOrderImpl.hbm.xml not found
        at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:285)
        at com.partnet.netops2.persistence.dao.hibernate.PurchaseOrderDaoFactory
.initialize(PurchaseOrderDaoFactory.java:59)
        ... 68 more



I am using JBoss 3.2.1, and I have the following jars (among others) in my server's lib dir:

commons-collections.jar
commons-lang.jar
commons-logging.jar
cglib-asm.jar
hibernate2.jar
odmg.jar

In WEB-INF/lib and WEB-INF/classes I have all of my applicatioin code, including my hibernate specific dao, whos factory is blowing up durring initialization. Also, note that the mapping file that can not be found (PurchaseOrderImpl.hbm.xml) is sitting right next to the class (PurchaseOrderImpl.class) under WEB-INF/classes, which is being successfully loaded.

Hibernate version is 2.0.3

Any insight would be greatly appreciated!

Troy


Top
 Profile  
 
 Post subject: Solved
PostPosted: Fri Oct 10, 2003 5:41 pm 
Newbie

Joined: Fri Oct 10, 2003 1:57 pm
Posts: 2
As it turned out, I had a bug in my ant script where a jar was getting built with all the code, but none of the resources (i.e. no hibernate mapping files). I didn't realize the jar had the hibernate and Dao code in it, I thought that code only live in WEB-INF/classes... Anyway, this explains why the class loader couldn't find the resource files.

The moral of the story is that a quick code review (even a review of your build script that has seemed to work perfectly for so long) can save hours and even sometimes days in the trial-and-error debug cycle!

Thanks,

Troy


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.