0
votes

I have setup a WSO2 API Manager with SQL server as the Primary User Store. and we have Configured list of APIs in it. We are frequently getting the Error when validating a refresh token error. what could be the cause of it?

TID: [-1234] [] [2019-09-26 18:28:02,274] ERROR {org.wso2.carbon.identity.oauth2.OAuth2Service} -  Error occurred while issuing the access token for Client ID : oQL_XBIHH75J2qj_ixQ2V_siKbMa, User ID null, Scope : [default] and Grant Type : refresh_token {org.wso2.carbon.identity.oauth2.OAuth2Service}
org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception: Error when validating a refresh token

    at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.validateRefreshToken(TokenMgtDAO.java:923)
    at org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler.issue(RefreshGrantHandler.java:167)
    at org.wso2.carbon.identity.oauth2.token.AccessTokenIssuer.issue(AccessTokenIssuer.java:257)
    at org.wso2.carbon.identity.oauth2.OAuth2Service.issueAccessToken(OAuth2Service.java:223)
    at org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint.getAccessToken(OAuth2TokenEndpoint.java:287)
    at org.wso2.carbon.identity.oauth.endpoint.token.OAuth2TokenEndpoint.issueAccessToken(OAuth2TokenEndpoint.java:151)
    at sun.reflect.GeneratedMethodAccessor89.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
    at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
    at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)


Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Transaction (Process ID 164) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)
    at com.microsoft.sqlserver.jdbc.SQLServerResultSet$FetchBuffer.nextRow(SQLServerResultSet.java:4700)
    at com.microsoft.sqlserver.jdbc.SQLServerResultSet.fetchBufferNext(SQLServerResultSet.java:1683)
    at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:956)
    at org.wso2.carbon.identity.oauth2.dao.TokenMgtDAO.validateRefreshToken(TokenMgtDAO.java:883)
    ... 57 more
1

1 Answers

0
votes

You need to set the SendStringParametersAsUnicode parameter in the datasource configuration in /repository/conf/datasources/master-datasources.xml Change the datasource url parameter on the datasources that pointing to MSSQL databases,

<url>jdbc:sqlserver://MSSQL_URL:5023;databaseName=SSO_INTERNAL_540;encrypt=true;trustServerCertificate=true;SendStringParametersAsUnicode=false</url>

Full details of this parameter of the MSSQL JDBC driver is well explained in here.