Thomas Stemmer created DELTASPIKE-451:
-----------------------------------------
Summary: Using @ConfigProperty in an EAR File on JBoss 7 fails
Key: DELTASPIKE-451
URL: https://issues.apache.org/jira/browse/DELTASPIKE-451
Project: DeltaSpike
Issue Type: Bug
Components: Configuration
Affects Versions: 0.5
Environment: JBoss 6.1.1 EAP (JBoss AS 7.2.1) on Windows XP
Reporter: Thomas Stemmer
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
--
This message was sent by Atlassian JIRA
(v6.1#6144)