Hi Isuru,

Thanks and got the point.

On Tue, Sep 23, 2014 at 11:39 PM, Isuru Perera <[email protected]> wrote:

> We do not recommend to use getCurrentContext() method and the way it is
> executed leads to a recursive loop. That's why you are getting a
> StackOverflowError.
>
> Carbon Team,
>
> We need to deprecate getCurrentContext() method in next release.
>
> On Tue, Sep 23, 2014 at 5:41 PM, Godwin Amila Shrimal <[email protected]>
> wrote:
>
>> Hi Gayashan,
>>
>> Thanks a lot, it worked properly, BTW do u know any reason to give a
>> Stackoverflow on previous scenario ?
>>
>> On Tue, Sep 23, 2014 at 5:08 PM, Gayashan Amarasinghe <[email protected]>
>> wrote:
>>
>>> 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
>>>
>>
>>
>>
>> --
>> *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
>>
>>
>
>
> --
> Isuru Perera
> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> about.me/chrishantha
>



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

Reply via email to