users@glassfish.java.net

Re: accessing properties file across jars

From: Sivakumar Thyagarajan <Sivakumar.Thyagarajan_at_Sun.COM>
Date: Mon, 29 Oct 2007 17:59:51 +0530

> How can I get the classes in my-commons.jar see the properties file in my-ejbapp.jar. I know other libraries such log4j etc do this all the time.

To answer the other question, the application classloader is set as the thread
context classloader and you could use the ThreadContext ClassLoader to get the
resource stream to a resource bundled with the EJB app. However, this is an
implementation detail, and depending on this in your my-commons.jar, would
render your application non-portable across appservers.

Thanks
--Siva.

glassfish_at_javadesktop.org wrote:
> To load the properties file, do you use something like ClassLoader.getResourceAsStream()?
>
> This happens because of different class-loaders loading resources from different locations. In
> the case it works, the class-loader that loads your ejb components loads the properties file as
> well. In the case where it does not work, the class-loaders are different.
>
> Regards,
> Kedar
> [Message sent by forum member 'km' (km)]
>
> http://forums.java.net/jive/thread.jspa?messageID=242504
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>