If you add a scope, there would an entry going into
'IDN_OAUTH2_RESOURCE_SCOPE' table as well. This also needs to be deleted.

This is a known issue.


On Mon, Jun 9, 2014 at 8:45 AM, Nalin Chamara <na...@wso2.com> wrote:

> Hi Sanjiva,
>
> You have to create an API, subscribe to it, invoke the API, then delete
> it. After that, if you try to create another API with the previously used
> name, then the above mentioned problem will occur. Just creating and
> deleting the API won't do. The reason is, an entry to
> AM_APPLICATION_KEY_MAPPING table will only be added when generating a key
> to invoke the API after subscription.
>
> Sent from my Windows phone.
> ------------------------------
> From: Sanjeewa Malalgoda <sanje...@wso2.com>
> Sent: ‎6/‎9/‎2014 7:43 AM
> To: Nalin Chandraratne <na...@wso2.com>
> Cc: WSO2 Developers' List <dev@wso2.org>; Amila Maha Arachchi
> <ami...@wso2.com>; Evanthika Amarasiri <evanth...@wso2.com>
> Subject: Re: [Dev] [API-M] [1.7.0] Can't create API's with previously
> used APInames.
>
> It seems API go deleted from registry and still there in database so we
> may need to debug and see what went wrong.
> But when i tried same from API Manager 1.7.0  UI things worked as
> expected. See following logs. Created deleted same API multiple times
> without an issue.
>
>
> [2014-06-09 07:40:25,735]  INFO - API Destroying API: admin--rrr:v1.0.0
> [2014-06-09 07:40:55,478]  INFO - API Initializing API: admin--rrr:v1.0.0
> [2014-06-09 07:41:06,694]  INFO - API Destroying API: admin--rrr:v1.0.0
> [2014-06-09 07:41:41,241]  INFO - API Initializing API: admin--vvv:v1.0.0
> [2014-06-09 07:41:41,294]  INFO - API Destroying API: admin--vvv:v1.0.0
> [2014-06-09 07:41:41,295]  INFO - API Initializing API: admin--vvv:v1.0.0
> [2014-06-09 07:41:48,671]  INFO - API Destroying API: admin--vvv:v1.0.0
>
>
> Thanks,
> sanjeewa.
>
>
> On Fri, Jun 6, 2014 at 7:16 PM, Nalin Chandraratne <na...@wso2.com> wrote:
>
>> Hi,
>>
>> I encountered an issue when trying to create an API with a previously
>> used but deleted API name. The error actually occurs when trying to
>> generate the key after subscription.
>>
>> I wrote a java client using the provided API-M REST API to do the basic
>> operations and when trying to generate the key, following error occurs.
>>
>> ERROR - ApiMgtDAO Error occurred while creating an Application
>> Registration Entry for Application : DefaultApplication
>> org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
>> "PRIMARY_KEY_AF ON PUBLIC.AM_APPLICATION_KEY_MAPPING(APPLICATION_ID,
>> KEY_TYPE)"; SQL statement:
>> INSERT INTO AM_APPLICATION_KEY_MAPPING (APPLICATION_ID,KEY_TYPE,STATE)
>> VALUES(?,?,?) [23001-140]
>>
>> When trying to do the same thing manually using API-M publisher UI the
>> console gives the following message.
>>
>>
>> ​
>>
>> The API manager console prints,
>>
>> ERROR - UserAwareAPIProvider Failed to get API from :
>> /apimgt/applicationdata/provider/test-AT-test.com/test/1/api
>> org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException:
>> Resource does not exist at path
>> /_system/governance/apimgt/applicationdata/provider/test-AT-test.com/test/1/api
>>
>>
>> It seems like although the API got deleted, the associated application
>> key does not get removed from the "AM_APPLICATION_KEY_MAPPING" table.
>>
>> Thanks.
>>
>>
>>
>>
>> Nalin Chamara
>> Software Engineer
>> 071-56-147-56
>>
>
>
>
> --
>
> *Sanjeewa Malalgoda*
> WSO2 Inc.
> Mobile : +94713068779
>
>  <http://sanjeewamalalgoda.blogspot.com/>blog
> :http://sanjeewamalalgoda.blogspot.com/
> <http://sanjeewamalalgoda.blogspot.com/>
>
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
/sumedha
m: +94 773017743
b :  bit.ly/sumedha
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to