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
746 stars 724 forks source link

Error while removing a role of a shared application with MySQL database #17468

Closed PasinduYeshan closed 11 months ago

PasinduYeshan commented 11 months ago

Describe the issue: Following error occurred while removing role from an shared application.

[2023-10-31 23:49:29,718] [5fd5f2c4-6d46-4765-8a7b-cd443bf21c73] ERROR {org.wso2.carbon.identity.api.server.application.management.v1.core.functions.Utils} - errorCode: APP-65001 | message: Error while updating shared roles related to application 4 update. org.wso2.carbon.identity.application.common.IdentityApplicationManagementException: Error while updating shared roles related to application 4 update.
    at org.wso2.carbon.identity.organization.management.handler.listener.SharedRoleMgtListener.doPostUpdateApplication(SharedRoleMgtListener.java:248)
    at org.wso2.carbon.identity.application.mgt.listener.DefaultApplicationResourceMgtListener.doPostUpdateApplicationByResourceId(DefaultApplicationResourceMgtListener.java:111)
    at org.wso2.carbon.identity.application.mgt.ApplicationManagementServiceImpl.updateApplicationByResourceId(ApplicationManagementServiceImpl.java:2620)
    at org.wso2.carbon.identity.api.server.application.management.v1.core.ServerApplicationManagementService.patchApplication(ServerApplicationManagementService.java:856)
    at org.wso2.carbon.identity.api.server.application.management.v1.impl.ApplicationsApiServiceImpl.patchApplication(ApplicationsApiServiceImpl.java:151)
    at org.wso2.carbon.identity.api.server.application.management.v1.ApplicationsApi.patchApplication(ApplicationsApi.java:934)
    ....
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:146)
    at org.wso2.carbon.identity.context.rewrite.valve.OrganizationContextRewriteValve.invoke(OrganizationContextRewriteValve.java:115)
    at org.wso2.carbon.tomcat.ext.valves.SameSiteCookieValve.invoke(SameSiteCookieValve.java:38)
    ...
Caused by: org.wso2.carbon.identity.role.v2.mgt.core.exception.IdentityRoleManagementServerException: Error while deleting the role name: appRole1 in the tenantDomain: carbon.super
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteRole(RoleDAOImpl.java:582)
    at org.wso2.carbon.identity.role.v2.mgt.core.RoleManagementServiceImpl.deleteRole(RoleManagementServiceImpl.java:253)
    at org.wso2.carbon.identity.organization.management.handler.listener.SharedRoleMgtListener.handleRemovedApplicationAudienceRolesOnAppUpdate(SharedRoleMgtListener.java:371)
    at org.wso2.carbon.identity.organization.management.handler.listener.SharedRoleMgtListener.doPostUpdateApplication(SharedRoleMgtListener.java:215)
    ... 58 more
Caused by: org.wso2.carbon.identity.role.v2.mgt.core.exception.IdentityRoleManagementServerException: Error while deleting shared roles of role id : 9ddc51bc-3f2f-4395-93c2-c7591701c783
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteSharedHybridRoles(RoleDAOImpl.java:3025)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteRole(RoleDAOImpl.java:550)
    ... 61 more
Caused by: java.sql.SQLException: You can't specify target table 'UM_HYBRID_ROLE' for update in FROM clause
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
    ...
    at org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement.executeUpdate(NamedPreparedStatement.java:252)
    at org.wso2.carbon.identity.role.v2.mgt.core.dao.RoleDAOImpl.deleteSharedHybridRoles(RoleDAOImpl.java:3022)
    ... 62 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 11 months ago

Fixed with