Can't find bundle for base name 的解决方法
来源:互联网 发布:c语言发送post请求 编辑:程序博客网 时间:2024/06/05 14:59
打包后找不到配置文件
将项目的包名从dmc.ihangmei.com 变更为com.ihangmei.heartbeat后,原先能能够获取的配置信息也不能获取了。
D:\Users\zp\git\heartbeatProject\target>
D:\Users\zp\git\heartbeatProject\target>java -jar 1231-jar-with-dependencies.jar
2017-07-14 17:11:34 Heartbeat init.0: Can't find bundle for base name config/device, locale zh_CN
java.util.MissingResourceException: Can't find bundle for base name config/device, locale zh_CN
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:773)
at com.ihangmei.heartbeat.Heartbeat.initDevConfig(Heartbeat.java:316)
at com.ihangmei.heartbeat.Heartbeat.submain(Heartbeat.java:116)
at com.ihangmei.heartbeat.Heartbeat.main(Heartbeat.java:105)
代码如下:
网上查找资料,如下:
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:576)
You know Java is looking for a properties file in a specific locale. You may be baffled why java keeps complaining it can't find a properties file that is right there. A few things to keep in mind when debugging this type of errors:
1. These resource properties files are loaded by classloader, similar to java classes. So you need to include them in your runtime classpath.
2. These resources have fully-qualified-resource-name, similar to a fully-qualified-class-name, excerpt you can't import a resource into your java source file. Why? because its name takes the form of a string.
3. ResourceBundle.getBundle("config") tells the classloader to load a resource named "config" with default package (that is, no package). It does NOT mean a resource in the current package that has the referencing class.
4. ResourceBundle.getBundle("com.cheng.scrap.config") tells the classloader to load a resource named "config" with package "com.cheng.scrap." Its fully-qualified-resource-name is "com.cheng.scrap.config"
修改代码,重新指定其详细地址。变为如下,问题解决。
ResourceBundle resourceBundle = ResourceBundle.getBundle("com.ihangmei.heartbeat.config.device");
阅读全文
0 0
- Can't find bundle for base name 的解决方法
- java.util.MissingResourceException: Can't find bundle for base name
- Can't find bundle for base name configure, locale zh_CN
- java.util.MissingResourceException: Can't find bundle for base name
- Can't find bundle for base name config, locale en_US
- Can't find bundle for base name Message, locale zh_CN
- Can't find bundle for base name configure, locale zh_CN
- Can't find bundle for base name MessageResource, locale zh_CN
- 解决方法:java.util.MissingResourceException Can't find bundle for base name
- ResourceBundle.getBundle 报错 Can't find bundle for base name 解决方法
- 解决方法:java.util.MissingResourceException Can't find bundle for base name
- Can't find bundle for base name DBInfo, locale zh_CN解决方法
- 在eclipse下运行或调试Ofbiz的出现Can't find bundle for base name cache, locale zh_CN错误的解决方法
- Notes for "java.util.MissingResourceException Can't find bundle for base name"
- Solve java.util.MissingResourceException: Can't find bundle for base name com...config, locale zh_CN
- java.util.MissingResourceException: Can't find bundle for base name i18n, locale zh_CN
- JSF java.util.MissingResourceException: Can't find bundle for base name javax.faces.Messages, locale zh_CN
- 解决 java.util.MissingResourceException: Can't find bundle for base name com...config, locale zh_CN 错误
- HDU-3191 How Many Paths Are There(有向图次短路条数)
- Hadoop伪分布式环境搭建
- POJ 1542 Atlantis (线段树+扫描线+离散化)
- Android自定义可移动悬浮窗,WindowManager.LayoutParams一些属性介绍
- 在Android Studio中使用Jni
- Can't find bundle for base name 的解决方法
- Linux普通用户无法浏览ROOT等文件夹问题解决
- 严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis
- 阿里云服务器部署Nodejs
- C++学习小记
- 为2D游戏生成平滑地形的最简单的方法是什么?
- 94. Binary Tree Inorder Traversal
- FatFsVersion0.01源码分析
- 单链表的逆序和倒数第n个节点