Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-451

Using @ConfigProperty in an EAR File on JBoss 7 fails

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 0.5
    • None
    • Configuration
    • 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

      Attachments

        Activity

          People

            struberg Mark Struberg
            T. Thomas Stemmer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: