Thursday, March 20, 2014

How to fix issue in WSO2 API Manager due to missing API resource

When you visit subscription page in API manager store page you might see following error.

org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException: Resource does not exist at path /_system/governance/apimgt/applicationdata/provider/admin/api-name/1.0.0/api 
at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.get(

The reason for this issue is API resource is not there in provided path(/_system/governance/apimgt/applicationdata/provider/admin/api-name/1.0.1/api ). Here, subscriptions are run time data that stored in api manager db and API are meta data stored in registry. This error log says application is having API which is not there in registry.

This can happen due to multiple reasons.

01. Deleting registry API resource without deleting it from publisher UI(then it will delete registry data and entries in API manager tables).

02. change governance space after create subscriptions.

For this issue you can do followings.

If governance space changed you can mount to old space again. Then missed API will appear in given path.

You can create missed api-name/1.0.1 again in the system. For this delete API from api manager tables and create API from publisher UI.

You can delete subscriptions associated with missed API(api-name/1.0.1). For this you need to delete all associated entries from API manager tables carefully(or you can drop API manager database and create new database if you are not in production system ).

Actually we don't need to delete entire database. Please run following db queries against you API manager database. Its always recommend to run these queries on test environment and then apply to production servers.

Here first we need to get API_ID associated with problematic API. To get that please run following command

SELECT API_ID FROM AM_API where API_NAME = 'api-name' and API_VERSION = '1.0.1'

Then we need to delete all subscriptions associated with that API. Let say we got 3 as the result of above query. Run following query to delete all associated subscriptions.


1 comment:

  1. Hello Sanjeewa, I am facing the same issue with wso2am-2.0.0 in when running it on my local mac. In what conditions this will happen? I created some APIs and subscribed. After a day or two, these APIs are gone from the store. After digging deeper, this is what happened, registry mount may have been missing. I am assuming that it stores the API meta data in the database but I am not sure where these rtx files are stored. I looked everywhere and could not find them.

    I know you mentioned that we have to redo them, that is fine but what if it happens in production env, first of all I would like to know why it is happening.

    Any information would greatly appreciated.

    Ravi Ada