You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
WSO2 IS 5.7.25 raises following error with MySQL 5.7 database and maria-db-java-client.jar: org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception: Error occurred while trying to retrieve latest 'ACTIVE' access token for Client ID : awUI98s3ZZkn10bfW_VFcgu7eXga, User ID : ******, and Scope : read at org.wso2.carbon.identity.oauth2.dao.AccessTokenDAOImpl.getLatestAccessToken(AccessTokenDAOImpl.java:473)
... Caused by: java.sql.SQLException: Every derived table must have its own alias at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1594)
Enabled the SQL trace logs for mariadb and investigated the issue, and found out that the something amiss with the query executed at line: 395
Here is the query causing the error: SELECT * FROM (SELECT ACCESS_TOKEN, REFRESH_TOKEN, TIME_CREATED, REFRESH_TOKEN_TIME_CREATED, VALIDITY_PERIOD, REFRESH_TOKEN_VALIDITY_PERIOD,TOKEN_STATE, USER_TYPE, TOKEN_ID, SUBJECT_IDENTIFIER FROM IDN_OAUTH2_ACCESS_TOKEN WHERE CONSUMER_KEY_ID=(SELECT ID FROM IDN_OAUTH_CONSUMER_APPS WHERE CONSUMER_KEY = 'awUI98s3ZZkn10bfW_VFcgu7eXga') AND LOWER(AUTHZ_USER)='mahitaptokpinar' AND TENANT_ID=-1234 AND USER_DOMAIN='BOYKOT-USERSTORE' AND TOKEN_SCOPE_HASH='ecae13117d6f0584c25a9da6c8f8415e' AND TOKEN_STATE='ACTIVE' ORDER BY TIME_CREATED DESC) WHERE ROWNUM < 2
Regarding to the MySQL query syntax, the inner SELECT statement has to have a table alias ('T' or 'T1', etc..).
As digging out, I guess the code hits the 'else' statement at line 363 failing to detect the actual JDBC driver name. Thus, query targets Oracle, instead of MySQL as actual JDBC driver name returns: MariaDB Connector/J
Affected Product Version:
WSO2 IS 5.7.25
OS, DB, other environment details and versions:
OS: CentOS 7.6
DB: MySQL 5.7
Steps to reproduce:
Configure IDENTITY_DB to use MySQL 5.7 and add maria-db-java-client-2.4.1.jar to <PRODUCT_HOME>/repository/components/lib folder.
Description:
WSO2 IS 5.7.25 raises following error with MySQL 5.7 database and maria-db-java-client.jar:
org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception: Error occurred while trying to retrieve latest 'ACTIVE' access token for Client ID : awUI98s3ZZkn10bfW_VFcgu7eXga, User ID : ******, and Scope : read at org.wso2.carbon.identity.oauth2.dao.AccessTokenDAOImpl.getLatestAccessToken(AccessTokenDAOImpl.java:473)
...
Caused by: java.sql.SQLException: Every derived table must have its own alias at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1594)
Full stacktrace is added.
full-trace.txt
While configuring the secondary user store I have faced the 'SSLException Unsupported record version Unknown-0.0' issue with mysql JDBC driver (see https://stackoverflow.com/questions/48947926/jdbc-to-mysql-5-7-21-with-java-1-8-0-162-unsupported-record-version-unknown-0). Changed my driver jar to maria-db-java-client-2.4.1.jar as suggested. As stated here MariaDB Connector/J is developed for use with MariaDB and MySQL database servers. Version compatibility seems satisfied.
Enabled the SQL trace logs for mariadb and investigated the issue, and found out that the something amiss with the query executed at line: 395
Here is the query causing the error:
SELECT * FROM (SELECT ACCESS_TOKEN, REFRESH_TOKEN, TIME_CREATED, REFRESH_TOKEN_TIME_CREATED, VALIDITY_PERIOD, REFRESH_TOKEN_VALIDITY_PERIOD,TOKEN_STATE, USER_TYPE, TOKEN_ID, SUBJECT_IDENTIFIER FROM IDN_OAUTH2_ACCESS_TOKEN WHERE CONSUMER_KEY_ID=(SELECT ID FROM IDN_OAUTH_CONSUMER_APPS WHERE CONSUMER_KEY = 'awUI98s3ZZkn10bfW_VFcgu7eXga') AND LOWER(AUTHZ_USER)='mahitaptokpinar' AND TENANT_ID=-1234 AND USER_DOMAIN='BOYKOT-USERSTORE' AND TOKEN_SCOPE_HASH='ecae13117d6f0584c25a9da6c8f8415e' AND TOKEN_STATE='ACTIVE' ORDER BY TIME_CREATED DESC) WHERE ROWNUM < 2
Regarding to the MySQL query syntax, the inner SELECT statement has to have a table alias ('T' or 'T1', etc..).
As digging out, I guess the code hits the 'else' statement at line 363 failing to detect the actual JDBC driver name. Thus, query targets Oracle, instead of MySQL as actual JDBC driver name returns: MariaDB Connector/J
Affected Product Version:
WSO2 IS 5.7.25
OS, DB, other environment details and versions:
OS: CentOS 7.6
DB: MySQL 5.7
Steps to reproduce:
The text was updated successfully, but these errors were encountered: