Search code examples
javaspringspring-bootweblogic12c

JspTagException for load customMessage.property in weblogic & spring boot 2.0.0


I use java8 and weblogic 12.2.1.2 and spring-boot 2.0.0.Now i config myResourceBundleMessage as

@Configuration
public class ResouceBundleConfig {
    @Bean
    public MessageSource messageSource (){
        ReloadableResourceBundleMessageSource messageSourceResourceBundle=new ReloadableResourceBundleMessageSource();
        messageSourceResourceBundle.setBasenames("classPath:inheritanceMessage","classPath:publicMessage");
        messageSourceResourceBundle.setDefaultEncoding("UTF-8");
        return messageSourceResourceBundle;
    }
}

and create war file then deploy under weblogic. But i got this Error

    javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message fo und under code 'ui.org.formTitle' for locale 'en_US'. at 

weblogic.servlet.jsp.PageContextImpl.handlePageException(PageContextI mpl.java:415) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]

when i use this code under tomcat i don't have problem and run program as well. so i add in application.yml this code

spring:
  messages:
    basename: inheritanceMessage,publicMessage

but problem not resolved!

So any idea what's wrong here?


Solution

  • Two things:

    1. classPath:inheritanceMessage should be classpath:inheritanceMessage.
    2. Max your message source as @Primary. As spring will initialized a default message source, you need to override it.

      @Primary
      @Bean
      public MessageSource messageSource (){