Hi, folks:

My knowledge of permissions & classloaders is weak, so I'm sure this is an
easy question for the experts here (but it's driving me crazy! :-)  :

I'm trying to use a library (fyi, xalan) that, as part of its
initialization, loads a couple of ".properties" files out of its own jar
(using getResourceAsStream).  It works fine outside the context of jboss;
however, when I use the library inside an ejbean, the library fails at
getting these files.

Test 1: After searching through the archives here, I figured it must be
related to the fact that ejbeans have a special classloader that limits
their functionality (like file i/o).  So, I tried following the example of
providing the library as a service, using ServiceMBeanSupport, initializing
the library and binding it using JNDI for my  beans to use.  I include both
the library jar and the mbean jar in the "ARCHIVE" list in the MLET tag in
jboss.conf.   The MLet system works fine, and my bean gets access to the
library, but the library's call to getResourceAsStream still fails.

Test 2: Still wondering if there's something strange about calling the
library from within my bean, I tried initializing the library right in the
"initService" method of my ServiceMBeanSupport subclass.  Still, the
getResourceAsStream call fails.

Test 3:  Here's what really perplexes me.  Just for fun, right at the same
place in the "initService" method, I manually did a
"getClass().getResourceAsStream()" to access that properties file, and sure
enough it finds it!!  And yet, the very next call to the library to
initialize itself fails when the library can't access the file.  Clearly the
properties file is in the jar, and it can be reached, but something must be
different about the library's classloader, since the library can't access
it.

So, my question is, why can't my library get access to its own resources
inside its own jar, and what's different about the access permission between
my manual call to getResourceAsStream in the "initService" method, and my
library's call to getResource immediately thereafter?

My thanks in advance!

  Roger Spreen





--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to