我下载了OfBiz Java应用程序,以下行抛出了一个MissingResourceException:
JToken token = obj.SelectToken("$.results[?(@.paramName == 'OutputPolyline')]['value']");
var paths = JToken.Parse(token.ToString().Trim('#')).SelectToken("paths");
settingsResourceName的值是“cache”,但我找不到任何名为cache.properties或cache_en.properties的文件。
我应该在哪儿看?我是Java的新手。我对SO的所有研究都说应该有这样一个文件。
我使用Import菜单选项在Eclipse中导入OfBiz并从文件系统中选择Existing Project(我不在我的开发机器前面,所以我不记得确切的措辞)。但是我选择了下载的OfBiz的根文件夹。
然后,我在运行配置中添加了适当的VM参数,以使其至少正常运行。就是这样,在第一次运行中我得到了上述错误。我认为这与缺少的类路径有关,但我不知道要添加什么类路径。
这是堆栈跟踪:
ResourceBundle res = ResourceBundle.getBundle(settingsResourceName);
更新: 我的错误,我在以下文件夹中找到了两个名为 cache.properties 的文件:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.ofbiz.base.util.Debug.<clinit>(Debug.java:68)
at org.apache.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:61)
at org.apache.ofbiz.base.start.StartupControlPanel.loadStartupLoaders(StartupControlPanel.java:202)
at org.apache.ofbiz.base.start.StartupControlPanel.start(StartupControlPanel.java:69)
at org.apache.ofbiz.base.start.Start.main(Start.java:84)
Caused by: java.util.MissingResourceException: Can't find bundle for base name cache, locale en
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 org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:174)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:170)
at org.apache.ofbiz.base.util.cache.UtilCache.setPropertiesParams(UtilCache.java:166)
at org.apache.ofbiz.base.util.cache.UtilCache.<init>(UtilCache.java:124)
at org.apache.ofbiz.base.util.cache.UtilCache.createUtilCache(UtilCache.java:769)
at org.apache.ofbiz.base.util.UtilProperties.<clinit>(UtilProperties.java:75)
... 5 more
但这些是文件夹,而不是包。我尝试将它们放在.classpath中但是没有用,我仍然遇到同样的错误。
答案 0 :(得分:0)
如所怀疑的那样,我知道这是因为缺少对类路径的引用。看了这个页面上的一节:http://www.opensourcestrategies.com/ofbiz/ofbiz_eclipse.php,我了解到我应该去Java Build Path,在Libraries选项卡中,单击Add Class Folder,然后指向 ofbiz-trunk /框架/碱/配置即可。这是我有一个cache.properties文件的地方。