Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7073139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:53:37+00:00 2026-05-28T05:53:37+00:00

I need to load the i18n localization properties of my Spring web application as

  • 0

I need to load the i18n localization properties of my Spring web application as a ResourceBundle object in the context of a deployed WAR running on JBoss AS7.

The reason here is that I need to feed in a ResourceBundle object as a parameter to JasperReports to compile reports properly. The parameter “REPORT_RESOURCE_BUNDLE” is used by JasperReports to handle internationalization in the reports with the str() function or the $R{} expression binding. The only accepted type for this parameter is a ResourceBundle object, hence my situation.

I had it working at some point, but it seemed that JBoss was holding onto a stale version of the properties, which I believe was clarified by the fact that it could no longer locate the ResourceBundle using unmodified code after I did a clean, package, and redeploy on the project.

In Spring we have configured a MessageSource Bean as follows, that is able to successfully load and use the properties files as resource bundles:

@Bean 
public MessageSource messageSource() {
  ReloadableResourceBundleMessageSource ms = new ReloadableResourceBundleMessageSource();
  String[] basenames = {"/WEB-INF/classes/messages/i18n/core_messages",
                        "/WEB-INF/classes/messages/i18n/mui_messages"};
  ms.setBasenames(basenames);
  return ms;
}

My current implementation for fetching the ResourceBundle object is as follows:

public ResourceBundle getBeanResourceBundle() {
  Locale fromConfig = DEFAULT_LOCALE;

  //Resolve Locale from a configuration service

  ClassLoader cl = Thread.currentThread().getContextClassLoader();
  return ResourceBundle.getBundle("core_messages", fromConfig, cl);
}

It was having issues loading the class using this.getClassLoader() and then started working after I changed to load from the Thread.currentThread(). Yet now the clean:package:deploy has rendered this ineffective and I have reasonable information to suggest to me it stopped actually loading new “core_messages” ResourceBundle objects many deployments back because obvious key-value changes never appeared to change in the deployed application.

The structuring of the deployment is build through maven as follows:

Core module packages as a JAR that is a dependency for the FrontEnd modules that are packaged as WARs for JBoss deployment.

The code that has the services to load things like the ResourceBundle in the method above are in the Core module. The final WAR is one of the FrontEnd modules that is trying to resolve the files from its WEB-INF/classes/.. classpath.

What class loader do I need to access to load from the appropriate classpath?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:53:37+00:00Added an answer on May 28, 2026 at 5:53 am

    The MessageSourceResourceBundle class in Spring is an implementation of ResourceBundle that uses the MessageSource to feed its properties. It can be instantiated with a MessageSource object (Autowired) and a Locale. MessageSource already handles what I need in the applications and I just needed to grab a working ResourceBundle which it does as well with Locale.

    public ResourceBundle getBeanResourceBundle() {
      Locale fromConfig = DEFAULT_LOCALE;
    
      //Resolve Locale from a configuration service
    
      return new MessageSourceResourceBundle(ms, fromNodeConfig); //replace code in my question
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to load some properties into a Spring context from a location that
I need to load an image from a web in a simple Java stand
I need to load a variable number of javascript source files before running javascript
I need to load a web page, execute its JavaScript (and all js files
I need to load test a Vaadin application. I found this link explaining how
I need to load help files from my windows C# application and move/copy to
Following this blog article I enabled my application to load i18n messages from the
I need to load a bunch of things in the beginning of my application,
I need to load a Model in a component to save the Data of
I need to Load RVM into a shell session as a function , so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.