Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
2.7.0
Description
Long cannot be cast to String error when changing a user's password:
30 Jan 2018 18:21:11,308 ERROR [ambari-client-thread-38] AbstractResourceProvider:353 - Caught AmbariException when modifying a resource org.apache.ambari.server.AmbariException: java.lang.Long cannot be cast to java.lang.String at org.apache.ambari.server.controller.internal.UserResourceProvider.addOrUpdateLocalAuthenticationSource(UserResourceProvider.java:559) at org.apache.ambari.server.controller.internal.UserResourceProvider.updateUsers(UserResourceProvider.java:486) at org.apache.ambari.server.controller.internal.UserResourceProvider.access$200(UserResourceProvider.java:69) at org.apache.ambari.server.controller.internal.UserResourceProvider$3.invoke(UserResourceProvider.java:264) at org.apache.ambari.server.controller.internal.UserResourceProvider$3.invoke(UserResourceProvider.java:261) at org.apache.ambari.server.controller.internal.AbstractResourceProvider.invokeWithRetry(AbstractResourceProvider.java:465) at org.apache.ambari.server.controller.internal.AbstractResourceProvider.modifyResources(AbstractResourceProvider.java:346) at org.apache.ambari.server.controller.internal.UserResourceProvider.updateResources(UserResourceProvider.java:261) at org.apache.ambari.server.controller.internal.ClusterControllerImpl.updateResources(ClusterControllerImpl.java:317) ...
Steps to reproduce
- Create a LOCAL user account (using either the Ambari UI or REST API)
POST /api/v1/users
Payload{ "Users" : { "user_name" : "myuser", "password" : "hadoop" } }
- Change the user's password (using either the Ambari UI or REST API via the users entry point)
PUT /api/v1/users/myuser
Payload{ "Users" : { "old_password" : "hadoop" "password" : "hadoop1234" } }
Response{ "status" : 500, "message" : "org.apache.ambari.server.controller.spi.SystemException: An internal system exception occurred: java.lang.Long cannot be cast to java.lang.String" }
Cause
When building the internal request to set the user's password via the UserAuthenticationSource resource provider, the authentication source key is set as a Long. The UserAuthenticationSource resource provider expects this value to be a String.
Solution
The User resource provider should set the AuthenticationSourceInfo/source_id as a String value.
Attachments
Issue Links
- links to