wso2 / api-manager

All issues, tasks, improvements and new features of WSO2 API Manager
Apache License 2.0
34 stars 8 forks source link

Throws a Nullpointerexception (Npe) Exception When a User Credential or SSL Error Is Thrown. #2323

Open Abshan opened 9 months ago

Abshan commented 9 months ago

Description

When APIM-3.2.0 is configured with the APIM-Analytics 3.2.0 version, during the connection establishment process with the Analytics auth URL (ssl://localhost:7711) if an "DataEndpointLoginException" is thrown, the following NPE exception would get printed in the carbon.logs without a proper cause for the error message.

ERROR - APIMgtUsageDataBridgeDataPublisher Error initializing APIMgtUsageDataBridgeDataPublisher
java.lang.NullPointerException: null
    at org.wso2.carbon.databridge.agent.endpoint.DataEndpointConnectionWorker.runConnection(DataEndpointConnectionWorker.java:124) ~[org.wso2.carbon.databridge.agent_5.2.26.10.jar:?]
    at org.wso2.carbon.databridge.agent.endpoint.DataEndpoint.connect(DataEndpoint.java:163) ~[org.wso2.carbon.databridge.agent_5.2.26.10.jar:?]
    at org.wso2.carbon.databridge.agent.endpoint.DataEndpoint.initialize(DataEndpoint.java:193) ~[org.wso2.carbon.databridge.agent_5.2.26.10.jar:?]
    at org.wso2.carbon.databridge.agent.DataPublisher.processEndpoints(DataPublisher.java:204) ~[org.wso2.carbon.databridge.agent_5.2.26.10.jar:?]
    at org.wso2.carbon.databridge.agent.DataPublisher.<init>(DataPublisher.java:128) ~[org.wso2.carbon.databridge.agent_5.2.26.10.jar:?]
    at org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher.getDataPublisher(APIMgtUsageDataBridgeDataPublisher.java:117) ~[org.wso2.carbon.apimgt.usage.publisher_6.7.206.19.jar:?]
    at org.wso2.carbon.apimgt.usage.publisher.APIMgtUsageDataBridgeDataPublisher.init(APIMgtUsageDataBridgeDataPublisher.java:48) [org.wso2.carbon.apimgt.usage.publisher_6.7.206.19.jar:?]

The "DataEndpointLoginException" can get thrown for scenarios like invalid credentials defined on either side (APIM or Analytics) or a certificate issue (missing certificate). For all these scenarios the same NPE exception gets thrown.

This needs to be fixed with proper exception handling.

Steps to Reproduce

  1. Configure APIM analytics 3.2 with APIM 3.2.0 version.
  2. Configure invalid credentials on either side.
  3. Start the Analytics worker server first, and then the APIM server.
  4. The above mentioned error log would get printed during the startup logs.

Affected Component

APIM

Version

3.2.0

npamudika commented 8 months ago

@sgayangi Please mention the public PR

npamudika commented 8 months ago

Fixed via https://github.com/wso2/carbon-analytics-common/pull/817