Return-Path: Delivered-To: apmail-incubator-cxf-issues-archive@locus.apache.org Received: (qmail 55439 invoked from network); 12 Aug 2007 14:38:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Aug 2007 14:38:04 -0000 Received: (qmail 77857 invoked by uid 500); 12 Aug 2007 14:38:02 -0000 Delivered-To: apmail-incubator-cxf-issues-archive@incubator.apache.org Received: (qmail 77842 invoked by uid 500); 12 Aug 2007 14:38:02 -0000 Mailing-List: contact cxf-issues-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-issues@incubator.apache.org Received: (qmail 77833 invoked by uid 99); 12 Aug 2007 14:38:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Aug 2007 07:38:02 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Aug 2007 14:38:03 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5E9CE714191 for ; Sun, 12 Aug 2007 07:37:43 -0700 (PDT) Message-ID: <20986391.1186929463384.JavaMail.jira@brutus> Date: Sun, 12 Aug 2007 07:37:43 -0700 (PDT) From: "willem Jiang (JIRA)" To: cxf-issues@incubator.apache.org Subject: [jira] Resolved: (CXF-906) ClassCastException in CXFServlet.loadSpringBus when context initialization fails In-Reply-To: <3677972.1186858063231.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ 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.