• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting MissingResourceException calling getBundle()

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

-Rick
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try putting this file in the API-INF/classes folder and see if it works.
[ July 17, 2007: Message edited by: Amit M Tank ]
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, my bad, that was a typo.... I meant APP-INF/Classes
reply
    Bookmark Topic Watch Topic
  • New Topic