ResourceBundle MissingResourceException Linux 特定密钥
我在迭代键数组并调用资源包上的 getString() 方法时遇到了这个问题。我的包中有我需要的所有映射,但由于某种原因,其中一个资源将不会被获取。这只是 Linux Ubunthu 9 中的问题。它适用于 Windows。它找到所有资源,直到我的“项目”资源被正确映射。如上所述,我在机器人操作系统上使用相同的 jar。除了这把钥匙之外,我的所有资源都可以使用。我尝试更改密钥和此资源,但它不断抛出 MissingResourceException。我的类路径是正确的,否则我的其他键将无法工作。我不知道是什么原因造成的。我也尝试过重新订购我的捆绑包 - 没有运气。
任何意见将不胜感激。
String cols = new String[] {"name", "actor" , "requestor", "electronicFolder", "item", "dueOn", "finalOccurrenceOn"};
ResourceBundle rb = ResourceBundle.getBundle("application");
for (int i=0; i<cols.length; i++) {
if (rb==null) {
out.print("null");
} else {
try {
out.print(" " + rb.getString(cols[i]) + " : ");
} catch (MissingResourceException ee) {
ee.printStackTrace();
}
}
}
如上所述,在 Windows 中工作正常,但在 Linnux Ubunthu 中项目失败。这实在是一个烦恼。
I have been having this issue in iterating through an array of keys and calling the getString() method on the resource bundle. I have all the mappings I need in my bundle and for some reason one of the resource will not be fetched. This is only an issue in Linux Ubunthu 9. It works in Windows. It finds all the resources up until my "item" resource which is mapped correctly. As stated above I use the same jar on bot os's. All my resources work except this single key. I have tried changing the key and this resource, but it keeps throwing the MissingResourceException. My classpath is correct otherwise my other keys would not function. I have no idea what could be causing this. I have also tried reordering my bundle - no luck.
Any input would be appreciated.
String cols = new String[] {"name", "actor" , "requestor", "electronicFolder", "item", "dueOn", "finalOccurrenceOn"};
ResourceBundle rb = ResourceBundle.getBundle("application");
for (int i=0; i<cols.length; i++) {
if (rb==null) {
out.print("null");
} else {
try {
out.print(" " + rb.getString(cols[i]) + " : ");
} catch (MissingResourceException ee) {
ee.printStackTrace();
}
}
}
As stated above works perfectly in Windows, fails on item in Linnux Ubunthu. This is really an annoyance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现这在我的开发环境中可以工作,但不能作为打包的 EAR。问题是包含的 jsp 使用了 bean 标签。我删除了这个引用并利用我们的自定义标签(类似于 bean 标签)并且它起作用了。
I found that this was working in my dev env, but not as a packaged EAR. The problem was that the included jsp utilized a bean tag. I removed this reference and utilize our custom tag similar to the bean tag and it worked.