Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find bundle for base name /Bundle, locale en_US

Tags:

java

jsf

I'm using a library that has a dependency on JSF.

When I try to run my project, it show following exception massage..

java.util.MissingResourceException: Can't find bundle for base name /Bundle, locale en_US at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250) at java.util.ResourceBundle.getBundle(ResourceBundle.java:705) 

Any ideas ?

like image 664
Md. Mahabubur Rahman Avatar asked Oct 20 '12 07:10

Md. Mahabubur Rahman


People also ask

Can t find bundle for base name in eclipse?

This problem is usually happened in the Eclipse IDE environment, where it doesn't copy the “. properties” file extension by default. So, just make sure the properties file is existed in the run time “classes” folder and can be located by your web application.

What is resource bundle locale?

Commonly used methods of ResourceBundle class public static ResourceBundle getBundle(String basename, Locale locale) returns the instance of the ResourceBundle class for the specified locale. public String getString(String key) returns the value for the corresponding key from this resource bundle.

How do you deal with MissingResourceException?

To fix the MissingResourceException , it should be ensured that any resource required by the program exists with the correct name and at the right location. Any values attempted to be retrieved from a resource file using a key should exist with the right key.

How do I use ResourceBundle getBundle?

getBundle. Gets a resource bundle using the specified base name, locale, and class loader. This method behaves the same as calling getBundle(String, Locale, ClassLoader, Control) passing a default instance of ResourceBundle. Control .


1 Answers

The exception is telling that a Bundle_en_US.properties, or Bundle_en.properties, or at least Bundle.properties file is expected in the root of the classpath, but there is actually none.

Make sure that at least one of the mentioned files is present in the root of the classpath. Or, make sure that you provide the proper bundle name. For example, if the bundle files are actually been placed in the package com.example.i18n, then you need to pass com.example.i18n.Bundle as bundle name instead of Bundle.

In case you're using Eclipse "Dynamic Web Project", the classpath root is represented by src folder, there where all your Java packages are. In case you're using a Maven project, the classpath root for resource files is represented by src/main/resources folder.

See also:

  • Maven and JSF webapp structure, where exactly to put JSF resources
like image 61
BalusC Avatar answered Oct 04 '22 04:10

BalusC