You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Sandor Molnar (Jira)" <ji...@apache.org> on 2022/06/03 05:05:00 UTC
[jira] [Created] (KNOX-2756) NPE occurred while getting service discovery types
Sandor Molnar created KNOX-2756:
-----------------------------------
Summary: NPE occurred while getting service discovery types
Key: KNOX-2756
URL: https://issues.apache.org/jira/browse/KNOX-2756
Project: Apache Knox
Issue Type: Bug
Components: Server
Affects Versions: 2.0.0
Reporter: Sandor Molnar
Assignee: Sandor Molnar
Fix For: 2.0.0
With KNOX-2742 we added the ability to retry automated service discovery using Cloudera Manager in case od certain connection errors.
To be able to do that, the newly introduced retry parameters are configured during the init phase of when an instance of {{ClouderaManagerServiceDiscovery}} is created.
This implementation takes the {{gatewayConfig}} object granted, which is always there when Knox actually uses the service discovery in the descriptors.
However, there is another use case if this class added by KNOX-1914: on our Admin UI, when creating/updating descriptors, there is a call to fetch the available service discoveries to be able to display in a dropdown list. This call creates the {{ClouderaManagerServiceDiscovery}} instance in a way that the given {{gatewayConfig}} attribute is {{null}} -> a NPE exception is thrown:
{noformat}
$ curl -iku admin:admin-password https://localhost:8443/gateway/admin/api/v1/servicediscoveries
HTTP/1.1 500 Server Error
Set-Cookie: KNOXSESSIONID=node010wlhopeuv6je1hcl8qc480wq50.node0; Path=/gateway/admin; Secure; HttpOnly
Set-Cookie: rememberMe=deleteMe; Path=/gateway/admin; Max-Age=0; Expires=Thu, 02-Jun-2022 05:02:44 GMT; SameSite=lax
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=iso-8859-1
Content-Length: 434
Connection: close
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Request failed.</title>
</head>
<body><h2>HTTP ERROR 500 Request failed.</h2>
<table>
<tr><th>URI:</th><td>/gateway/admin/api/v1/servicediscoveries</td></tr>
<tr><th>STATUS:</th><td>500</td></tr>
<tr><th>MESSAGE:</th><td>Request failed.</td></tr>
<tr><th>SERVLET:</th><td>admin-knox-gateway-servlet</td></tr>
</table>
</body>
</html> {noformat}
In {{gateway.log:}}
{noformat}
2022-06-03 07:02:45,686 c4d26549-91c8-41d1-a44e-1c1dead70d30 ERROR knox.gateway (GatewayFilter.java:doFilter(189)) - Gateway processing failed: javax.servlet.ServletException: org.apache.shiro.subject.ExecutionException: java.security.PrivilegedActionException: javax.servlet.ServletException: java.lang.NullPointerException
javax.servlet.ServletException: org.apache.shiro.subject.ExecutionException: java.security.PrivilegedActionException: javax.servlet.ServletException: java.lang.NullPointerException
at org.apache.shiro.web.servlet.AdviceFilter.cleanup(AdviceFilter.java:196) ~[shiro-web-1.8.0.jar:1.8.0]
...
Caused by: java.lang.NullPointerException
at org.apache.knox.gateway.topology.discovery.cm.ClouderaManagerServiceDiscovery.configureRetryParams(ClouderaManagerServiceDiscovery.java:120) ~[gateway-discovery-cm-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.knox.gateway.topology.discovery.cm.ClouderaManagerServiceDiscovery.<init>(ClouderaManagerServiceDiscovery.java:116) ~[gateway-discovery-cm-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.knox.gateway.topology.discovery.cm.ClouderaManagerServiceDiscovery.<init>(ClouderaManagerServiceDiscovery.java:100) ~[gateway-discovery-cm-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.knox.gateway.topology.discovery.cm.ClouderaManagerServiceDiscoveryType.newInstance(ClouderaManagerServiceDiscoveryType.java:35) ~[gateway-discovery-cm-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
at org.apache.knox.gateway.topology.discovery.ServiceDiscoveryFactory.lambda$0(ServiceDiscoveryFactory.java:54) ~[gateway-spi-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT] {noformat}
--
This message was sent by Atlassian Jira
(v8.20.7#820007)