[
https://issues.apache.org/jira/browse/CXF-906?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
willem Jiang resolved CXF-906.
------------------------------
Resolution: Fixed
Fix Version/s: 2.1
The patch code has been applied into the SVN
> ClassCastException in CXFServlet.loadSpringBus when context initialization
> fails
> --------------------------------------------------------------------------------
>
> Key: CXF-906
> URL: https://issues.apache.org/jira/browse/CXF-906
> Project: CXF
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0
> Environment: using Spring Framework 2.1 m2
> Reporter: Karl Goldstein
> Assignee: willem Jiang
> Priority: Minor
> Fix For: 2.1
>
>
> CXFServlet.java line 136 obtains the Spring application context from the
> servlet context:
> if (ctx == null) {
> ctx = (ApplicationContext)svCtx
>
> .getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
> }
> If the Spring application context failed to load however, Spring (somewhat
> inexplicably) sets this attribute to be the exception rather than the
> context. See org/springframework/web/context/ContextLoader.java line 202:
> catch (RuntimeException ex) {
> logger.error("Context initialization failed", ex);
>
> servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
> ex);
> throw ex;
> }
> To avoid repeated ClassCastExceptions that obscure the underlying problem
> with the Spring application context, CXFServlet should check the type of the
> attribute before attempting to cast to ApplicationContext:
> if (ctx == null) {
> Object ctxObject = svCtx
>
> .getAttribute("org.springframework.web.context.WebApplicationContext.ROOT");
> if (ctxObject instanceof ApplicationContext) {
> ctx = (ApplicationContext) ctxObject;
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.