WSO2 APIM v3- Resolving API Retrieval Failure in Publisher and Devportal

In this blog post I'll share my experience in fixing the issue for APIs loading in publisher and devportal of WSO2 API Manager v3.2. My WSO2 API Manager instance was running fine with respective functionality. I stopped the server due to infra/maintenance activity and started the same after 2 days. However, my publisher portal was opening, and login works fine but I found an issue post login in Publisher portal and the Developer. Portal The Publisher and Developer Portal fail to retrieve APIs, displaying an HTTP 500 error. This blog post explores the root cause and solution for this problem.

Environment

  • WSO2 APIM v3.2.0.xxx
  • DB- MSSQL Server as database
  • OS- RHEL

The Issue
In a recent scenario, WSO2 API Manager’s Publisher and Developer Portal were failing to list APIs, showing an HTTP 500 error. The error trace in the logs pointed to a failure in searching for APIs:

ApisApiServiceImpl Error while retrieving APIs org.wso2.carbon.apimgt.api.APIManagementException: Failed to Search APIs at org.wso2.carbon.apimgt.impl.AbstractAPIManager.searchPaginatedAPIs_aroundBody178(AbstractAPIManager.java:2310) ~[org.wso2.carbon.apimgt.impl_6.7.206.367.jar:?] at org.wso2.carbon.apimgt.impl.AbstractAPIManager.searchPaginatedAPIs(AbstractAPIManager.java:2195) ~[org.wso2.carbon.apimgt.impl_6.7.206.367.jar:?] at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.apisGet(ApisApiServiceImpl.java:245) [classes/:?] at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.apisGet(ApisApi.java:928) [classes/:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] 
...... ...... ...... ...... 
Caused by: java.lang.NullPointerException at org.wso2.carbon.registry.indexing.internal.IndexingServiceComponent$AttributeSearchServiceImpl.search(IndexingServiceComponent.java:172) ~[org.wso2.carbon.registry.indexing_4.7.35.jar:?] at org.wso2.carbon.registry.indexing.internal.IndexingServiceComponent$AttributeSearchServiceImpl.search(IndexingServiceComponent.java:185) ~[org.wso2.carbon.registry.indexing_4.7.35.jar:?] at org.wso2.carbon.registry.indexing.internal.IndexingServiceComponent$AttributeSearchServiceImpl.search(IndexingServiceComponent.java:155) ~[org.wso2.carbon.registry.indexing_4.7.35.jar:?] at org.wso2.carbon.governance.api.util.GovernanceUtils.performAttributeSearch(GovernanceUtils.java:2181) ~[org.wso2.carbon.governance.api_4.8.19.jar:?] ....... 55 more

The key takeaway from this error log is that API retrieval was failing due to an issue with indexing.


Root Cause
WSO2 API Manager relies on an indexing service to efficiently search and retrieve APIs. When this indexing process fails or becomes corrupted, API searches in both the Publisher and Developer Portal may break, resulting in an HTTP 500 error. In this case, indexing was either disabled or not functioning correctly.

The Solution
To resolve this issue, indexing had to be re-enabled and refreshed. The following changes were applied in the deployment.toml file:

[indexing] 
enable = true 
re_indexing = 1

Steps to Fix
1. Modify the configuration as-
  • Open the deployment.toml file located in the <APIM_HOME>/repository/conf/ directory.
  • Add or update the [indexing] section with the above configuration.

2. Restart the Server- Restart the WSO2 API Manager server to apply the changes.

3. Verify the Fix:

  • Navigate to the API Publisher and Developer Portal.
  • Confirm that the APIs are listed without errors.

Conclusion
Indexing is a crucial component in WSO2 API Manager for API retrieval. When faced with HTTP 500 errors related to API listing, checking the indexing configuration should be a priority. By re-enabling and refreshing the indexing service, we successfully restored API listings in both the Publisher and Developer Portal.

This simple fix can prevent unnecessary downtime and ensure a smooth API management experience. If you encounter similar issues, always inspect the logs and verify indexing settings as part of your troubleshooting process.

Reference: https://dzone.com/articles/reindexing-in-wso2-api-m-320-to-display-apis-in-pu

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