1 Reply Latest reply on Feb 27, 2012 12:34 PM by krehman

    ResourceBundle in JBoss 4.3 Vs ResourceBundle Jboss 5.1

    gabriel gomez Newbie

      Hi everyone.


      I´m currently starting development of a new project based on Jboss 5.1 and SEAM but since I’ve been a jboss-4.2.3.GA user for about two years now, i have lots of things that work on this version and want to migrate then to Jboss 5.1


      At this moment I’m having problems with a Custom resource bundle reader that reads resource bundles from different projects (on the same EAR) and that works perfectly on JB 4.2.3. but keeps throwing the same error on JB5.1.


      This is my current demo project structure



      -          War

      -          EJBProject1(Business Logic)

      -          EJBProject2 (utilitarian and commonly used classes)


      My custom resource bundle reader is inside EJBProject2 and is called from my WAR and/or EJBProject1.


      This is a test method I did to check the problem:


      public static String loadMessage(Object hostClass, String key) {

      //Get package location and append messages

      String path[] = StringUtils.split(hostClass.getClass().getPackage().toString() + ".messages", " ");

      //At this point path[1] has thdeclared pakage of the hostClass + messages so I call resourceBundle to get messages.properties

      return ResourceBundle.getBundle(path[1], FacesContext.getCurrentInstance().getViewRoot().getLocale()).getString(key);



      but everytime it gets called from my WAR o EJBProject1 I get the following exception.


      11:23:32,921 ERROR [STDERR] java.util.MissingResourceException: Can't find bundle for base name pe.gob.pcm.rufe.action.expediente.messages, locale en



      message.properties is located inside pe.gob.pcm.rufe.action.expediente (just an example path) inside my WAR but ResourceBundle.getBundle can’t find it.


      • If I move pe.gob.pcm.rufe.action.expediente.message.properties to EJBProject2 the error disappears
      • If I move my custom resource bundle to WAR or EJBProject1 and run the test, it works OK depending on where I’m doing the call.



      This type of behavior  has  led me to believe that Jboss 5.1 runs each project on a “separate classpath” and that is the reason why my custom resource bundle keeps giving me the same exception.


      Just for the record, the exact same test project works flawlessly on Jboss 4.2.3 (so the problema is not LOCALE based)


      So my question is: Is this “classpath” thing a Jboss 5.1 configuration issue I can fix? Could it be my project setup?


      Thanks in advance for any help you can provide and let me know if you need aditional information

        • 1. Re: ResourceBundle in JBoss 4.3 Vs ResourceBundle Jboss 5.1
          krehman Newbie

          Hi All,


          Sorry to bring up an old thread, however I am running into the exact same issue as Gabriel. I am trying to migrate from JBoss 4.2.3.GA to 5.1.0.GA and running into the issue where an exception is thrown:

          java.util.MissingResourceException: Can't find bundle for base name MessageConstants, locale fr_CA


          To confirm, this used to work fine in 4.2.3.GA. It seems like something is misconfigured in the project for JBoss 5.1.0.GA.


          Any help would be appreciated.