Debugging OfBiz in Eclipse gives MissingResourceException

281 views Asked by At

I downloaded the OfBiz Java application and the following line throws an MissingResourceException:

ResourceBundle res = ResourceBundle.getBundle(settingsResourceName);

The value of settingsResourceName is "cache", but I cannot find any file called cache.properties or cache_en.properties.

Where should I be looking? I'm new to Java. All my research on SO says there should be such a file.

I imported OfBiz in Eclipse using the Import menu option and selecting Existing Project from File System (I'm not in front of my dev machine so I don't remember the exact wording). But I chose the root folder of the downloaded OfBiz.

I then added the appropriate VM Arguments in the Run Configuration to get it to run properly at least. And that's it, on the first Run I got the above error. I think it has to do with a missing class path but I don't know what to add to class path.

Here is the stack trace:

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

UPDATE: My mistake, I found two files both called cache.properties in the following folders:

ofbiz-trunk/build/resources/main

ofbiz-trunk/framework/base/config

But these are folders, not packages. I tried putting them in the .classpath but that did not work, I still kept getting the same error.

1

There are 1 answers

0
Ray On BEST ANSWER

As suspected, I knew it was because of a missing reference to a class path. After looking at a section on this page: http://www.opensourcestrategies.com/ofbiz/ofbiz_eclipse.php, I learned that I was supposed to go to the Java Build Path and in the Libraries tab, click on Add Class Folder, then point that to ofbiz-trunk/framework/base/config. Which is where I have one of the cache.properties files.