wso2 / product-is

Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
748 stars 729 forks source link

Error while unsharing application in MySQL databse #17403

Closed PasinduYeshan closed 1 year ago

PasinduYeshan commented 1 year ago

Describe the issue: Error occurs while unshare application.

Caused by: org.wso2.carbon.identity.application.common.IdentityApplicationManagementException: Error occurred while deleting roles created for the application: app1.
    at org.wso2.carbon.identity.application.mgt.listener.DefaultRoleManagementListener.doPostDeleteApplication(DefaultRoleManagementListener.java:550)
    at org.wso2.carbon.identity.application.mgt.ApplicationManagementServiceImpl.deleteApplication(ApplicationManagementServiceImpl.java:810)
    at org.wso2.carbon.identity.organization.management.application.OrgApplicationManagerImpl.deleteSharedApplication(OrgApplicationManagerImpl.java:304)
    ... 59 more
Caused by: org.wso2.carbon.identity.role.v2.mgt.core.exception.IdentityRoleManagementServerException: Error while deleting roles by app id : b3c9a1f0-5dd0-4ef9-bf7b-cadc6a842000
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteRolesByApplication(RoleDAOImpl.java:1055)
    at org.wso2.carbon.identity.role.v2.mgt.core.RoleManagementServiceImpl.deleteRolesByApplication(RoleManagementServiceImpl.java:570)
    at org.wso2.carbon.identity.application.mgt.listener.DefaultRoleManagementListener.doPostDeleteApplication(DefaultRoleManagementListener.java:547)
    ... 61 more
Caused by: org.wso2.carbon.identity.role.v2.mgt.core.exception.IdentityRoleManagementServerException: Error while deleting the role: Internal/ebdf6574-06b0-441d-a32f-693d0308f7a7 for the role: Internal/ebdf6574-06b0-441d-a32f-693d0308f7a7 in the tenantDomain: 5869c441-0c49-4501-aa06-d9d0cb3bdf36
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteSCIMRole(RoleDAOImpl.java:2997)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteRolesByApplication(RoleDAOImpl.java:1048)
    ... 63 more
Caused by: org.wso2.carbon.identity.role.v2.mgt.core.exception.IdentityRoleManagementServerException: Error while deleting permissions to roleId : appRole1
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteAllPermissionsOfRole(RoleDAOImpl.java:1630)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteRoleAssociations(RoleDAOImpl.java:1286)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteSCIMRole(RoleDAOImpl.java:2990)
    ... 64 more
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE ROLE_ID = 'appRole1'' at line 1
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:916)
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1061)
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1009)
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1320)
    at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:994)
    at jdk.internal.reflect.GeneratedMethodAccessor143.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118)
    at com.sun.proxy.$Proxy55.executeUpdate(Unknown Source)
    at org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement.executeUpdate(NamedPreparedStatement.java:252)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteAllPermissionsOfRole(RoleDAOImpl.java:1627)
    ... 66 more

How to reproduce:

Expected behavior:

Environment information (Please complete the following information; remove any unnecessary fields) :


Optional Fields

Related issues:

Suggested labels:

PasinduYeshan commented 1 year ago

This issue is fixed with https://github.com/wso2/carbon-identity-framework/pull/5115.