Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-1660

Error rendering error template when error occurs deeper than action level

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.3
    • None
    • None

    Description

      In my application, whenever I have an error deeper than the action level ( i.e. an exception thrown by one of my DAOs, Managers, or JDBC calls ), instead of the seeing the actual error, as rendered by error.ftl ( i have devMode enabled ),

      I get the following error from FreeMarker trying to render the template :

      HTTP Status 500 - Unable to show problem report: freemarker.core.NonStringException: Error on line 45, column 27 in org/apache/struts2/dispatcher/error.ftl Expecting a string, date or number here, Expression msg is instead a freemarker.ext.beans.SimpleMethodModel

      type Status report

      message Unable to show problem report: freemarker.core.NonStringException: Error on line 45, column 27 in org/apache/struts2/dispatcher/error.ftl Expecting a string, date or number here, Expression msg is instead a freemarker.ext.beans.SimpleMethodModel

      description The server encountered an internal error (Unable to show problem report: freemarker.core.NonStringException: Error on line 45, column 27 in org/apache/struts2/dispatcher/error.ftl Expecting a string, date or number here, Expression msg is instead a freemarker.ext.beans.SimpleMethodModel) that prevented it from fulfilling this request.

      The full stack trace is :

      freemarker.core.NonStringException: Error on line 45, column 27 in org/apache/struts2/dispatcher/error.ftl
      Expecting a string, date or number here, Expression msg is instead a freemarker.ext.beans.SimpleMethodModel
      at freemarker.core.Expression.getStringValue(Expression.java:126)
      at freemarker.core.Expression.getStringValue(Expression.java:93)
      at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:172)
      at freemarker.core.Environment.visit(Environment.java:351)
      at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.IfBlock.accept(IfBlock.java:82)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.MixedContent.accept(MixedContent.java:92)
      at freemarker.core.Environment.visit(Environment.java:196)
      at freemarker.core.Environment.process(Environment.java:176)
      at freemarker.template.Template.process(Template.java:231)
      at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:737)
      at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:514)
      at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:421)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
      at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:204)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
      at java.lang.Thread.run(Unknown Source)

      Attachments

        1. render.patch
          0.6 kB
          Aadi Deshpande

        Activity

          People

            mrdon Donald J. Brown
            cilquirm Aadi Deshpande
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: