wso2 / kubernetes-apim

Kubernetes and Helm resources for WSO2 API Manager
Apache License 2.0
116 stars 216 forks source link

[3.1.0]Error while publishing the API with a custom handler #441

Open visz1214 opened 4 years ago

visz1214 commented 4 years ago

Description: I'm using the pattern-2. I only added volume to add the jar and the velocity_template.xml to the pubStore pod Here are my configs :

instance1:

# Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Service
metadata:
  name: wso2am-pattern-2-pub-store-tm-1-service
  namespace : {{ .Release.Namespace }}
spec:
  # label keys and values that must match in order to receive traffic for this service
  selector:
    node: wso2am-pattern-2-pub-store-tm-1
  ports:
  # ports that this service should serve on
  - name: jms-tcp
    protocol: TCP
    port: 5672
  - name: binary-secure
    protocol: TCP
    port: 9711
  - name: binary
    protocol: TCP
    port: 9611
  - name: thrift-secure
    protocol: TCP
    port: 7711
  - name: thrift
    protocol: TCP
    port: 7611
  - name: servlet-http
    protocol: TCP
    port: 9763
  - name: servlet-https
    protocol: TCP
    port: 9443
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: wso2am-pattern-2-pub-store-tm-1-deployment
  namespace: {{ .Release.Namespace }}
spec:
  selector:
    matchLabels:
      deployment: wso2am-pattern-2-pub-store-tm
      node: wso2am-pattern-2-pub-store-tm-1
  serviceName: wso2am-pattern-2-pub-store-tm-1-service
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        deployment: wso2am-pattern-2-pub-store-tm
        node: wso2am-pattern-2-pub-store-tm-1
    spec:
      initContainers:
      {{- if and .Values.wso2.deployment.db.host (.Values.wso2.deployment.db.port) }}
      - name: init-apim-db
        image: busybox:1.31
        command: ['sh', '-c', 'echo -e "Checking for the availability of DBMS service"; while ! nc -z {{ .Values.wso2.deployment.db.host }} {{ .Values.wso2.deployment.db.port }}; do sleep 1; printf "-"; done; echo -e "  >> DBMS service is available";']
      {{- end }}
      - name: init-apim-analytics
        image: busybox:1.31
        command: ['sh', '-c', 'echo -e "Checking for the availability of WSO2 API Manager Analytics Worker deployment"; while ! nc -z wso2am-pattern-2-am-analytics-worker-service 7712; do sleep 1; printf "-"; done; echo -e "  >> WSO2 API Manager Analytics Worker has started";']
      hostAliases:
      - ip: "127.0.0.1"
        hostnames:
        - "{{ .Release.Name }}-am"
      containers:
      - name: wso2am-pub-store-tm
        {{- if .Values.wso2.deployment.am.dockerRegistry }}
        image: {{ .Values.wso2.deployment.am.dockerRegistry }}/{{ .Values.wso2.deployment.am.imageName }}
        {{- $tag := .Values.wso2.deployment.am.imageTag }}
        {{- if not (eq $tag "") }}{{- printf ":%s" $tag -}}{{- end }}
        {{- else if or (eq .Values.wso2.subscription.username "") (eq .Values.wso2.subscription.password "") }}
        image: wso2/{{ .Values.wso2.deployment.am.imageName }}:{{ .Values.wso2.deployment.am.imageTag }}
        {{- else }}
        image: docker.wso2.com/{{ .Values.wso2.deployment.am.imageName }}:{{ .Values.wso2.deployment.am.imageTag }}
        {{- end }}
        env:
        - name: HOST_NAME
          value: "{{ .Release.Name }}-am"
        - name: NODE_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP 
        livenessProbe:
          exec:
            command:
              - /bin/sh
              - -c
              - nc -z localhost 9443
          initialDelaySeconds: {{ .Values.wso2.deployment.am.pubStoreTM.livenessProbe.initialDelaySeconds }}
          periodSeconds: {{ .Values.wso2.deployment.am.pubStoreTM.livenessProbe.periodSeconds }}
        readinessProbe:
          exec:
            command:
              - /bin/sh
              - -c
              - nc -z localhost 9443
          initialDelaySeconds: {{ .Values.wso2.deployment.am.pubStoreTM.readinessProbe.initialDelaySeconds }}
          periodSeconds: {{ .Values.wso2.deployment.am.pubStoreTM.readinessProbe.periodSeconds }}
        lifecycle:
          preStop:
            exec:
              command:  ['sh', '-c', '${WSO2_SERVER_HOME}/bin/wso2server.sh stop']
        resources:
          requests:
            memory: {{ .Values.wso2.deployment.am.resources.requests.memory }}
            cpu: {{ .Values.wso2.deployment.am.resources.requests.cpu }}
          limits:
            memory: {{ .Values.wso2.deployment.am.resources.limits.memory }}
            cpu: {{ .Values.wso2.deployment.am.resources.limits.cpu }}
        imagePullPolicy: {{ .Values.wso2.deployment.am.imagePullPolicy }}
        securityContext:
          runAsUser: 802
        ports:
        - containerPort: 9763
          protocol: "TCP"
        - containerPort: 9443
          protocol: "TCP"
        - containerPort: 5672
          protocol: "TCP"
        - containerPort: 9711
          protocol: "TCP"
        - containerPort: 9611
          protocol: "TCP"
        - containerPort: 7711
          protocol: "TCP"
        - containerPort: 7611
          protocol: "TCP"
        volumeMounts:
        - name: wso2am-pattern-2-storage-volume
          mountPath: /home/wso2carbon/wso2am-3.1.0/repository/deployment/server/executionplans
        - name: wso2am-pattern-2-pub-store-tm-1-conf
          mountPath: /home/wso2carbon/wso2-config-volume/repository/conf/deployment.toml
          subPath: deployment.toml
        - name: wso2am-pattern-2-conf-entrypoint
          mountPath: /home/wso2carbon/docker-entrypoint.sh
          subPath: docker-entrypoint.sh
        - name: wso2am-pattern-2-instance-1-solr
          mountPath: /home/wso2carbon/solr/indexed-data
        - name: wso2am-pattern-2-instance-1-carbon-db
          mountPath: /home/wso2carbon/solr/database
        - name: wso2am-pattern-2-ext-jar-1
          mountPath: /home/wso2carbon/wso2am-3.1.0/repository/components/dropins/org.wso2.carbon.test-1.0-SNAPSHOT.jar
          subPath: org.wso2.carbon.test-1.0-SNAPSHOT.jar
        - name: wso2am-pattern-2-velocity-template-1
          mountPath: /home/wso2carbon/wso2am-3.1.0/repository/resources/api_templates/velocity_template.xml
          subPath: velocity_template.xml
      serviceAccountName: {{ .Values.kubernetes.serviceAccount }}
      {{- if .Values.wso2.deployment.am.imagePullSecrets }}
      imagePullSecrets:
        - name: {{ .Values.wso2.deployment.am.imagePullSecrets }}
      {{- else if and (not (eq .Values.wso2.subscription.username "")) (not (eq .Values.wso2.subscription.password "")) }}
      imagePullSecrets:
        - name: wso2am-pattern-2-wso2-private-registry-creds
      {{ end }}
      volumes:
      - name: wso2am-pattern-2-instance-1-carbon-db
        persistentVolumeClaim:
          claimName: wso2am-pattern-2-instance-1-carbon-db
      - name: wso2am-pattern-2-instance-1-solr
        persistentVolumeClaim:
          claimName: wso2am-pattern-2-instance-1-solr
      - name: wso2am-pattern-2-storage-volume
        persistentVolumeClaim:
          claimName: wso2am-pattern-2-pub-store-tm-shared-executionplans-volume-claim
      - name: wso2am-pattern-2-pub-store-tm-1-conf
        configMap:
          name: wso2am-pattern-2-pub-store-tm-1-conf
      - name: wso2am-pattern-2-conf-entrypoint
        configMap:
          name: wso2am-pattern-2-am-conf-entrypoint
          defaultMode: 0407
      - name: wso2am-pattern-2-ext-jar-1
        hostPath: 
          path: /mnt/jar/
      - name: wso2am-pattern-2-velocity-template-1
        hostPath:
          path: /mnt/jar/

instance2:

# Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Service
metadata:
  name: wso2am-pattern-2-pub-store-tm-2-service
  namespace : {{ .Release.Namespace }}
spec:
  # label keys and values that must match in order to receive traffic for this service
  selector:
    node: wso2am-pattern-2-pub-store-tm-2
  ports:
  # ports that this service should serve on
  - name: jms-tcp
    protocol: TCP
    port: 5672
  - name: binary-secure
    protocol: TCP
    port: 9711
  - name: binary
    protocol: TCP
    port: 9611
  - name: thrift-secure
    protocol: TCP
    port: 7711
  - name: thrift
    protocol: TCP
    port: 7611
  - name: servlet-http
    protocol: TCP
    port: 9763
  - name: servlet-https
    protocol: TCP
    port: 9443
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: wso2am-pattern-2-pub-store-tm-2-deployment
  namespace: {{ .Release.Namespace }}
spec:
  selector:
    matchLabels:
      deployment: wso2am-pattern-2-pub-store-tm
      node: wso2am-pattern-2-pub-store-tm-2
  serviceName: wso2am-pattern-2-pub-store-tm-2-service
  replicas: 1
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        deployment: wso2am-pattern-2-pub-store-tm
        node: wso2am-pattern-2-pub-store-tm-2
    spec:
      initContainers:
      {{- if and .Values.wso2.deployment.db.host (.Values.wso2.deployment.db.port) }}
      - name: init-apim-db
        image: busybox:1.31
        command: ['sh', '-c', 'echo -e "Checking for the availability of DBMS service"; while ! nc -z {{ .Values.wso2.deployment.db.host }} {{ .Values.wso2.deployment.db.port }}; do sleep 1; printf "-"; done; echo -e "  >> DBMS service is available";']
      {{- end }}
      - name: init-apim-analytics
        image: busybox:1.31
        command: ['sh', '-c', 'echo -e "Checking for the availability of WSO2 API Manager Analytics Worker deployment"; while ! nc -z wso2am-pattern-2-am-analytics-worker-service 7712; do sleep 1; printf "-"; done; echo -e "  >> WSO2 API Manager Analytics Worker has started";']
      hostAliases:
      - ip: "127.0.0.1"
        hostnames:
        - "{{ .Release.Name }}-am"
      containers:
      - name: wso2am-pub-store-tm
        {{- if .Values.wso2.deployment.am.dockerRegistry }}
        image: {{ .Values.wso2.deployment.am.dockerRegistry }}/{{ .Values.wso2.deployment.am.imageName }}
        {{- $tag := .Values.wso2.deployment.am.imageTag }}
        {{- if not (eq $tag "") }}{{- printf ":%s" $tag -}}{{- end }}
        {{- else if or (eq .Values.wso2.subscription.username "") (eq .Values.wso2.subscription.password "") }}
        image: wso2/{{ .Values.wso2.deployment.am.imageName }}:{{ .Values.wso2.deployment.am.imageTag }}
        {{- else }}
        image: docker.wso2.com/{{ .Values.wso2.deployment.am.imageName }}:{{ .Values.wso2.deployment.am.imageTag }}
        {{- end }}
        env:
        - name: HOST_NAME
          value: "{{ .Release.Name }}-am"
        - name: NODE_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP 
        livenessProbe:
          exec:
            command:
              - /bin/sh
              - -c
              - nc -z localhost 9443
          initialDelaySeconds: {{ .Values.wso2.deployment.am.pubStoreTM.livenessProbe.initialDelaySeconds }}
          periodSeconds: {{ .Values.wso2.deployment.am.pubStoreTM.livenessProbe.periodSeconds }}
        readinessProbe:
          exec:
            command:
              - /bin/sh
              - -c
              - nc -z localhost 9443
          initialDelaySeconds: {{ .Values.wso2.deployment.am.pubStoreTM.readinessProbe.initialDelaySeconds }}
          periodSeconds: {{ .Values.wso2.deployment.am.pubStoreTM.readinessProbe.periodSeconds }}
        lifecycle:
          preStop:
            exec:
              command:  ['sh', '-c', '${WSO2_SERVER_HOME}/bin/wso2server.sh stop']
        resources:
          requests:
            memory: {{ .Values.wso2.deployment.am.resources.requests.memory }}
            cpu: {{ .Values.wso2.deployment.am.resources.requests.cpu }}
          limits:
            memory: {{ .Values.wso2.deployment.am.resources.limits.memory }}
            cpu: {{ .Values.wso2.deployment.am.resources.limits.cpu }}
        imagePullPolicy: {{ .Values.wso2.deployment.am.imagePullPolicy }}
        securityContext:
          runAsUser: 802
        ports:
        - containerPort: 9763
          protocol: "TCP"
        - containerPort: 9443
          protocol: "TCP"
        - containerPort: 5672
          protocol: "TCP"
        - containerPort: 9711
          protocol: "TCP"
        - containerPort: 9611
          protocol: "TCP"
        - containerPort: 7711
          protocol: "TCP"
        - containerPort: 7611
          protocol: "TCP"
        volumeMounts:
        - name: wso2am-pattern-2-storage-volume
          mountPath: /home/wso2carbon/wso2am-3.1.0/repository/deployment/server/executionplans
        - name: wso2am-pattern-2-pub-store-tm-2-conf
          mountPath: /home/wso2carbon/wso2-config-volume/repository/conf/deployment.toml
          subPath: deployment.toml
        - name: wso2am-pattern-2-conf-entrypoint
          mountPath: /home/wso2carbon/docker-entrypoint.sh
          subPath: docker-entrypoint.sh
        - name: wso2am-pattern-2-instance-2-solr
          mountPath: /home/wso2carbon/solr/indexed-data
        - name: wso2am-pattern-2-instance-2-carbon-db
          mountPath: /home/wso2carbon/solr/database
        - name: wso2am-pattern-2-ext-jar-2
          mountPath: /home/wso2carbon/wso2am-3.1.0/repository/components/dropins/org.wso2.carbon.test-1.0-SNAPSHOT.jar
          subPath: org.wso2.carbon.test-1.0-SNAPSHOT.jar
        - name: wso2am-pattern-2-velocity-template-2
          mountPath: /home/wso2carbon/wso2am-3.1.0/repository/resources/api_templates/velocity_template.xml
          subPath: velocity_template.xml
      serviceAccountName: {{ .Values.kubernetes.serviceAccount }}
      {{- if .Values.wso2.deployment.am.imagePullSecrets }}
      imagePullSecrets:
        - name: {{ .Values.wso2.deployment.am.imagePullSecrets }}
      {{- else if and (not (eq .Values.wso2.subscription.username "")) (not (eq .Values.wso2.subscription.password "")) }}
      imagePullSecrets:
        - name: wso2am-pattern-2-wso2-private-registry-creds
      {{ end }}
      volumes:
      - name: wso2am-pattern-2-instance-2-carbon-db
        persistentVolumeClaim:
          claimName: wso2am-pattern-2-instance-2-carbon-db
      - name: wso2am-pattern-2-instance-2-solr
        persistentVolumeClaim:
          claimName: wso2am-pattern-2-instance-2-solr
      - name: wso2am-pattern-2-storage-volume
        persistentVolumeClaim:
          claimName: wso2am-pattern-2-pub-store-tm-shared-executionplans-volume-claim
      - name: wso2am-pattern-2-pub-store-tm-2-conf
        configMap:
          name: wso2am-pattern-2-pub-store-tm-2-conf
      - name: wso2am-pattern-2-conf-entrypoint
        configMap:
          name: wso2am-pattern-2-am-conf-entrypoint
          defaultMode: 0407
      - name: wso2am-pattern-2-ext-jar-2
        hostPath: 
          path: /mnt/jar/
      - name: wso2am-pattern-2-velocity-template-2
        hostPath:
          path: /mnt/jar/

the custom handler code:

package org.wso2.carbon.test;

import org.apache.synapse.MessageContext;
import org.apache.synapse.core.axis2.Axis2MessageContext;
import org.apache.synapse.rest.AbstractHandler;

import java.util.Map;

public class CustomAPIResponseHandler extends AbstractHandler {

    public boolean handleRequest(MessageContext messageContext) {
        return true;
    }

    public boolean handleResponse(MessageContext messageContext) {
        if(doit(messageContext).equals("virus"))
        {
            Map headers=add(messageContext);
            setTransportHeaders( messageContext,headers);
        }
        return true;
    }

    public String doit(MessageContext synCtx) {
        Map headers = getTransportHeaders(synCtx);
        String aString = getHeader(headers);
        return aString;
    }
    public Map add(MessageContext synCtx) {
        Map headers = getTransportHeaders(synCtx);
        setHeader(headers);
        return headers;
    }

    private void setHeader(Map headers) {
        headers.put("handlers", "activited");
    }
    private String getHeader(Map headers) {
        return (String) headers.get("safety");
    }
    private void setTransportHeaders(MessageContext messageContext,Map headers) {
        messageContext.setProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS, headers);
    }
    private Map getTransportHeaders(MessageContext messageContext) {
        return (Map) ((Axis2MessageContext) messageContext).getAxis2MessageContext().
                getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
    }
}

velocity_template.xml :

<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->

        #####################  Define the macros ######################

        #macro ( print_string_if_exist $field $default)
        #if($field && "$field" !="")
        "$field"
        #else
        "$default"
        #end
        #end

        #macro ( draw_endpoint $type $endpoint_config )

        #set( $endpointClass = $endpoint_config.get("endpoint_type") )
        #set( $endpoints = $endpoint_config.get("${type}_endpoints"))
        #set( $ep_key = "${endpointKey}_API${type}Endpoint")
        #set( $endpointsecurity = $endpoint_security.get("${type}"))

        ## IF endpoint secured
        #if($endpointsecurity.enabled)
        #if($isSecureVaultEnabled)
<property xmlns="http://ws.apache.org/ns/synapse" name="password" expression="wso2:vault-lookup('$endpointsecurity.alias')"/>
<property xmlns="http://ws.apache.org/ns/synapse" name="unpw" expression="fn:concat('$username',':',get-property('password'))"/>
<property xmlns="http://ws.apache.org/ns/synapse" name="Authorization" expression="fn:concat('Basic ', base64Encode(get-property('unpw')))" scope="transport"/>
        #else
        #if($endpointsecurity.type == "digest" || $endpointsecurity.type == "DIGEST")
<property xmlns="http://ws.apache.org/ns/synapse" name="UNAMEPASSWORD" value="$util.escapeXml($endpointsecurity.base64EncodedPassword)" type="STRING"/>
<property name="BACKEND_URL" value="$util.escapeXml($endpoints.get("url"))"/>
<property name="POSTFIX" expression="get-property('axis2', 'REST_URL_POSTFIX')"/>
<property name="HTTP_METHOD" expression="get-property('axis2', 'HTTP_METHOD')"/>
<property name="POST_TO_URI" value="true" scope="axis2"/>
<property name="MessageType" expression="get-property('axis2', 'messageType')"/>

<enrich>
<source type="body" clone="true"/>
<target type="property" property="MessageBody"/>
</enrich>

<call>
<endpoint key="$ep_key"/>
</call>

<class name="org.wso2.carbon.apimgt.gateway.mediators.DigestAuthMediator"/>

<property name="Authorization" expression="get-property('AuthHeader')" scope="transport"/>
<property name="messageType" expression="get-property('MessageType')" scope="axis2"/>
<property name="HTTP_METHOD" expression="get-property('HTTP_METHOD')" scope="axis2"/>
<property name="REST_URL_POSTFIX" expression="$ctx:POSTFIX" scope="axis2"/>
<property name="POST_TO_URI" value="true" scope="axis2"/>

<enrich>
<source type="property" property="MessageBody" clone="true"/>
<target type="body"/>
</enrich>

        #else
<property xmlns="http://ws.apache.org/ns/synapse" name="Authorization" expression="fn:concat('Basic ', '$endpointsecurity.base64EncodedPassword')" scope="transport"/>
        #end
        #end
        #end
<send>

## If endpoint is http
#if ($endpointClass == "http")
<endpoint xmlns="http://ws.apache.org/ns/synapse" key="$ep_key"/>
#elseif ($endpointClass == "address")
<endpoint xmlns="http://ws.apache.org/ns/synapse" key="$ep_key"/>
#elseif ($endpointClass == "wsdl")
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="$ep_name">
    #if (${type} == "production")
    <wsdl uri="$util.escapeXml($endpoints.get("url"))" service="$!endpoint_config.get("wsdlendpointService")" port="$!endpoint_config.get("wsdlendpointPort")">
    #timeout()
</wsdl>
#else
<wsdl uri="$util.escapeXml($endpoints.get("url"))" service="$!endpoint_config.get("wsdlendpointServiceSandbox")" port="$!endpoint_config.get("wsdlendpointPortSandbox")">
#timeout()
</wsdl>
        #end
<property name="ENDPOINT_ADDRESS" value="$util.escapeXml($endpoints.get("url"))"/>
        </endpoint>
        #elseif ($endpointClass == "failover")
        #set( $failover_endpoints = $endpoint_config.get("${type}_failovers"))
<endpoint xmlns="http://ws.apache.org/ns/synapse" key="$ep_key"/>
        #elseif ($endpointClass == "load_balance")
<endpoint xmlns="http://ws.apache.org/ns/synapse" key="$ep_key"/>
        #elseif ($endpointClass == "default")
<endpoint key="$ep_key"/>
        #end
        </send>
        #end

        ######################## End of Macros ######################################

<api xmlns="http://ws.apache.org/ns/synapse"  name="$!apiName" context="$!apiContext" version="$!apiVersion" transports="$!transport" version-type="context">
#if($apiIsBlocked)
## if API is blocked send the API Block message
<resource methods="GET POST PUT DELETE PATCH" url-mapping="/*" faultSequence=#print_string_if_exist($faultSequence "fault")>
<inSequence>
    <payloadFactory>
        <format>
            <am:fault xmlns:am="http://wso2.org/apimanager">
                <am:code>700700</am:code>
                <am:message>API blocked</am:message>
                <am:description>This API has been blocked temporarily. Please try again later or contact the system administrators.</am:description>
            </am:fault>
        </format>
    </payloadFactory>
    <property name="HTTP_SC" value="503" scope="axis2"/>
    <property name="RESPONSE" value="true"/>
    <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
    <header name="To" action="remove"/>
    <send/>
</inSequence>
</resource>
        #else
        ## api not blocked
        #set ($resourceNo = 0)
        #foreach($resource in $resources)

<resource xmlns="http://ws.apache.org/ns/synapse"
        #if($resource.getUriTemplate().contains("{") ||
        ($resource.getUriTemplate().contains("*") && !$resource.getUriTemplate().endsWith("/*")))
        uri-template="$util.escapeXml($resource.getUriTemplate())"
        #else
        url-mapping="$resource.getUriTemplate()"
        #end
        methods="$resource.getMethodsAsString()" faultSequence=#print_string_if_exist($faultSequence "fault")>
<inSequence>
## check and set response caching
#if($responseCacheEnabled)
<cache scope="per-host" collector="false" hashGenerator="org.wso2.carbon.mediator.cache.digest.REQUESTHASHGenerator" timeout="$!responseCacheTimeOut">
    <implementation type="memory" maxSize="500"/>
</cache>
#end
<property name="api.ut.backendRequestTime" expression="get-property('SYSTEM_TIME')"/>
#if($isSoapToRestMode)
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>
#foreach($uri in $in_sequences.get("$resource.getUriTemplate()").keySet())
$in_sequences.get("$resource.getUriTemplate()").get($uri)
#end
#end
##############  define the filter based on environment type production only, sandbox only , hybrid ############

#if(($environmentType == 'sandbox') || ($environmentType =='hybrid' && !$endpoint_config.get("production_endpoints") ))
#set( $filterRegex = "SANDBOX" )
#else
#set( $filterRegex = "PRODUCTION" )
#end
## AWS Lambda: start
#if($endpoint_config.get("endpoint_type") == 'awslambda')
#set( $accessKey = $!{endpoint_config.get("amznAccessKey")} )
#set( $secretKey = $!{endpoint_config.get("amznSecretKey")} )
#set( $resourceName = $!{resource.getAmznResourceName()} )
<class name="org.wso2.carbon.apimgt.gateway.mediators.AWSLambdaMediator">
    #if($accessKey != '')
    <property name="accessKey" value="$accessKey"/>
    #end
    #if($secretKey != '')
    <property name="secretKey" value="$secretKey"/>
    #end
    #if($resourceName != '')
    <property name="resourceName" value="$resourceName"/>
    #end
</class>
<loopback />
## AWS Lambda: end
#else
#if($apiStatus != 'PROTOTYPED' && $apiIsOauthProtected)
<filter source="$ctx:AM_KEY_TYPE" regex="$filterRegex">
    <then>
        #end
        #if(($environmentType == 'sandbox') || ($environmentType =='hybrid' && ! $endpoint_config.get("production_endpoints") ))
        #draw_endpoint( "sandbox" $endpoint_config )
        #else
        #draw_endpoint( "production" $endpoint_config )
        #end
        #if($apiStatus != 'PROTOTYPED' && $apiIsOauthProtected)
    </then>
    <else>
        #if($environmentType !='hybrid')
        <payloadFactory>
            <format>
                <error xmlns="">
                    #if($environmentType == 'production')
                    <message>Sandbox Key Provided for Production Gateway</message>
                    #elseif($environmentType == 'sandbox')
                    <message>Production Key Provided for Sandbox Gateway</message>
                    #end
                </error>
            </format>
        </payloadFactory>
        <property name="ContentType" value="application/xml" scope="axis2"/>
        <property name="RESPONSE" value="true"/>
        <header name="To" action="remove"/>
        <property name="HTTP_SC" value="401" scope="axis2"/>
        <property name="NO_ENTITY_BODY" scope="axis2" action="remove"/>
        <send/>
        #else
        #if($endpoint_config.get("production_endpoints") && $endpoint_config.get("sandbox_endpoints"))
        #draw_endpoint( "sandbox" $endpoint_config )
        #elseif($endpoint_config.get("production_endpoints"))
        <sequence key="_sandbox_key_error_"/>
        #elseif($endpoint_config.get("sandbox_endpoints"))
        <sequence key="_production_key_error_"/>
        #end
        #end
    </else>
</filter>
#end
#end
</inSequence>
<outSequence>
#if($isSoapToRestMode)
#foreach($uri in $out_sequences.get("$resource.getUriTemplate()").keySet())
$out_sequences.get("$resource.getUriTemplate()").get($uri)
#end
#end
#if($apiStatus != 'PROTOTYPED')
<class name="org.wso2.carbon.apimgt.gateway.handlers.analytics.APIMgtResponseHandler"/>
#end
## check and set response caching
#if($responseCacheEnabled)
<cache scope="per-host" collector="true"/>
#end
<send/>
</outSequence>
        </resource>
        #set ($resourceNo = $resourceNo + 1)
        #end  ## end of resource iterator
        ## print the handlers
        #if($handlers.size() > 0)
<handlers xmlns="http://ws.apache.org/ns/synapse">
<handler class="org.wso2.carbon.test.CustomAPIResponseHandler"/>
#foreach($handler in $handlers)
<handler xmlns="http://ws.apache.org/ns/synapse" class="$handler.className">
    #if($handler.hasProperties())
    #set ($map = $handler.getProperties() )
    #foreach($property in $map.entrySet())
    <property name="$!property.key" value="$!property.value"/>
    #end
    #end
</handler>
#end
## check and set enable schema validation
#if($enableSchemaValidation)
<handler class="org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator"/>
#end
</handlers>
        #end
        #end
        #if($apiStatus == 'PROTOTYPED')
        #end
        ## end of apiIsBlocked check
</api>
        <!--$endpoint_security-->

with this jar file and the velocity_template.xml,it's working in the product-apim and not working in the am-pattern-2 in the kubernetes. Here's the ERROR log:

[2020-08-17 06:23:16,350] ERROR - APIGatewayManager Error occurred when publish to gateway Production and Sandbox
org.apache.axis2.AxisFault: Error while Deploying API 
    at org.wso2.carbon.apimgt.impl.utils.APIGatewayAdminClient.deployAPI_aroundBody12(APIGatewayAdminClient.java:173) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.utils.APIGatewayAdminClient.deployAPI(APIGatewayAdminClient.java:168) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIGatewayManager.publishToGateway_aroundBody2(APIGatewayManager.java:216) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIGatewayManager.publishToGateway(APIGatewayManager.java:104) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.publishToGateway_aroundBody94(APIProviderImpl.java:2037) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.publishToGateway(APIProviderImpl.java:2009) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.propergateAPIStatusChangeToGateways_aroundBody82(APIProviderImpl.java:1809) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.propergateAPIStatusChangeToGateways(APIProviderImpl.java:1775) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.propergateAPIStatusChangeToGateways_aroundBody28(UserAwareAPIProvider.java:175) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.propergateAPIStatusChangeToGateways(UserAwareAPIProvider.java:172) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.executors.APIExecutor.changeLifeCycle_aroundBody4(APIExecutor.java:182) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.executors.APIExecutor.changeLifeCycle(APIExecutor.java:150) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.executors.APIExecutor.execute_aroundBody2(APIExecutor.java:128) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.executors.APIExecutor.execute(APIExecutor.java:89) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.runCustomExecutorsCode(DefaultLifeCycle.java:712) [org.wso2.carbon.governance.registry.extensions_4.8.14.jar:?]
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.invoke(DefaultLifeCycle.java:450) [org.wso2.carbon.governance.registry.extensions_4.8.14.jar:?]
    at org.wso2.carbon.governance.registry.eventing.handlers.GovernanceEventingHandler.invokeAspect(GovernanceEventingHandler.java:366) [org.wso2.carbon.governance.registry.eventing_4.8.14.jar:?]
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.invokeAspect(HandlerManager.java:2794) [org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.invokeAspect(HandlerLifecycleManager.java:518) [org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.invokeAspect(EmbeddedRegistry.java:2607) [org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.invokeAspect(CacheBackedRegistry.java:510) [org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.session.UserRegistry.invokeAspect(UserRegistry.java:1964) [org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:829) [org.wso2.carbon.governance.api_4.8.14.jar:?]
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:808) [org.wso2.carbon.governance.api_4.8.14.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus_aroundBody242(APIProviderImpl.java:5140) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus(APIProviderImpl.java:5067) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus_aroundBody74(UserAwareAPIProvider.java:339) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus(UserAwareAPIProvider.java:335) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.apisChangeLifecyclePost(ApisApiServiceImpl.java:3696) [classes/:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.apisChangeLifecyclePost(ApisApi.java:818) [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) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) [tomcat-servlet-api_9.0.31.wso2v1.jar:?]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:86) [org.wso2.carbon.identity.context.rewrite.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110) [org.wso2.carbon.identity.authz.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:75) [org.wso2.carbon.identity.auth.valve_1.4.0.jar:?]
  at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:119) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat_9.0.31.wso2v1.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    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) [?:?]
[2020-08-17 06:23:17,461] ERROR - DefaultLifeCycle org.wso2.carbon.registry.core.exceptions.RegistryException: Execution failed for action : Publish Embedded error : FaultGatewaysException:{"PUBLISHED":{"Production and Sandbox":"Error while Deploying API "},"UNPUBLISHED":{}}
[2020-08-17 06:23:17,498] ERROR - GovernanceArtifactImpl Invoking lifecycle action "Publish" failed. Execution failed for action : Publish Embedded error : FaultGatewaysException:{"PUBLISHED":{"Production and Sandbox":"Error while Deploying API "},"UNPUBLISHED":{}}
org.wso2.carbon.registry.core.exceptions.RegistryException: Execution failed for action : Publish Embedded error : FaultGatewaysException:{"PUBLISHED":{"Production and Sandbox":"Error while Deploying API "},"UNPUBLISHED":{}}
    at org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle.invoke(DefaultLifeCycle.java:482) ~[org.wso2.carbon.governance.registry.extensions_4.8.14.jar:?]
    at org.wso2.carbon.governance.registry.eventing.handlers.GovernanceEventingHandler.invokeAspect(GovernanceEventingHandler.java:366) ~[org.wso2.carbon.governance.registry.eventing_4.8.14.jar:?]
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.invokeAspect(HandlerManager.java:2794) ~[org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.invokeAspect(HandlerLifecycleManager.java:518) ~[org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.invokeAspect(EmbeddedRegistry.java:2607) ~[org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.invokeAspect(CacheBackedRegistry.java:510) ~[org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.registry.core.session.UserRegistry.invokeAspect(UserRegistry.java:1964) ~[org.wso2.carbon.registry.core_4.6.0.jar:?]
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:829) [org.wso2.carbon.governance.api_4.8.14.jar:?]
    at org.wso2.carbon.governance.api.common.dataobjects.GovernanceArtifactImpl.invokeAction(GovernanceArtifactImpl.java:808) [org.wso2.carbon.governance.api_4.8.14.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus_aroundBody242(APIProviderImpl.java:5140) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus(APIProviderImpl.java:5067) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus_aroundBody74(UserAwareAPIProvider.java:339) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus(UserAwareAPIProvider.java:335) [org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.apisChangeLifecyclePost(ApisApiServiceImpl.java:3696) [classes/:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.apisChangeLifecyclePost(ApisApi.java:818) [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) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) [tomcat-servlet-api_9.0.31.wso2v1.jar:?]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:86) [org.wso2.carbon.identity.context.rewrite.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110) [org.wso2.carbon.identity.authz.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:75) [org.wso2.carbon.identity.auth.valve_1.4.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:119) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat_9.0.31.wso2v1.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    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) [?:?]
[2020-08-17 06:23:17,534] ERROR - ApisApiServiceImpl Error while updating the API in Gateway a85d785e-a27c-42d4-9f74-d6badaa07c9c
org.wso2.carbon.apimgt.api.FaultGatewaysException: null
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus_aroundBody242(APIProviderImpl.java:5165) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus(APIProviderImpl.java:5067) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus_aroundBody74(UserAwareAPIProvider.java:339) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus(UserAwareAPIProvider.java:335) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.apisChangeLifecyclePost(ApisApiServiceImpl.java:3696) [classes/:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.apisChangeLifecyclePost(ApisApi.java:818) [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) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
  at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) [tomcat-servlet-api_9.0.31.wso2v1.jar:?]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:86) [org.wso2.carbon.identity.context.rewrite.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110) [org.wso2.carbon.identity.authz.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:75) [org.wso2.carbon.identity.auth.valve_1.4.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:119) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat_9.0.31.wso2v1.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    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) [?:?]
[2020-08-17 06:23:17,534] ERROR - ApisApiServiceImpl Error while updating the API in Gateway a85d785e-a27c-42d4-9f74-d6badaa07c9c
org.wso2.carbon.apimgt.api.FaultGatewaysException: null
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus_aroundBody242(APIProviderImpl.java:5165) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.APIProviderImpl.changeLifeCycleStatus(APIProviderImpl.java:5067) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus_aroundBody74(UserAwareAPIProvider.java:339) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.changeLifeCycleStatus(UserAwareAPIProvider.java:335) ~[org.wso2.carbon.apimgt.impl_6.6.163.jar:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.impl.ApisApiServiceImpl.apisChangeLifecyclePost(ApisApiServiceImpl.java:3696) [classes/:?]
    at org.wso2.carbon.apimgt.rest.api.publisher.v1.ApisApi.apisChangeLifecyclePost(ApisApi.java:818) [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) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) [cxf-rt-frontend-jaxrs-3.2.8.jar:3.2.8]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) [cxf-core-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:216) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) [tomcat-servlet-api_9.0.31.wso2v1.jar:?]
    at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) [cxf-rt-transports-http-3.2.8.jar:3.2.8]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:86) [org.wso2.carbon.identity.context.rewrite.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110) [org.wso2.carbon.identity.authz.valve_1.4.0.jar:?]
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:75) [org.wso2.carbon.identity.auth.valve_1.4.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) [tomcat_9.0.31.wso2v1.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:119) [org.wso2.carbon.tomcat.ext_4.6.0.jar:?]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) [tomcat_9.0.31.wso2v1.jar:?]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat_9.0.31.wso2v1.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
    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) [?:?]

**Affected Product Version:3.1.0

**OS, DB, other environment details and versions:CentOS, Kubernetes, JAVA11, mysql