I have an EJB jar file that is deployed as part of an application EAR. I am deploying to Weblogic 8.1. When I call ResourceBundle.getBundle("EJBResources") from one of my EJB classes, I get a MissingResourceException:
java.util.MissingResourceException: Can't find bundle for base name EjbResources, locale en_US
The EJBResources.properties file is in the root of my EJB jar file. I have also tried calling getBundle passing it this.getClass().getClassloader() so ensure that the classloader that loaded the EJB class would be used to find the resources. However, that failed with the same exception.
I have tried putting the properties file in a package, changing the argument to getBundle to "com.myco.EJBResources", but this fails too.
The exact same code works fine on Sun Application Server. Any ideas what's wrong? Does this version of Weblogic have a classloader/bundle bug?
I think it should be APP-INF/classes. Alternatively, archive the property file(s) into a JAR file and place it in the APP-INF/lib directory. Either solution should work because the application classloader (from WebLogic Server 8.1 onwards) looks in APP-INF/classes and then APP-INF/lib.