WSO2 APIM- apictl import error and error in publishing the api


Hi everyone! Let me share another troubleshooting experience with WSO2 API Manager. 
Environment: RHEL8.3
WSO2 APIM Version: 3.2.0.x
Tools: apictl (API Controller)

Problem
I have tried importing an API from one environment to the other via apictl. This API contains a custom sequence as well. However, the apictl api-import command returned the HTTP 500 error with following message

Response: {"code":500,"message":"Internal server error", "description":"Error while importing API","moreInfo":"","error":[]}

Further, WSO2 carbon logs shows the below error message-

[2022-12-28 15:19:29,139] ERROR - APIUtil Issue is in accessing the Registry
[2022-12-28 15:19:29,140] ERROR - APIMappingUtil Error occurred while getting the uuid of the mediation sequence
org.wso2.carbon.apimgt.api.APIManagementException: Issue is in accessing the Registry
        at org.wso2.carbon.apimgt.impl.utils.APIUtil.getMediationPolicyAttributes_aroundBody340(APIUtil.java:5864) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?]
        at org.wso2.carbon.apimgt.impl.utils.APIUtil.getMediationPolicyAttributes(APIUtil.java:5798) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?]
        at org.wso2.carbon.apimgt.rest.api.publisher.v1.utils.mappings.APIMappingUtil.getMediationPolicyAttributes(APIMappingUtil.java:2703) [classes/:?]
        at org.wso2.carbon.apimgt.rest.api.publisher.v1.utils.mappings.APIMappingUtil.fromAPItoDTO(APIMappingUtil.java:933) [classes/:?]
        at ........................
..............................................................
[tomcat_9.0.31.wso2v1.jar:?]
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat_9.0.31.wso2v1.jar:?]
        at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException: Resource does not exist at path /_system/governance/apimgt/applicationdata/provider/dev01/DynamicClientRegister/1.0.0/in
        at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.get(MountHandler.java:449) ~[org.wso2.carbon.registry.core_4.6.0.62.jar:?]
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.get(HandlerManager.java:2446) ~[org.wso2.carbon.registry.core_4.6.0.62.jar:?]


Root Cause
Upon close observation I observed that the sequence hasn't been imported and that's the reason it's not getting published. That is, the API get's imported partially but when I go to view the API details, the publisher shows loading icon continuously and wso2carbon logs shows the error message Caused by: org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException: Resource does not exist at path /_system/governance/apimgt/applicationdata/provider/dev01/DynamicClientRegister/1.0.0/in

I have verified the sequence existence inside the location as mentioned in the error logs but the sequence and corresponding directory (in) wasn't there.

Solution
I have manually created the directory and uploaded the sequence as per the below steps and bingo! The API was visible properly with details and I was able to publish the same on respective gateways.
  1. Login to WSO2 carbon console
  2. Navigate to Resources section in left navigation and click on browse-
  3. Go to the path as mentioned in the error message for the API (/_system/governance/apimgt/applicationdata/provider/dev01/DynamicClientRegister/1.0.0)
  4. Now Add collection named 'in'
  5. Open the 'in' directory and click on Add Resource link
  6. Here you upload the sequence and save it
  7. Go back to the publisher portal and click on respective API. It should open as usual.

Comments

Popular posts from this blog

Oracle SOA Suite- Implementing Email Notification

Oracle SOA Suite 12c- PKIX path building failed & unable to find valid certification path to requested target

Migration of Oracle SOA Suite Composite from 11g to 12c