Announcement Announcement Module
Collapse
No announcement yet.
ClassCastException when using message resources Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ClassCastException when using message resources

    This seems to happen only on redeploy in JBoss 4.0.1 with spring-1.2.1. If our jsps starts using the jstl <fmt:message> tags (and we configure a messageSource in the spring.xml file), we will get the following exception whenever we redeploy the app and access the jsps. It will not happen if we remove the web app, stop jboss, start again and deploy the web app for the first time. This really makes development slow if we can't redeploy. The exception is below, anyone has any idea whats going wrong here?

    org.apache.jasper.JasperException
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:372)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi ew.java:97)
    org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:928)
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:705)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:625)
    org.springframework.web.servlet.FrameworkServlet.s erviceWrapper(FrameworkServlet.java:386)
    org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:346)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:697)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:75)

    root cause

    java.lang.ClassCastException
    org.apache.taglibs.standard.tag.common.fmt.BundleS upport.getLocalizationContext(BundleSupport.java:1 34)
    org.apache.taglibs.standard.tag.common.fmt.Message Support.doEndTag(MessageSupport.java:152)
    org.apache.jsp.WEB_002dINF.views.hello_jsp._jspx_m eth_fmt_message_0(hello_jsp.java:102)
    org.apache.jsp.WEB_002dINF.views.hello_jsp._jspSer vice(hello_jsp.java:69)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    org.springframework.web.servlet.view.InternalResou rceView.renderMergedOutputModel(InternalResourceVi ew.java:97)
    org.springframework.web.servlet.view.AbstractView. render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet. render(DispatcherServlet.java:928)
    org.springframework.web.servlet.DispatcherServlet. doDispatch(DispatcherServlet.java:705)
    org.springframework.web.servlet.DispatcherServlet. doService(DispatcherServlet.java:625)
    org.springframework.web.servlet.FrameworkServlet.s erviceWrapper(FrameworkServlet.java:386)
    org.springframework.web.servlet.FrameworkServlet.d oGet(FrameworkServlet.java:346)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:697)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:810)
    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doF ilter(ReplyHeaderFilter.java:75)

  • #2
    some leads

    Well, after spending time on this, we kinda narrowed down the problem..

    First off, our jboss server has one other ear deployed using spring (older versions actually) and has the spring lib inside the ear. We though this might be causing the problems so we removed the ears (just for testing purposes, but we cannot really removed it nor upgrade the spring libs inside as it is not ours). And lo and behold the redeploy problem does not happen. (This is not good... spring should work well even if older versions are deployed on seperate apps...we cant really remove the 3rd party ear)

    But just for the sake of it, we decided to move the spring lib (1.2.1) in our test web app's war file (inside the WEB-INF/lib folder) into jboss's server/default/lib so it is shared by that server instance. Now the server has no apps deployed (the 3rd party ear we removed and havent reinstall) other that our test web app. And the redeploy error occurs!!.

    So far we can only speculate 2 things, either JBoss's class loader has a bug in it or spring's messageSource has a bug? (no errors if we dont use the messageSource in spring, but that is unacceptable for a i18n app). This is all running on JBoss 4.0.1 and spring 1.2.1, our test web app is basically the one from the Spring MVC step-by-step tutorial...

    Someone please help, we just convinced management to use spring MVC instead of struts and now we run into this problem... if we cant solve this soon, we'll have to come clean and revert back to struts...

    Comment


    • #3
      Jboss

      Well looks like a jboss class loading problems, we tried changing some of the class loader settings in the jboss-service.xml but didnt really solve the problem, in one setting it couldn't even find the jstl classes when it is plainly inside the lib folder of our webapp along with spring...

      we downloaded jboss 4.0.2 and it works right out of the box. what a lively forum, feels like private blogging...

      Comment

      Working...
      X