Announcement Announcement Module
No announcement yet.
MessageSource basename that points to utilityJar?!? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageSource basename that points to utilityJar?!?


    This is driving me nuts, anybody have any idea how to specify the basename of a ReloadableResourceBundleMessageSource to find a *.properties file that resides inside a utility jar included in the current WAR project.

    I have been trying this to no luck:

    <bean id="messageSource_log" class="">
    		<property name="basename" value="classpath:/it.mypackage.logMessages"/>
    I would ideally like to include the logMessages*.properties inside of the META-INF of the utility jar but not sure if that is possible. The utility jar is correctly imported into the WAR project and the WAR runs without problems. Any ideas? (BTW, always I get the exception that the messageSource cannot find the message code when i try to use this messageSource)

  • #2
    Have you tried classpath*:?


    • #3
      yes, no luck with this either:
      <property name="basename" value="classpath*:it.notariato.logMessages"/>


      • #4
        any other ideas ?


        • #5
          Originally posted by Sheikosheik View Post
          any other ideas ?

          Assuming that the file is called '', and that it is in the 'it.notariato'package, try...

          <property name="basename" value="classpath*:it/notariato/logMessages"/>
          I use a similar path in my current app and it works fine. You do also realise that a *.properties file that is embedded in a jar file is not updateable right? (Thus making the use of the reloadable MessageSource variant by the by.)

          To quote the Javadoc for ReloadableResourceBundleMessageSource:

          With a "classpath:" prefix, resources can still be loaded from the classpath, but "cacheSeconds" values other than "-1" (caching forever) will not work in this case.
          Maybe ResourceBundleMessageSource is more appropriate?



          • #6
            Thanks for the help Rick, but it still doesn't work for me! I am not sure if maybe I need to define the utility jar in the of the WAR project?? I setup the importation of the utility jar using the J2EE module dependecies part of the project properties of eclipse that will automatically includes the other project as a utility jar. I am starting to think that maybe debugging inside the eclipse IDE its not working because eclipse might not actually export the project as an actual jar at this point?

            Also, in regards to the reloadable versus regular messageSource, I do understand that the reloadable messageSource wont relaod anything, the reason I used it was because I read in one post in this forum that ReloadableMessageSource was supposed to be faster than the other one. However, I have tried both and neither work.

            I had hoped to not have another silly classpath issue after the Websphere log4j/commons logging fun, ugh.
            Last edited by Sheikosheik; Feb 18th, 2008, 09:40 AM.


            • #7
              Just for some information in the future that might help others, this is how I finally resolved the issue:

              <property name="basename" value="it.notariato.logMessages"/>
              With any type of classpath prefix it would always fail and never find the property files, this simple way it worked fine.