-->
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.  [ 5 posts ] 
Author Message
 Post subject: Hibernate in EAR - MapResources files not found error
PostPosted: Fri Feb 20, 2004 7:38 pm 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
Using Hibernate 2.1.2, I'm placing the JCA connector in my EAR to deploy into BEA Weblogic 8.1 SP2.

I have an EAR with hibernate as a connector module. In the ra.xml, I set the MapResources to:

mappings/com/a/MyClass.hbm.xml

My problem is where exactly to put that file in my EAR. I've tried every place I can think of. I thought it would look up the mapping file from your classpath , but this is not working.

I tried putting a jar containing the mapping file (and its containing directories) under /APP-INF/lib (BEA auto-loads jars here)

I tried putting a jar (and also an expanded jar) under /APP-INF/classes (BEA auto-loads classes here)

I tried putting the mappings under my hibernate RAR module directory (e.g. /hibernate/mappings...

I get the error:
SEVERE: Cannot create Hibernate session factory
net.sf.hibernate.MappingException: Resource: mappings/com/a/MyClass.hbm.xml not found
...

If I put the mappings JAR'd into my system classpath, then it finds the mapping there. However, this is obviously not acceptable.

Am I missing something here, does Hibernate really just not work with BEA Weblogic 8.1 SP 2, or what?

Thanks for any help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 23, 2004 3:24 pm 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
I have gotten some more information. This is starting to look like a mod needs to be done to Hibernate JCA:

In ManagedConnectionFactoryImpl, the addResource uses the classloader retrieved from Thread.currentThread().getContextClassLoader().

When I output this classloader, it is the sun.misc.Launcher$AppClassLoader class.

However, if I check getClass().getClassLoader(), it is the Weblogic GenericClassLoader (which is the proper classloader for the EAR).

I'm not sure if something can be modified in this class to support Weblogic and other app servers? I don't know if it's a problem with just WL or with other app servers as well.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 23, 2004 4:14 pm 
Beginner
Beginner

Joined: Fri Feb 20, 2004 6:15 pm
Posts: 38
I reported bug # HB-737 on this.

Thanks to open source, I was able to make the mod myself as a workaround for now.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 23, 2004 10:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Maybe a bug, maybe not. But typically what you need to do in an ear file is to utilize the manifest file's classpath entry. I've not played with deploying rar file inside the ear, but I know this is how it works for mixed war/ejb-jar ear files. Shared resources go into the root of the ear file; then each component in the ear needs a manifest classpath entry referencing those shared components.

This really is really a short-coming of J2EE itself. Pure wars files, for example, have a well defined way of loading resources into the classpath. Not so for shared resources inside an ear. It all has to be done manually through these manifest entries.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 24, 2004 2:46 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I will ask Adrian Brock for his opinion, he is the JCA expert at JBoss I think.


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