Bug #13822
openServer fails to start with NullPointerException when API publishing is disabled
0%
Description
this issue noticed in device-mgt-core- 5.2.4 version
deployment.toml
[webapp_publisher_configs]
host="https://localhost:9443"
publish_api=false
enable_update_api=false
When API publishing is disabled using the above configuration, cannot start the server and throws a NullPointerException with the following errors.
TID: [-1234] [] [2025-08-19 15:36:17,460] ERROR {org.apache.catalina.core.ContainerBase} - A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:835)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:263)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.wso2.carbon.tomcat.ext.service.ExtendedStandardService.startInternal(ExtendedStandardService.java:52)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:927)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.wso2.carbon.tomcat.internal.CarbonTomcat.start(CarbonTomcat.java:113)
at org.wso2.carbon.tomcat.internal.ServerManager$1.run(ServerManager.java:167)
at java.lang.Thread.run(Thread.java:750)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
... 17 more
Caused by: java.lang.NullPointerException
at io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.listener.APIPublisherLifecycleListener.lifecycleEvent(APIPublisherLifecycleListener.java:158)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:193)
... 23 more
because of the above error we see following also
TID: [-1234] [] [2025-08-19 15:36:53,592] ERROR {org.wso2.carbon.apimgt.throttle.policy.deployer.utils.PolicyUtil} - Error in retrieving throttle policies org.wso2.carbon.apimgt.throttle.policy.deployer.exception.ThrottlePolicyDeployerException: org.wso2.carbon.apimgt.api.APIManagementException: Service not available. 404 response when invoking endpoint!
at org.wso2.carbon.apimgt.throttle.policy.deployer.PolicyRetriever.invokeService(PolicyRetriever.java:242)
at org.wso2.carbon.apimgt.throttle.policy.deployer.PolicyRetriever.getPolicies(PolicyRetriever.java:198)
at org.wso2.carbon.apimgt.throttle.policy.deployer.PolicyRetriever.getAllSubscriptionPolicies(PolicyRetriever.java:87)
at org.wso2.carbon.apimgt.throttle.policy.deployer.utils.PolicyUtil.deployAllPolicies(PolicyUtil.java:159)
at org.wso2.carbon.apimgt.throttle.policy.deployer.utils.ThrottlePolicyStartupListener.run(ThrottlePolicyStartupListener.java:69)
at java.lang.Thread.run(Thread.java:750)
Caused by: org.wso2.carbon.apimgt.api.APIManagementException: Service not available. 404 response when invoking endpoint!
at org.wso2.carbon.apimgt.impl.utils.APIUtil.executeHTTPRequest_aroundBody6(APIUtil.java:587)
at org.wso2.carbon.apimgt.impl.utils.APIUtil.executeHTTPRequest(APIUtil.java:577)
at org.wso2.carbon.apimgt.throttle.policy.deployer.PolicyRetriever.invokeService(PolicyRetriever.java:240)
... 5 more
TID: [-1234] [] [2025-08-19 15:37:13,598] ERROR {org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer} - Error deploying APIs to the Gateway org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.exception.ArtifactSynchronizerException: org.wso2.carbon.apimgt.api.APIManagementException: Service not available. 404 response when invoking endpoint!
at org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.DBRetriever.invokeService_aroundBody10(DBRetriever.java:217)
at org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.DBRetriever.invokeService(DBRetriever.java:196)
at org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.DBRetriever.retrieveAllArtifacts_aroundBody6(DBRetriever.java:128)
at org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.DBRetriever.retrieveAllArtifacts(DBRetriever.java:121)
at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAllAPIsAtGatewayStartup_aroundBody6(InMemoryAPIDeployer.java:200)
at org.wso2.carbon.apimgt.gateway.InMemoryAPIDeployer.deployAllAPIsAtGatewayStartup(InMemoryAPIDeployer.java:183)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener.deployArtifactsAtStartup_aroundBody2(GatewayStartupListener.java:134)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener.deployArtifactsAtStartup(GatewayStartupListener.java:120)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener.deployArtifactsInGateway_aroundBody20(GatewayStartupListener.java:300)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener.deployArtifactsInGateway(GatewayStartupListener.java:289)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener.access$0_aroundBody30(GatewayStartupListener.java:289)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener.access$0(GatewayStartupListener.java:289)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener$AsyncAPIDeployment.run_aroundBody0(GatewayStartupListener.java:387)
at org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener$AsyncAPIDeployment.run(GatewayStartupListener.java:384)
at java.lang.Thread.run(Thread.java:750)
Caused by: org.wso2.carbon.apimgt.api.APIManagementException: Service not available. 404 response when invoking endpoint!
at org.wso2.carbon.apimgt.impl.utils.APIUtil.executeHTTPRequest_aroundBody6(APIUtil.java:587)
at org.wso2.carbon.apimgt.impl.utils.APIUtil.executeHTTPRequest(APIUtil.java:577)
at org.wso2.carbon.apimgt.impl.gatewayartifactsynchronizer.DBRetriever.invokeService_aroundBody10(DBRetriever.java:215)
... 14 more
TID: [-1234] [] [2025-08-19 15:37:13,598] ERROR {org.wso2.carbon.apimgt.gateway.listeners.GatewayStartupListener} - Unable to deploy synapse artifacts at gateway. Next retry in 5 seconds