Hi Godwin,

Please use the getThreadLocalCarbonContext to acquire a
PriviledgedCarbonContext instance.

Thanks.
/Gayashan

On Tue, Sep 23, 2014 at 4:49 PM, Godwin Amila Shrimal <[email protected]>
wrote:

> Hi,
>
> I am trying to send a Cluster message and get a
> *java.lang.StackOverflowError* error in highlighted line in following
> code.
>
> public static void cleanTenantMaponWorkernodes(int tenantId)throws
> Exception {
>
> TenantDeleteClusterMessage clustermessage = new TenantDeleteClusterMessage(
> tenantId);
>
> *ConfigurationContextService configContextService =
> (ConfigurationContextService) PrivilegedCarbonContext*
>
> * .getCurrentContext().getOSGiService(*
>
> * ConfigurationContextService.class);*
>
> ConfigurationContext configContext = configContextService
> .getServerConfigContext();
>
> ClusteringAgent agent = configContext.getAxisConfiguration()
> .getClusteringAgent();
>
> try {
>
> if (agent != null) {
>
> agent.sendMessage(clustermessage, true);
>
> }
>
> } catch (ClusteringFault e) {
>
> log.error("Error occured while broadcasting TenantDeleteClusterMessage : "
>
> + e.getMessage());
>
> }
>
> }
>
>
> *Error Log*
>
> Caused by: java.lang.StackOverflowError
>
> at org.apache.catalina.connector.Request.doGetSession(Request.java:2837)
>
> at org.apache.catalina.connector.Request.getSession(Request.java:2316)
>
> at
> org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
>
> at
> javax.servlet.http.HttpServletRequestWrapper.getSession(HttpServletRequestWrapper.java:259)
>
> at
> org.eclipse.equinox.http.servlet.internal.HttpServletRequestAdaptor.getSession(HttpServletRequestAdaptor.java:146)
>
> at
> org.wso2.carbon.context.internal.CarbonContextDataHolder.getCurrentCarbonContextHolder(CarbonContextDataHolder.java:533)
>
> at
> org.wso2.carbon.context.internal.CarbonContextDataHolder.getCurrentCarbonContextHolder(CarbonContextDataHolder.java:568)
>
>  at
> org.wso2.carbon.context.internal.CarbonContextDataHolder.getClone(CarbonContextDataHolder.java:417)
>
>
> Can anyone help one this to resolve ?
>
>
> Thanks
> Godwin
>
>
> --
> *Godwin Amila Shrimal*
> Senior Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
>
> mobile: *+94772264165*
> linkedin: *http://lnkd.in/KUum6D <http://lnkd.in/KUum6D>*
> twitter: https://twitter.com/godwinamila
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
*Gayashan Amarasinghe*
Software Engineer | Platform TG
WSO2, Inc. | http://wso2.com
lean. enterprise. middleware

Mobile : +94718314517
Blog : gayashan-a.blogspot.com
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to