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: addJar (vs. addResource) broken inside of servlet container
PostPosted: Wed Jan 28, 2004 2:45 am 
Regular
Regular

Joined: Wed Dec 31, 2003 4:26 am
Posts: 108
Location: Berkeley, CA
I've noticed trouble using the

Code:
<mapping jar="some-jar-file.jar" />

inside of a servlet container (e.g., Tomcat). Using a jar this way works fine for 2-tier apps: the file system resolves the resource request. The

Code:
<mapping resource="some-mapping-file.hbm.xml" />

works fine in either place. Digging into the source, I think I see why:

In net.sf.hibernate.cfg.Configuration there is a now-deprecated
Code:
addJar(String resource)
. Does anyone know why this was deprecated and (re-?)written to call the file-based addJar? The corresponding addResource(String path) is much more robust: converting the specifed path into an InputStream, which is supported by both the file system and servlet containers.

Since there is a JarInputStream in java.util.jar I am curious, as a Hibernate newbie, why that is not used in the implementation of the addJar(String path) method.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2004 4:44 pm 
Regular
Regular

Joined: Wed Dec 31, 2003 4:26 am
Posts: 108
Location: Berkeley, CA
The problem is in the addJar(String resource) method of configuration. I found a way to override this method that works for jar files (or zip files for that matter) read from a stream and hence properly resolved regardless of whether inside a container or not.

Problem solved. If others are interested let me know and I'll post the code.


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.