Posts

WSO2 APIM | Sequence to print throttlling messages

Image
Hi everyone, I will be sharing my another experience with the WSO2 API Manager sample use case for API throttling. Scenario So I had a situation encountered where I have to see the throttling messages in my wso2carbon.log file. By default, it has not been enabled and we have to make some changes to see the required output in the wso2carbon log file.   API Manager Version 3.2.0 Changes done WSO2 Sequence to print throttling messages in wso2carbon.log file Navigate to <APIM_HOME>/repository/deployment/server/synapse-configs/default/sequences directory. Open the file named _throttle_out_handler_.xml. Update the contents of file _throttle_out_handler_.xml as per the below custom changes <sequence name="_throttle_out_handler_" xmlns="http://ws.apache.org/ns/synapse">         <property name="X-JWT-Assertion" scope="transport" action="remove"/>     <class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.AP...

WSO2 APIM | Server startup takes long time in linux/Mac

Image
Recently I have been trying to run WSO2 APIM V4 on my MacBook Air but it was taking too long to start. I have also faced the similar issue in linux environment previously. To overcome this issue,  need to map hostile entries (127.0.0.1 & ::1) to my hostname. Before 127.0.0.1 localhost ::1              localhost Now let's check the hostname in Mac kumargaurav@Kumars-MacBook-Air bin % hostname Kumars-MacBook-Air.local Let's update the hostname with current one in addition to the localhost as shown below- After   127.0.0.1 localhost Kumars-MacBook-Air.local ::1             localhost Kumars-MacBook-Air.local Now, start the API Manager and it would start in normal time ~<2 mins.   Kindly note that the changes here are for localhost hostname & IP 127.0.0.1, in case of environment specific deployment we need to change as per the environment IP & hostname.

WSO2 APIM 3.2.0 | Unable to load APIs in developer portal

Image
Hello guys, I'll be sharing my another experience in WSO2 API Manager for one of the use cases I faced issue. Environment : WSO2 APIM 3.2.0, RHEL8.x Problem: The developer portal is unable to load the list of APIs as default. Although, it can load the APIs if I filter out the APIs via tag. Below is the screenshot of the same- Further I tried to investigate wso2carbon logs to see the error/exception and I found below relevant logs for the same- ================================================================================ ERROR - ApisApiServiceImpl Error while retrieving API : 07b6c6a7-eaa6-42be-a687-e04dd40a1ee6 org.wso2.carbon.apimgt.api.APIManagementException: Unable to find the API: admin-test001-1.0.0 in the database at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.getAPIID_aroundBody310(ApiMgtDAO.java:7148) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?] at org.wso2.carbon.apimgt.impl.dao.ApiMgtDAO.getAPIID(ApiMgtDAO.java:7117) ~[org.wso2.carbon.apimgt.impl_6.7.206.168.jar:?] a...

WSO2 APIM OpenShift Deployment- Create http route for API gateway

Image
In this post I'll be sharing one of the use case to achieve in WSO2 OpenShift Deployment Environment: OpenShift 4.x, WSO2 APIM 3.2.0.x, RHEL 8.3 Business Requirement: Getting http based URL for API gateway component in OpenShift deployment of WSO2 API Manager Steps to achieve: By default WSO2 APIM (deployment pattern-1: all in one two node stateful set) provides 3 routes for respective services based on https protocol as For Analytics :  wso2am-analytics-dashboard-test.apps.devtest.host.local For API Gateway : wso2am-gateway-test.apps.devtest.host.local For APIM Portals   :  wso2am-am-test.apps.devtest.host.local Now in order to get a http based URL for API gateway, we have to create a new route. This can be achieved via config map or directly via OpenShift console. I've used  OpenShift  console to create a new route for API gateway based on http protocol. Below are the steps- 1. Login to OpenShift console & Navigate to respective project 2. Navigate ...

Docker run failed for apim analytics image with illegal option

Image
In this post I am going to share my experience for running the docker image of wso2 apim analytics dashboard that caused some issue while running it. Below is the summary of the same- Environment: Windows, RHEL 8.3, WSO2 Analytics 3.2.0 Problem: While executing docker run command, it gives following error- sudo docker run wso2am-analytics-dashboard:3.2.0.20 : not foundarbon/docker-entrypoint.sh: 17: /home/wso2carbon/docker-entrypoint.sh: 18: set: Illegal option - Cause:  The problem occurred due to dos2unix conversion issue. Basically the file docker-entrypoint.sh was created in a winodws machine in notepad++ utility but remained with EOL conversion as Windows (CR LF). Further this file was uploaded to a linux machine where actual execution has to be done. Solution We need to change the EOL conversion of the file ( docker-entrypoint.sh ) to Linux (LR) prior to docker image creation. I have used windows environment and notepad++ utility to do the same as- 1. Open the file doc...

WSO2 APIM OpenShift Deployment Experience

Image
Hello Guys, In this blog I am going to share my experience in WSO2 API Manager OpenShift deployment where I faced some issues with respect to Persistent Volumes/ Persistent Volume Claims. Environment OpenShift Version 4.x WSO2 APIM version 3.2.0.x Use Case 1- runAsUser SecurityContext I have tried to apply the template yaml to create the resources, following error encountered [userdemo@mycustomhost yaml]$ oc get pods NAME READY STATUS RESTARTS AGE wso2am-pattern-1-am-analytics-dashboard-deployment-1-deploy 0/1 Error 0 13m wso2am-pattern-1-am-analytics-worker-2-deployment-1-deploy 0/1 Error 0 13m wso2am-pattern-1-am-analytics-worker-deployment-1-deploy 0/1 Error 0 13m [appadmin1@apiextappppsb01 yaml]$ oc logs -f wso2am-pattern-1-am-analytics-dashboard-deployment-1-deploy --> Scaling wso2am-pattern-1-am-analytics-dashboard-deployment-1 to 1 --> FailedCreate: ws...

WSO2 API Manager APICTL api-import error

Image
  WSO2 APIM version: 3.2.0.85 APICTL Version:  3.2.4 Recently I have updated my WSO2 API manager version 3.2.0 with latest patch level 85 and tried using api controller for api export/import to a different environment. Earlier it was working fine with default pack 3.2.0 but api import starts giving error while importing the API. Below is the error stack trace in apictl- APICTL errors: apictl import-api --file D:\test\Test001-API_1.0.0.zip -e dev -k Error importing API. Status: 500 Response: {"code":500,"message":"Internal server error","description":"The server encountered an internal error. Please contact administrator.","moreInfo":"","error":[]} apictl: Error importing API Reason: 500 Exit status 1 wso2carbon logs: [2021-10-15 23:42:49,635] ERROR - GlobalThrowableMapper An unknown exception has been captured by the global exception mapper. com.google.gson.JsonSyntaxException: Oct 14, 2021, 10:26:10 AM    ...

WSO2 API Manager APICTL Commands

Image
WSO2 API Manager apictl commands APICTL version used Version: 3.2.4 Build Date: 2021-10-12 03:45:30 UTC Step#1 Environment Add & Remove apictl add-env -e dev --apim <APIM_URL>  apictl add-env -e dev --apim https://localhost:9443  apictl remove env <ENV> apictl remove env dev Step#2 List environment  apictl list envs Step#3 Login to the environment  apictl login <ENV> -u <USERNAME> -p <PASSWORD> -k  apictl login dev -u admin -p admin -k  Step#4 Set API export directory apictl set --export-directory D:\APIMLab\export [path belongs to windows] Step#5 List APIs apictl list apis -e <ENV> -k apictl list apis -e dev -k  Step#6 Export 1 API apictl export-api -n <API-name> -v <version> -r <provider> -e <environment> -k  apictl export-api -n HelloWorld -v 1.0.0 -r admin -e dev -k  Other options apictl export-api --name <API-name> --version <version> --provider <provider> ...

WSO2 APIM Open Shift Deployment YAML error for '@' value in password

Image
In this blog, I would like to share a small but tricky experience while working with Open Shift Deployment of WSO2 API Manager. Scenario I have been using WSO2 APIM deployment template YAML from official Github repository and customized the same as per the environment. The important change was using external database MSSQL Server where the DB & password for respective databases  were created by DBAs. Problem Statement Once I configured the DB details and executed my YAML, it was successful. However when I checked the POD logs it shows below error- found character '@' that cannot start any token. (Do not use @ for indentation)  in 'string', line 286, column 21:               password: @x!~#321228H Cause The password value specified in YAML file contains '@' symbol in the beginning of the password and YAML considered it as indentation and hence caused error   Solution To overcome this problem, we need to either change the db ...

WSO2 APIM Custom Docker Image Run - Permission Denied

Image
Problem Statement Recently I have been trying to build a custom docker image for WSO2 APIM v3.2.0 where I have customised the package and re-built the image using the updated package. Below is the directory structure - ProjectDirectory -Dockerfile -docker-entrypoint.sh -wso2am_3.2.0.zip I ran the command to build the image as $ docker build -t wso2am:3.2.0_01 . Image built successfully and visible as- $ docker images REPOSITORY         TAG          IMAGE_ID     C REATED            SIZE loclahost/wso2am    3.2.0_01   4bg83jd9abg1   2 minutes ago    1.42 GB When I try to run the contianer of respective docker image, it throws error- $ docker run -it -p 8280:8280 -p 9443:9443 --name apimanager wso2am:3.2.0_01 Error contianer_linux.go 370: starting container process caused: exec: "/home/wso2carbon/docker-entrypoint.sh": permission denied: OCI runtime permission d...