Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
5.1.0.5
-
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.