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

  • MessageSource basename that points to utilityJar?!?

    So,

    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:

    Code:
    <bean id="messageSource_log" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    		<property name="basename" value="classpath:/it.mypackage.logMessages"/>
    	</bean>
    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*:?

    Comment


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

      Comment


      • #4
        any other ideas ?

        Comment


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

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

          Code:
          <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:

          Code:
          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?

          Cheers
          Rick

          Comment


          • #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 Manifest.mf 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, 10:40 AM.

            Comment


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

              Code:
              <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.

              Comment

              Working...
              X