Tapestry 5
  1. Tapestry 5
  2. TAP5-1251

Spring integration should not assume the external context is successfully initialized

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.3
    • Component/s: tapestry-spring
    • Labels:
      None

      Description

      In SpringModuleDef , the following code assumes that the Spring context is successfully initialized:

      ConfigurableWebApplicationContext context = (ConfigurableWebApplicationContext) servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
      

      but the javadoc of that attribute states that "If the startup of the root context fails, this attribute can contain an exception or error as value. Use WebApplicationContextUtils for convenient lookup of the root WebApplicationContext. "

      The resulting error is

      Error Message: javax.servlet.ServletException: Filter [tapestryFilter]: could not be initialized
      Error Code: 500
      Target Servlet: /business/Main.jsp
      Error Stack:
      java.lang.ClassCastException: org.springframework.beans.factory.BeanCreationException incompatible with org.springframework.web.context.ConfigurableWebApplicationContext
           at org.apache.tapestry5.internal.spring.SpringModuleDef.locateExternalContext(SpringModuleDef.java:61)
           at org.apache.tapestry5.internal.spring.SpringModuleDef.<init>(SpringModuleDef.java:83)
           at org.apache.tapestry5.spring.TapestrySpringFilter.provideExtraModuleDefs(TapestrySpringFilter.java:34)
           at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:76) 
      

      The lookup should be ajusted to use WebApplicationContextUtils.

        Activity

        Robert Munteanu created issue -
        Robert Munteanu made changes -
        Field Original Value New Value
        Summary Spring integration should not assume the external context is successfully initalized Spring integration should not assume the external context is successfully initialized
        Original Estimate 0h [ 0 ]
        Remaining Estimate 0h [ 0 ]
        Description In SpringModuleDef , the following code assumes that the Spring context is successfully initialized:

        {code} ConfigurableWebApplicationContext context = (ConfigurableWebApplicationContext) servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
        {code}

         
        but the javadoc of that attribute states that "If the startup of the root context fails, this attribute can contain an exception or error as value. Use WebApplicationContextUtils for convenient lookup of the root WebApplicationContext. "

        The resulting error is

        {code}
        Error Message: javax.servlet.ServletException: Filter [tapestryFilter]: could not be initialized
        Error Code: 500
        Target Servlet: /business/Main.jsp
        Error Stack:
        java.lang.ClassCastException: org.springframework.beans.factory.BeanCreationException incompatible with org.springframework.web.context.ConfigurableWebApplicationContext
             at org.apache.tapestry5.internal.spring.SpringModuleDef.locateExternalContext(SpringModuleDef.java:61)
             at org.apache.tapestry5.internal.spring.SpringModuleDef.<init>(SpringModuleDef.java:83)
             at org.apache.tapestry5.spring.TapestrySpringFilter.provideExtraModuleDefs(TapestrySpringFilter.java:34)
             at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:76)
        {code}

        The lookup should be ajusted to use WebApplicationContextUtils.
        In SpringModuleDef , the following code assumes that the Spring context is successfully initialized:

        {code}ConfigurableWebApplicationContext context = (ConfigurableWebApplicationContext) servletContext.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
        {code}

         
        but the javadoc of that attribute states that "If the startup of the root context fails, this attribute can contain an exception or error as value. Use WebApplicationContextUtils for convenient lookup of the root WebApplicationContext. "

        The resulting error is

        {code}
        Error Message: javax.servlet.ServletException: Filter [tapestryFilter]: could not be initialized
        Error Code: 500
        Target Servlet: /business/Main.jsp
        Error Stack:
        java.lang.ClassCastException: org.springframework.beans.factory.BeanCreationException incompatible with org.springframework.web.context.ConfigurableWebApplicationContext
             at org.apache.tapestry5.internal.spring.SpringModuleDef.locateExternalContext(SpringModuleDef.java:61)
             at org.apache.tapestry5.internal.spring.SpringModuleDef.<init>(SpringModuleDef.java:83)
             at org.apache.tapestry5.spring.TapestrySpringFilter.provideExtraModuleDefs(TapestrySpringFilter.java:34)
             at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:76)
        {code}

        The lookup should be ajusted to use WebApplicationContextUtils.
        Howard M. Lewis Ship committed 1185424 (1 file)
        Reviews: none

        TAP5-1251: Spring integration should not assume the external context is successfully initialized

        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Howard M. Lewis Ship [ hlship ]
        Fix Version/s 5.3 [ 12316024 ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #580 (See https://builds.apache.org/job/tapestry-trunk-freestyle/580/)
        TAP5-1251: Spring integration should not assume the external context is successfully initialized

        hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185424
        Files :

        • /tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #580 (See https://builds.apache.org/job/tapestry-trunk-freestyle/580/ ) TAP5-1251 : Spring integration should not assume the external context is successfully initialized hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185424 Files : /tapestry/tapestry5/trunk/tapestry-spring/src/main/java/org/apache/tapestry5/internal/spring/SpringModuleDef.java

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Robert Munteanu
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development