Hi, I think the problem occurs if you follow the steps below.
1. Create and API and publish 2. Subscribe from the Store and generate keys. 3. Unsubscribe the subscription created above. 4. Remove the API from the publisher 5. Create the API using the same name and publish 6. Try to subscribe again Step 6 is where the problem will occur. I think the problem is that the previous records do not get deleted from the AM_APPLICATION_KEY_MAPPING table and it tries to insert a duplicate record with the same primary key. Thanks, NuwanD. On Mon, Jun 9, 2014 at 7:43 AM, Sanjeewa Malalgoda <[email protected]> wrote: > 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 <[email protected]> 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 > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Nuwan Dias Associate Tech Lead - WSO2, Inc. http://wso2.com email : [email protected] Phone : +94 777 775 729
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
