Highlighted

Reading property file from within Component's jar file- LiveCycle Classloader problem

Avatar

Guest

16-07-2008

Hi,



I have made component that uses libraries and properties files. I packaged it in jar and deployed it successfully into the LiveCycle server (Jboss Turnkey installation) using workbench.I made process,forms and get my form to invoke my component's service successfully. Everything is working fine except that I am getting problem when my service is reading the property file that I include at root of the jar file of component.

I am using following code to read the property file which is not working:



b Thread.currentThread().getContextClassLoader().getResourceAsStream(PROPERTIES_FILE);



However When I use following code then it get worked:



b this.getClass().getClassLoader().getResourceAsStream(PROPERTIES_FILE);



I think there this is due to the reason that LiveCycle ClassLoader might have different classpath.



I am stuck at this error as I am using third party APIs like hibernate that uses the first one methodology and I don't want to make changes into third party source codes to just make them run.



I would very thankful to you if you could provide help.



Thanks and Regards

Imam Raza

Senior Architect

Folio3 pvt Ltd

www.folio3.com

Replies

Highlighted

Jaroslav_Pavlic

15-09-2011

Hi!

Use full class name, following syntax works well:

InputStream is = cz.livecycle.MyClass.class.getResourceAsStream("/default.properties");

--- Jaroslav