title: How to fix " Error in attribute conversion operation, data 0, v3839]; remaining name 'cn=username"
body: <p>I have created a secondary Active Directory user store in WSO2 Identity server.
  Following is the configuration of the user store:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;UserStoreManager class="org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager"&gt;
        &lt;Property name="ConnectionURL"&gt;ldaps://knpdc01.knp.nepal:636&lt;/Property&gt;
        &lt;Property name="ConnectionName"&gt;administrator@knp.nepal&lt;/Property&gt;
        &lt;Property encrypted="true" name="ConnectionPassword"&gt;eyJjIjoiUWZNOWx6QmJtVmxFaDhsbzJuU2ZhaHF3b2JVckF0ckErSGRIeFZoMm5sSHJtci9mK0d1dk5WeklkcG1GTE$
        &lt;Property name="UserSearchBase"&gt;CN=Users,DC=knp,DC=nepal&lt;/Property&gt;
        &lt;Property name="UserEntryObjectClass"&gt;user&lt;/Property&gt;
        &lt;Property name="UserNameAttribute"&gt;cn&lt;/Property&gt;
        &lt;Property name="UserNameSearchFilter"&gt;(&amp;amp;(objectClass=person)(cn=?))&lt;/Property&gt;
        &lt;Property name="UserNameListFilter"&gt;(objectClass=person)&lt;/Property&gt;
        &lt;Property name="UserDNPattern"&gt;cn={0},ou=Users,dc=knp,dc=nepal&lt;/Property&gt;
        &lt;Property name="DisplayNameAttribute"/&gt;
        &lt;Property name="Disabled"&gt;false&lt;/Property&gt;
        &lt;Property name="ReadGroups"&gt;true&lt;/Property&gt;
        &lt;Property name="WriteGroups"&gt;true&lt;/Property&gt;
        &lt;Property name="GroupSearchBase"&gt;CN=Users,DC=knp,DC=nepal&lt;/Property&gt;
        &lt;Property name="GroupEntryObjectClass"&gt;group&lt;/Property&gt;
        &lt;Property name="GroupNameAttribute"&gt;cn&lt;/Property&gt;
        &lt;Property name="GroupNameSearchFilter"&gt;(&amp;amp;(objectClass=group)(cn=?))&lt;/Property&gt;
        &lt;Property name="GroupNameListFilter"&gt;(objectcategory=group)&lt;/Property&gt;
        &lt;Property name="RoleDNPattern"/&gt;
        &lt;Property name="MembershipAttribute"&gt;member&lt;/Property&gt;
        &lt;Property name="MemberOfAttribute"&gt;memberOf&lt;/Property&gt;
        &lt;Property name="BackLinksEnabled"&gt;true&lt;/Property&gt;
        &lt;Property name="Referral"&gt;follow&lt;/Property&gt;
        &lt;Property name="UserNameJavaRegEx"&gt;[a-zA-Z0-9._-|//]{3,30}$&lt;/Property&gt;
        &lt;Property name="UserNameJavaScriptRegEx"&gt;^[\S]{3,30}$&lt;/Property&gt;
        &lt;Property name="UsernameJavaRegExViolationErrorMsg"&gt;Username pattern policy violated.&lt;/Property&gt;
        &lt;Property name="PasswordJavaRegEx"&gt;^[\S]{5,30}$&lt;/Property&gt;
        &lt;Property name="PasswordJavaScriptRegEx"&gt;^[\S]{5,30}$&lt;/Property&gt;
        &lt;Property name="PasswordJavaRegExViolationErrorMsg"&gt;Password pattern policy violated.&lt;/Property&gt;
        &lt;Property name="RoleNameJavaRegEx"&gt;[a-zA-Z0-9._-|//]{3,30}$&lt;/Property&gt;
        &lt;Property name="RoleNameJavaScriptRegEx"&gt;^[\S]{3,30}$&lt;/Property&gt;
        &lt;Property name="SCIMEnabled"&gt;true&lt;/Property&gt;
        &lt;Property name="BulkImportSupported"&gt;true&lt;/Property&gt;
        &lt;Property name="EmptyRolesAllowed"&gt;true&lt;/Property&gt;
        &lt;Property name="PasswordHashMethod"&gt;PLAIN_TEXT&lt;/Property&gt;
        &lt;Property name="MultiAttributeSeparator"&gt;,&lt;/Property&gt;
        &lt;Property name="isADLDSRole"&gt;false&lt;/Property&gt;
        &lt;Property name="userAccountControl"&gt;512&lt;/Property&gt;
        &lt;Property name="MaxUserNameListLength"&gt;100&lt;/Property&gt;
        &lt;Property name="MaxRoleNameListLength"&gt;100&lt;/Property&gt;
        &lt;Property name="kdcEnabled"&gt;false&lt;/Property&gt;
        &lt;Property name="defaultRealmName"&gt;WSO2.ORG&lt;/Property&gt;
        &lt;Property name="UserRolesCacheEnabled"&gt;true&lt;/Property&gt;
        &lt;Property name="ConnectionPoolingEnabled"&gt;false&lt;/Property&gt;
        &lt;Property name="LDAPConnectionTimeout"&gt;5000&lt;/Property&gt;
        &lt;Property name="ReadTimeout"&gt;5000&lt;/Property&gt;
        &lt;Property name="RetryAttempts"&gt;0&lt;/Property&gt;
        &lt;Property name="CountRetrieverClass"/&gt;
        &lt;Property name="java.naming.ldap.attributes.binary"/&gt;
        &lt;Property name="ClaimOperationsSupported"&gt;true&lt;/Property&gt;
        &lt;Property name="transformObjectGUIDToUUID"&gt;true&lt;/Property&gt;
        &lt;Property name="MembershipAttributeRange"&gt;1500&lt;/Property&gt;
        &lt;Property name="UserCacheExpiryMilliseconds"/&gt;
        &lt;Property name="UserDNCacheEnabled"&gt;true&lt;/Property&gt;
        &lt;Property name="StartTLSEnabled"&gt;false&lt;/Property&gt;
        &lt;Property name="DomainName"&gt;knp.nepal&lt;/Property&gt;
        &lt;Property name="Description"/&gt;
  &lt;/UserStoreManager&gt;
  </code></pre>
  
  <p>I am able to list users from secondary on WSO2 Manangement Console User List.</p>
  
  <p>Also using WSO2 SCIM API, I am able to fetch the users:</p>
  
  <pre><code>curl -v -k --header "Authorization: Bearer &lt;Token&gt;"  https://172.28.1.101:9443/scim2/Users
  </code></pre>
  
  <p>But when I try to create user using the SCIM API using commmand:</p>
  
  <pre><code>curl -v -k  --header "Content-Type:application/json" --header "Authorization: Bearer eyJ4NXQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJraWQiOiJOVEF4Wm1NeE5ETXlaRGczTVRVMVpHTTBNekV6T0RKaFpXSTRORE5sWkRVMU9HRmtOakZpTVEiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJhZG1pbiIsImF1ZCI6WyJnd1BzVHg4UGU2czFKTVR4bVZOSEpMdllCZkVhIiwiaHR0cHM6XC9cLzE3Mi4yOC4xLjEwMTo5NDQ0XC9vYXV0aDJcL3Rva2VuIl0sIm5iZiI6MTU2NzY3MzY1MiwiYXpwIjoiZ3dQc1R4OFBlNnMxSk1UeG1WTkhKTHZZQmZFYSIsImlzcyI6Imh0dHBzOlwvXC9sb2NhbGhvc3Q6OTQ0M1wvb2F1dGgyXC90b2tlbiIsImV4cCI6MTU2NzY3NzI1MiwiaWF0IjoxNTY3NjczNjUyLCJqdGkiOiI4MDliMTg5Yi02ODRiLTQ1NjgtYWNiZC02MzRkY2JlMzk2NzYifQ.j-FEQwwSRrcFS1xSY435JEFg6hNrW0_KJK54pAgKPfgPJRz4J2yHVoLNf6dqTmoHB9q9OwcIjuCphVnVXchdK_Ew2fJMyOXttpgILXax_EOTLUgfLLMZv32vp2L_MJmjVCpLRCAndTxDa1gCtaB8thIptdx3MXaf4nudzUtuyyyTXd2q1-aTLpf4Av4SDi7d5BoSwWvUiwnxPAbbvAUZ-re4n1IVj2bPqgojIVgIcNE5vYTU_nbF7gZMB9jwZhj0xR2ytg53686lpAPjrEBqxRWuC9AxTwUhi3bC51Syp8E9V3LWSPqvzaeAl8-orUCWFykX3VIpUD1_9FU6UX3Xuw","refresh_token":"bc5d3a23-d67e-3c6f-80c8-941feb976d46" --data '{"schemas":[],"userName":"john","password":"Wso2@123"}' https://172.28.1.101:9443/wso2/scim/Users
  </code></pre>
  
  <p>I got following error:</p>
  
  <pre><code>Internal server error while creating new resource: Error in adding the user: knp.nepal/john to the user store. Error while adding the user to the Active Directory for user : john
  org.wso2.charon.core.exceptions.CharonException: Error in adding the user: knp.nepal/john to the user store. Error while adding the user to the Active Directory for user : john
  
  
  Caused by: javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C091027, comment: Error in attribute conversion operation, data 0, v3839]; remaining name 'cn=johngmailcom'
      at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3175)
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3100)
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2891)
      at com.sun.jndi.ldap.LdapCtx.c_bind(LdapCtx.java:423)
      at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_bind(ComponentDirContext.java:299)
      at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.bind(PartialCompositeDirContext.java:217)
      at org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager.doAddUser(ActiveDirectoryUserStoreManager.java:169)
      ... 75 more
  
  </code></pre>
  
  <p>I have changed my claim mapping for secondary user store as mentioned <a href="https://docs.wso2.com/display/IS530/Configuring+Active+Directory+User+Stores+for+Inbound+Provisioning#c8e98ce704a84726a0784fef292e7bcb" rel="nofollow noreferrer">here</a></p>
  
  <p><a href="https://i.stack.imgur.com/LOm2x.png" rel="nofollow noreferrer">Claim Configuration</a></p>