[ 
https://issues.apache.org/jira/browse/AXIS2-5231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13184919#comment-13184919
 ] 

Sagara Gunathunga  commented on AXIS2-5231:
-------------------------------------------

I think in above scenario use of ApplicationContextHolder is incorrect as you 
identified having a ApplicationContext per service is the correct way to do 
this. Your approach seems OK to me but it would be great if you can address 
following improvements as well.

1.) Above patch provides service level isolation for ApplicationContext but 
what if someone want to share a ApplicationContext per service group ( i.e - 
setting proposed parameter under <serviceGroup> instead of  under <service>) 
IMO to address this you have to use AxisServiceGroup  too.

2.) In proposed approach it is required to have 
SPRING_APPLICATION_CONTEXT_LOCATION parameter in addition to 
ServiceObjectSupplier parameter. I think it's possible to make 
SPRING_APPLICATION_CONTEXT_LOCATION parameter optional as follows.

  If the SPRING_APPLICATION_CONTEXT_LOCATION not percent it 's possible to 
assume ApplicationContext file available on 
"META-INF/<service-name>-application-context.xml". This will improve the 
usability and most of Spring based framework provide such  features.

Other than that I think it's useful to keep ApplicationContextHolder because it 
address some other use cases. As an example when Axis2 use as a web application 
(WAR) this can be useful. Sometimes ago I have mentioned one such use case here 
http://ssagara.blogspot.com/2009/05/acegi-spring-security-and-rampart.html.  

  
                
> Cannot deploy multiple spring service axis2 archives within a single axis2 
> instance
> -----------------------------------------------------------------------------------
>
>                 Key: AXIS2-5231
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5231
>             Project: Axis2
>          Issue Type: Bug
>    Affects Versions: 1.6.1
>            Reporter: Kishanthan Thangarajah
>             Fix For: 1.7.0
>
>         Attachments: deploy_multiple_spring_services.patch
>
>
> Current issue with adding multiple spring service is that when we add a 
> second service, the first one does not work or rather the deployment of the 
> second service breaks the first. This is because of the static nature of 
> spring ApplicationContext variable in ApplicationContextHolder class. Current 
> way of initializing spring framework for a service via a service class which 
> implements the ServiceLifeCycle interface. In this method only, the spring 
> application context is created with the applicationContext.xml file. The 
> beans defined in the context file will be defined in this context and the 
> context will be set to the static ApplicationContext variable of the 
> ApplicationContextHolder class. When a second service deployed the same 
> operations mentioned above will happen and finally the spring 
> ApplicationContext of the first service will get replaced by the second 
> service's ApplicationContext. So if you invoke the second service it works, 
> but when invoking the first service, it gives an error as no defined beans 
> are found.

--
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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to