This issue happens because of the way we retrieve tenant id from message
context. After getting it from thread local carbon context everything
worked as expected. Thanks azeez for your help to sort this out.

PrivilegedCarbonContext.getCurrentContext(messageContext).getTenantDomain()

Changed as

PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain()


Thanks
Sanjeewa

On Tue, May 14, 2013 at 10:20 AM, Sanjeewa Malalgoda <[email protected]>wrote:

> Any update on this please.
>
>
> On Mon, May 13, 2013 at 6:58 PM, Sanjeewa Malalgoda <[email protected]>wrote:
>
>> HI All,
>> In api manager publisher we publish APIs to gateway node(separate API
>> manager node). After we logged in to API publisher node we can create new
>> API and publish it to gateway. Problem happens only when we publish API for
>> first time. When error occurs i can see following log at gateway node. No
>> any other logs at gateway.
>>
>> WARN - ActivationHandler Failed attempt to access WSO2 API Manager by
>> tenant 1
>>
>> Inside activation handler invoke method following code block get
>> executes. Ideally it should return as call gateway node with super tenant
>> admin credentials. But i can see 2 times tenant ID comes and super tenant
>> id and 3rd time its tenant id of API creator.
>>
>>         if (tenantId == MultitenantConstants.SUPER_TENANT_ID) {
>>             log.debug("Granted access for super tenant");
>>             return InvocationResponse.CONTINUE;
>>         }
>>
>> We deploy API by using rest API admin client. There we execute following
>> code block. Tenant domain pass along with admin service call and used by
>> rest API admin client.
>>
>>  try {
>> PrivilegedCarbonContext.startTenantFlow();
>>
>> PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tenantDomain,
>>
>>  true);
>> APIData data = getApiByName(apiName);
>>  return data;
>> } finally {
>> PrivilegedCarbonContext.endTenantFlow();
>>  }
>>
>> These components are widely used in other products as well. Please note
>> that this happens only at very first deployment call and we cant see it
>> after that(until restart server).  This is a blocker for upcoming API
>> manager release. Here we have 2 options.
>> 01. forcefully activate tenant in gateway node.
>> 02. Avoid set tenant id in activation handler.
>>
>> What is the purpose of having this activation handler? I can recall
>> sometimes back we decided to activate all services for all tenants. WDYT?
>>
>> Thanks,
>> Sanjeewa.
>>
>> --
>> *Sanjeewa Malalgoda*
>> WSO2 Inc.
>> Mobile : +14084122175 | +94713068779
>>
>>  <http://sanjeewamalalgoda.blogspot.com/>blog
>> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/>
>>
>
>
>
> --
> *Sanjeewa Malalgoda*
> WSO2 Inc.
> Mobile : +14084122175 | +94713068779
>
>  <http://sanjeewamalalgoda.blogspot.com/>blog
> :http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/>
>



-- 
*Sanjeewa Malalgoda*
WSO2 Inc.
Mobile : +14084122175 | +94713068779

 <http://sanjeewamalalgoda.blogspot.com/>blog
:http://sanjeewamalalgoda.blogspot.com/<http://sanjeewamalalgoda.blogspot.com/>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to