You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Robert Levas (JIRA)" <ji...@apache.org> on 2018/01/30 18:38:00 UTC

[jira] [Created] (AMBARI-22882) Long cannot be cast to String error when changing a user's password

Robert Levas created AMBARI-22882:
-------------------------------------

             Summary: Long cannot be cast to String error when changing a user's password
                 Key: AMBARI-22882
                 URL: https://issues.apache.org/jira/browse/AMBARI-22882
             Project: Ambari
          Issue Type: Bug
          Components: ambari-server
    Affects Versions: 2.7.0
            Reporter: Robert Levas
            Assignee: Robert Levas
             Fix For: 2.7.0


Long cannot be cast to String error when changing a user's password:
{noformat}
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)
...
{noformat}

*Steps to reproduce*
 # Create a {{LOCAL}} user account (using either the Ambari UI or REST API)
{noformat}
POST /api/v1/users
{noformat}
{code:title=Payload}
{ 
  "Users" : {
    "user_name" : "myuser",
    "password" : "hadoop"
  }
}
{code}
 # Change the user's password (using either the Ambari UI or REST API via the users entry point)
{noformat}
PUT /api/v1/users/myuser
{noformat}
{code:title=Payload}
{ 
  "Users" : {
    "old_password" : "hadoop"
    "password" : "hadoop1234"
  }
}
{code}
{code:title=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"
}
{code}

*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 UserAuthenticationSource resource provider should accept the {{AuthenticationSourceInfo/source_id}} as either a {{Numeric}} or a {{String}} value that ultimately translates to a {{Long}}. 





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)