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

后端 未结 12 917
走了就别回头了
走了就别回头了 2020-12-05 09:22

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.MissingResourceExce         


        
相关标签:
12条回答
  • 2020-12-05 10:06

    In my case the problem was using the language tag "en_US" in Locale.forLanguageTag(..) instead of "en-US" - use a dash instead of underline!

    Also use Locale.forLanguageTag("en-US") instead of new Locale("en_US") or new Locale("en_US") to define a language ("en") with a region ("US") - but new Locale("en") works.

    0 讨论(0)
  • 2020-12-05 10:07

    The problem must be that the resource-bunde > base-name attribute at the faces-config.xml file has a different path to your properties. This happened to me on the firstcup Java EE tutorial, I gave a different package name on then project creation and then Glassfish was unable to find the properties folder which is on "firstcup.web".

    I hope it helps.

    0 讨论(0)
  • 2020-12-05 10:08

    maven-tomcat-plugin

    If you start the Project using the maven-tomcat-plugin / maven-tomcat7-plugin, you must place the Bundle.properties, or even the Resource.properties in src/main/webapp/WEB-INF/classes. Dont ask why, its because how the plugin fake a tomcat.

    0 讨论(0)
  • 2020-12-05 10:08

    I had the same problem using Netbeans. I went to the project folder and copied the properties file. I think clicked "build" and then "classes." I added the properties file in that folder. That solved my problem.

    0 讨论(0)
  • 2020-12-05 10:11

    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
    0 讨论(0)
  • 2020-12-05 10:13

    If you are running the .java file in Eclipse you need to add the resource path in the build path . after that you will not see this error

    0 讨论(0)
提交回复
热议问题