You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (Resolved) (JIRA)" <ji...@apache.org> on 2012/04/09 22:33:17 UTC
[jira] [Resolved] (CXF-4127) CXFServlet should be reinitialized on
ContextRefreshedEvent
[ https://issues.apache.org/jira/browse/CXF-4127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Kulp resolved CXF-4127.
------------------------------
Resolution: Fixed
Fix Version/s: 2.6
2.5.3
Assignee: Daniel Kulp
> CXFServlet should be reinitialized on ContextRefreshedEvent
> -----------------------------------------------------------
>
> Key: CXF-4127
> URL: https://issues.apache.org/jira/browse/CXF-4127
> Project: CXF
> Issue Type: Bug
> Affects Versions: 2.4.7, 2.5.3
> Reporter: Jens Borgland
> Assignee: Daniel Kulp
> Fix For: 2.5.3, 2.6
>
>
> I have a web application that uses Spring and CXF and is deployed on Tomcat. The application is initialized using the {{org.springframework.web.context.ContextLoaderListener}}.
> With the fix for CXF-4094 I am now able to refresh the Spring context (like described below) without any exceptions but since the {{CXFServlet}} isn't created by Spring and doesn't listen for {{ContextRefreshedEvent}}, the {{Bus}} and the {{DestinationRegistry}} doesn't get reinitialized.
> I refresh the Spring context like this:
> {{((ConfigurableApplicationContext)applicationContext).refresh();}}
> I think the CXFServlet should implement {{ApplicationListener<ContextRefreshedEvent>}} and register itself as an application listener on the Spring context and reinitialize itself in the {{onApplicationEvent}} method.
> As an experiment I created a subclass to CXFServlet with the implementation of onApplicationEvent below (which seems to work). The real implementation could perhaps do a bit less work.
> {code:title=RefreshingCXFServlet.java|borderStyle=solid}
> @Override
> public void onApplicationEvent(ContextRefreshedEvent event) {
> destroy();
> setBus(null);
> try {
> super.init(m_sc);
> } catch (ServletException e) {
> throw new RuntimeException("Unable to reinitialize the CXFServlet", e);
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira