You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ian van der Neut <iv...@gmail.com> on 2004/10/18 11:38:12 UTC

Locale problem: can't find bundle

Hello all,

I'm getting the following error when I want to change the language of
my webapp. I searched the archives and google, but can't really find
anything that helps me. I get the following error:

javax.servlet.ServletException: Can't find bundle for base name
application, locale en_US

I have the following line in struts-config.xml:

	    <message-resources parameter="java.resources.application" />

There are in /mywebapp/WEB-INF/classes/java/resources the following files:
application.properties
application_en.properties (exact copy of application.properties)
application_nl.properties

The code that generates the error is:

public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws
IOException, ServletException {
		ResourceBundle bundle = ResourceBundle.getBundle("application");

Thank you for any help.

Ian.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Locale problem: can't find bundle

Posted by Craig McClanahan <cr...@gmail.com>.
On Mon, 18 Oct 2004 11:38:12 +0200, Ian van der Neut <iv...@gmail.com> wrote:

>                 ResourceBundle bundle = ResourceBundle.getBundle("application");

Change this to:

  ResourceBundle bundle =
ResourceBundle.getBundle("java.resources.application");

since you're required to specify the fully qualified class name here.

However, using "java" at the top level package name is going to cause
you a different difficulty -- many servlet containers will prohibit
loading classes or resources under that package name, because it could
be an attempt to replace a standard Java class and subvert the
behavior of the JVM.  You'd be better off putting your resource files
in the same Java package that your application classes are in, or in a
"resources" subpackage under that package.

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org