WSO2 API Manager 身份验证违反 UNIQUE KEY 约束错误

时间:2023-02-28
本文介绍了WSO2 API Manager 身份验证违反 UNIQUE KEY 约束错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我们已经在分布式架构中实现了 WSO2 API Manager (v1.10.0),如在线文档中所述

我试过谷歌搜索这个,但找不到最新的答案.

我尚未将密钥管理器配置为具有主节点和工作节点(如此处),因为文档似乎表明不需要这样做.

如有任何帮助,将不胜感激!

解决方案

我使用 mysql 并面临同样的问题.更改池大小也不是一个完整的解决方案.然后我注意到 idn_oauth2_access_token 表有些奇怪.有一列time_created,但内容不是创建的时间.这是最后一次更新时间戳.我在 time_created 列中的几列上读到了系统命令.我检查了我的 sql 脚本,看到数据库在触发更新时更新了此列.我删除了这个规则,我没有更多的错误.

We have implemented WSO2 API Manager (v1.10.0) in a distributed architecture as outlined in the online documentation here.

This consists of the following (on 5 separate servers):

  • Gateway (x2)
  • Publisher & Store (on a single server)
  • Key Manager (x2)

These are wired-up to the 3 normal API Manager databases (Registry, User Manager & API Manager), which are on a SQL Server 2014 instance.

We are using the Key Managers for the authentication (login, forgotten password, etc.) of the website users, as well as for authenticating API calls.

However, when trying to log in to the site I'm seeing the following (Violation of UNIQUE KEY constraint) error on the Key Manager:

TID: [-1] [] [2016-10-06 00:36:47,842] ERROR {org.wso2.carbon.identity.oauth2.dao.TokenPersistenceTask} - Error occurred while persisting access token :c5a0a11e63388dCHANGEDea34b0533445 {org.wso2.carbon.identity.oauth2.dao.TokenPersistenceTask} org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception: Error when storing the access token for consumer key : fpA6AhOfbVCHANGEDgH0WzBDOga at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.storeAccessToken(TokenMgtDAO.java:246) at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.persistAccessToken(TokenMgtDAO.java:284) at org.wso2.carbon.identity.oauth2.dao.TokenPersistenceTask.run(TokenPersistenceTask.java:52) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Violation of UNIQUE KEY constraint 'CON_APP_KEY'. Cannot insert duplicate key in object 'dbo.IDN_OAUTH2_ACCESS_TOKEN'. The duplicate key value is (15, williams.j2@CHANGED.org.uk, -1234, , APPLICATION_USER, 369db21a386ae4CHANGED0ff34d35708d, ACTIVE, NONE). at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:332) at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.storeAccessToken(TokenMgtDAO.java:224) ... 5 more

This is resulting in the following .NET error on the website:

I've tried Googling this, but cannot find an up-to-date answer.

I have not configured the Key Managers to have master and worked nodes (as outlined here) as the documentation seems to suggest that this isn't needed.

Any help would be much appreciated please!

解决方案

I use mysql and was facing the same problem. Changing the poolsize was also not a full solution. Then I noticed something strange about the idn_oauth2_access_token table. There is a column time_created, but the contents was not the time created. It was the last update timestamp. I read somewhere the systems orders on several columns among the time_created column. I inspected my sql script and saw that the database updated this column when a update was fired. I removed this rule and I have no more errors.

这篇关于WSO2 API Manager 身份验证违反 UNIQUE KEY 约束错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:将图像从 WPF 控件保存到 SQL Server DB 下一篇:Xamarin SQLite“这是‘诱饵’"

相关文章

最新文章