SoftwareAG / webmethods-api-control-plane

webMethods API Control Plane enables centralized platform to manage API Mangement products. It offers functionalities to make decisions based on the performance metrics and patterns. Repository hosting tutorials, code samples, OpenAPI specification files and postman collections.
Apache License 2.0
6 stars 4 forks source link

Control plane Agent startup failed with exception:: java.lang.NullPointerException #13

Closed thesse1 closed 10 months ago

thesse1 commented 11 months ago

I am running API Gateway 10.15.0.7.266 on Azure Kubernetes Services (AKS) deployed using Helm charts with the image from containers.softwareag.com. I have added the following configuration for the Control Plane agent:

cp-agent.yml:
----
enabled: true
runtimeConfig:
  runtimeName: "API_Gateway_THES_CONFIG"
  deploymentType: "PRIVATE_CLOUD"
  description: "A demo deployment of SAG API Gateway CONFIG environment"
  heartBeatIntervalInSeconds: 30
  metricsSynchIntervalInSeconds: 30
  assetSynchIntervalInSeconds: 30
  region: "azure-westeurope"
  location: "Hamburg"
  host: "http://config-apigateway-ui.azuredemo-softwareag.com/"
  tags:
     - thes-demo
     - config
  capacity:
     value: 1000
     units: "per second"
controlPlaneConfig:
  controlPlaneURL: "https://presalesdemos.apicp-az-eu.webmethods.io"
  username: "thomas.hesse@softwareag.com"
  password: "***"

But the API Gateway does not show up in the Control Plane. In server.log, I found the following NullPointerException:

2023-08-14 16:27:17 GMT [YAI.0015.8889I] (tid=297) [default][azure-demo-apigateway-78d78df5bd-rjc6r]  Control plane agent  not configured with environment properties.So trying to read from file. 
2023-08-14 16:27:17 GMT [YAI.0005.9999E] (tid=297) Control plane Agent startup failed with exception:: java.lang.NullPointerException
com.softwareag.controlplane.agent.core.configuration.AllSourcesConfigurationProvider.isControlPlaneAgentConfigured(AllSourcesConfigurationProvider.java:81)
com.softwareag.controlplane.agent.core.init.Agent.start(Agent.java:30)
com.softwareag.controlplane.agent.apigateway.impl.RuntimeAPIGatewayDataProvider.initializeAgent(RuntimeAPIGatewayDataProvider.java:29)
com.softwareag.apigateway.is.init.ISPackageManager.startup(ISPackageManager.java:218)
apigateway.startup(apigateway.java:57)
...

PFA the full server.log file.

I also tried with just the mandatory parameters:

cp-agent.yml:
----
enabled: true
runtimeConfig:
  runtimeName: "API_Gateway_THES_CONFIG"
  # deploymentType: "PRIVATE_CLOUD"
  # description: "A demo deployment of SAG API Gateway CONFIG environment"
  # heartBeatIntervalInSeconds: 30
  # metricsSynchIntervalInSeconds: 30
  # assetSynchIntervalInSeconds: 30
  # region: "azure-westeurope"
  # location: "Hamburg"
  # host: "http://config-apigateway-ui.azuredemo-softwareag.com/"
  # tags:
  #    - thes-demo
  #    - config
  # capacity:
  #    value: 1000
  #    units: "per second"
controlPlaneConfig:
  controlPlaneURL: "https://presalesdemos.apicp-az-eu.webmethods.io"
  username: "thomas.hesse@softwareag.com"
  password: "***"

Same result. What am I doing wrong? How can I increase the log level for the agent? Maybe the user does not have enough rights in the Control Plane?

In trace mode, the log does not reveal much more:

2023-08-14 18:30:30 GMT [YAI.0015.8887D] (tid=296) [default][azure-demo-apigateway-78d78df5bd-m7qkr]  Debug: ---------Starting Control plane Agent startup------- 
2023-08-14 18:30:30 GMT [YAI.0015.8887D] (tid=296) [default][azure-demo-apigateway-78d78df5bd-m7qkr]  Debug: Not Configuration provider set. Using AllSourcesConfigurationProvider by default 
2023-08-14 18:30:30 GMT [YAI.0015.8889I] (tid=296) [default][azure-demo-apigateway-78d78df5bd-m7qkr]  Control plane agent  not configured with environment properties.So trying to read from file. 
2023-08-14 18:30:30 GMT [YAI.0015.8887D] (tid=296) [default][azure-demo-apigateway-78d78df5bd-m7qkr]  Debug: Reading from YAML file.Executing YAMLConfigurationSource  
2023-08-14 18:30:30 GMT [YAI.0015.8887D] (tid=296) [default][azure-demo-apigateway-78d78df5bd-m7qkr]  Debug: Reading Control plane agent configuration from:/opt/softwareag/IntegrationServer/instances/default/packages/WmAPIGateway/resources/configuration/cp-agent.yml 
2023-08-14 18:30:30 GMT [YAI.0005.9999E] (tid=296) Control plane Agent startup failed with exception:: java.lang.NullPointerException
com.softwareag.controlplane.agent.core.configuration.AllSourcesConfigurationProvider.isControlPlaneAgentConfigured(AllSourcesConfigurationProvider.java:81)
com.softwareag.controlplane.agent.core.init.Agent.start(Agent.java:30)
com.softwareag.controlplane.agent.apigateway.impl.RuntimeAPIGatewayDataProvider.initializeAgent(RuntimeAPIGatewayDataProvider.java:29)
com.softwareag.apigateway.is.init.ISPackageManager.startup(ISPackageManager.java:218)
apigateway.startup(apigateway.java:57)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:566)
com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:405)
com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java:761)
com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(ReservationProcessor.java:39)
com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsProcessor.java:67)
com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCompletionImpl.java:243)
com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProcessor.java:49)
com.wm.app.b2b.server.invoke.PipelineProcessor.process(PipelineProcessor.java:171)
com.wm.app.b2b.server.ACLManager.process(ACLManager.java:339)
com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProcessor.java:33)
com.wm.app.b2b.server.invoke.ConcurrentRequestLimitProcessor.process(ConcurrentRequestLimitProcessor.java:57)
com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:400)
com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:631)
com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:436)
com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:394)
com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:260)
com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:116)
com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:75)
com.wm.app.b2b.server.SessionInvoke.run(SessionInvoke.java:30)
com.wm.util.pool.PooledThread.run(PooledThread.java:127)
java.base/java.lang.Thread.run(Thread.java:829)
 {1} 

Thanks! Best regards, Thomas

thesse1 commented 11 months ago

server.log

thesse1 commented 11 months ago

server_trace.zip

thesse1 commented 11 months ago

FYI: I managed to make it work using environment variables instead of cp-agent.yml ConfigMap. But it would be much more convenient (and closer to Kubernetes best practices, I believe) to inject the configuration using ConfigMap. Why is that not working?

MadhavanKidambiVaradan commented 11 months ago

@thesse1

The agentConfig key is missing in the YAML file. It should be as `below.

cp-agent.yml:
----
agentConfig:
  enabled: true
  runtimeConfig:
    runtimeName: "API_Gateway_THES_CONFIG"
    # deploymentType: "PRIVATE_CLOUD"
    # description: "A demo deployment of SAG API Gateway CONFIG environment"
    # heartBeatIntervalInSeconds: 30
    # metricsSynchIntervalInSeconds: 30
    # assetSynchIntervalInSeconds: 30
    # region: "azure-westeurope"
    # location: "Hamburg"
    # host: "http://config-apigateway-ui.azuredemo-softwareag.com/"
    # tags:
    #    - thes-demo
    #    - config
    # capacity:
    #    value: 1000
    #    units: "per second"
  controlPlaneConfig:
    controlPlaneURL: "https://presalesdemos.apicp-az-eu.webmethods.io"
    username: "thomas.hesse@softwareag.com"
    password: "***"
MadhavanKidambiVaradan commented 11 months ago

@thesse1 Did you have a chance to try out this?

thesse1 commented 10 months ago

@MadhavanKidambiVaradan Thanks for your help! It is working fine with the agentConfig key. Thanks!