Here's another issues that we are facing while migrating our application from current production environment to the new data center environment (see details below)
Here we have a third party jar file with the following structure (check the image - pardon me hiding some details)
This class has the code to load the database properties from a ResourceBundle (db.properties). Here is the code rendered out by Cavaj:
private static ResourceBundle getDBProperties() { if(dbProperties == null) { dbProperties = ResourceBundle.getBundle("db"); } return dbProperties; }
This application is working fine on the current environment. But somehow when we move the application to the new environment we get a "MissingResourceException" (see below):
Caused by: java.util.MissingResourceException: Can't find bundle for base name db, locale en_US at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:863) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:832) at java.util.ResourceBundle.getBundle(ResourceBundle.java:576) at com.myco.wo.vs.util.OrderLovUtilities.getDBProperties(OrderLovUtilities.java:195)
We tried following workarounds but none worked:
Please suggest on what could be wrong here. And what can we do to get it working :)
Note: File db.properties is located under the WEB-INF/classes directory. Also we tried putting it on the above mentioned locations but to no avail.
Regards,
- Ashish
Try to change classloader ordering in settings of your ent. application in the admin console (from PARENT_FIRST
to PARENT_LAST
) on both EAR and WAR levels.
It seems to me that 3rd party class (com.myco.wo.vs.util.OrderLovUtilities
) is not loaded from your jar file in WEB-INF/lib, but it is rather comes from some other location on the server. Its classloader then does not see the property file.
If that is the issue, changing the classloader ordering should cause the expected copy of the class to load.
Also, the classloader viewer in the admin console can put some light on that.