According to Axis2 architecture it calls all registered deployers during the ConfigurationContext creation process, this is perfectly ok for both Axis2 standalone server and deploying Axis2 as a web application. But in Carbon servers we use Axis2 as a generic server building framework hence above behaviour is not accurate.
In Carbon servers, creation of ConfigurationContext does not implies server is ready to deploy artifacts in fact OSGi runtime manage loading required bundle/services etc. This leads to number of issues. 1. When a deployer deploy artifacts some of the OSGi services may not be loaded, hence special workarounds are required to handle these cases. 2. When a deployer deploy artifacts some of the server extensions may not be loaded by OSGi runtime this result into unexpected runtime behaviours. Example - In AS to extend container features it is possible to write ServletContainerInitializer[1] implementations, we already have such extensions to support WebSocket, ProtocolBuffer etc. but at the time of web applications get deploy there is no guarantee that all ServletContainerInitializer are loaded by the server this leads lot of unexpected runtime issues. 3. At the time of artifact deployment ConfigurationContext is not yet registered as OSGi service hence not possible to access ConfigurationContext from server extensions such as Tomcat LifecycleListener. *Solution* Decouple deployment from ConfigurationContext creation process and call artifact deployment in a later stage where ConfigurationContext and other services are available. 1.) For super tenant - Disable loadServices() logic from CarbonAxisConfigurator class. - Implement a ServerStartupObserver and call loadServices() logic from there. With this change it's possible to delay deployment till we load all services marked as "ListenerManager-RequiredServices" , as an example custom ServletContainerInitializer services can be marked as "ListenerManager-RequiredServices" this ensures those ServletContainerInitializers will be available at artifact deployment time. Note - "ListenerManager-RequiredServices" header is already available Carbon feature. 2.) For tenants - Disable loadServices() logic from TenantAxisConfigurator class. - Implement a Axis2ConfigurationContextObserver and call loadServices() logic from there. [1]- http://docs.oracle.com/javaee/6/api/javax/servlet/ServletContainerInitializer.html Thanks ! -- Sagara Gunathunga Senior Technical Lead; WSO2, Inc.; http://wso2.com V.P Apache Web Services; http://ws.apache.org/ Linkedin; http://www.linkedin.com/in/ssagara Blog ; http://ssagara.blogspot.com
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
