Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

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

Avatar

Former Community Member
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
2 Replies

Avatar

Former Community Member

Same problem , can't load hibernate.cfg.xml in component.jar

Avatar

Level 4

Hi!

Use full class name, following syntax works well:

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

--- Jaroslav