Jul 23, 2012

IntelliJ : java.util.ResourceBundle.throwMissingResourceException


java.util.MissingResourceException: Can't find bundle for base name voldemort
    at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1499)
When I run my program on IntellJ IDEA, this error message shown up on console window. Do I miss something? Yes, I know. It's a kind of class path thing. Here are my solutions.
1. Move properties under sr/main/java/
2. Write attributes on your codes.
3. Just do the following.
 Select root directory of your project.
 Right Click.
 Choose "Mark Directory at" to "Source Root".
 
Don't choose 1 or 2. Your reviewers would be happy to have a chance to give you a lot of feedback.
It's a secret that I selected 2 for a test. :)
Here is my code.
    private StoreClientFactory storeClientFactory() {
        Properties p = new Properties();
        ResourceBundle rb = ResourceBundle.getBundle(VOLDEMORT_PROPERTY);
        for(String key:rb.keySet()) {
            p.setProperty(key, rb.getString(key));
        }
        return new SocketStoreClientFactory(new ClientConfig(p));
    }

No comments: