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

PropertyFileUtils.getResourceBundle() fails in EAR

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.4
    • 0.5
    • Core
    • None
    • JBoss AS 7.2.0.Final (EAP 6.1.0.Alpha1)

    Description

      The method PropertyFileUtils.getResourceBundle(String bundleName, Locale locale) doesn't work correctly in an EAR.

      I have the DS core JARs in the EAR /lib and I'm trying to use the JsfMessage feature in one of my WARs. Because getResourceBundle() calls ResourceBundle.getBundle(String bundleName, Locale locale), Java attempts to load the resource bundle using the classloader that was used to load PropertyFileUtils, which is the EAR's classloader. The property files are in the WAR, so Java can't find them.

      Changing

      return ResourceBundle.getBundle(bundleName, locale);

      to

      return ResourceBundle.getBundle(bundleName, locale, Thread.currentThread().getContextClassLoader());

      fixes the problem.

      Attachments

        Issue Links

          Activity

            People

              struberg Mark Struberg
              rcd Richard DiCroce
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: