我正在尝试使用UserStoreManager在WSO2身份服务器中添加用户帐户。我可以毫无问题地添加一个或多个声明值的用户,但是当我尝试在声明的 map 中添加多个声明值时,会抛出异常:

org.wso2.carbon.um.ws.api.WSUserStoreManager handleException
SEVERE: Can not access the directory context oruser already exists in the system
org.apache.axis2.AxisFault: Can not access the directory context oruser already exists in the system..

这是我使用的代码
Map<String, String> claims = new HashMap<String, String>();
claims.put("http://wso2.org/claims/givenname", "John");
//second value causing the exception
claims.put("http://wso2.org/claims/lastname", "Doe");
STORE_MANAGER.addUser("JohnDoe", "123456",
      new String[] { Constants.DEFAULT_ROLE }, claims, "default");

最佳答案

您使用的IS是什么版本?

顺便说一句,请尝试这个

Map<String, String> claims = new HashMap<String, String>();

claims.put("http://wso2.org/claims/givenname", "John");

claims.put("http://wso2.org/claims/lastname", "Doe");

remoteUserStoreManager.addUser("JohnDoe", "123456",null, claims, "default");

10-06 12:59