Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
0.5
-
None
-
None
-
JBoss 6.1.1 EAP (JBoss AS 7.2.1) on Windows XP
Description
I'm using @ConfigProperty for loading properties from a propertyfile. This works fine as long as I deploy the application as an WAR File. If I wrap the WAR in an EAR File the Properties won't get loaded. This is caused by the different classloaders for startup (EAR) and property access (WAR).
In Detail:
- The properties are loaded on EAR Startup with the EAR classloader
- The properties are put in the org.apache.deltaspike.core.api.config.ConfigResolver.configSources HashMap, the key is the EAR Classloader
- The properties are accessed in the WAR File, so the WAR classloader is used
- The ...ConfigResolver.getConfigSources() uses the WAR classloader as a key for the HashMap
- No properties are found because of the wrong key (WAR instead of EAR classloader)
Possible Solution by Mark Struberg from the mailinglist:
"We should walk up the parent ClassLoader chain like we do in BeanManagerProvider."
http://mail-archives.apache.org/mod_mbox/deltaspike-dev/201311.mbox/%3C1385476770.76979.YahooMailNeo%40web28902.mail.ir2.yahoo.com%3E