-
Choerodon平台版本:0.19.0
-
运行环境(如localhost或k8s):localhost
-
遇到问题时的前置条件:
-
问题描述:
部分菜单提示没有访问权限,最初是可以访问的,查看事务,发现刷新失败权限表失败导致的,
iam-permission-task-refresh
- 报错信息如下:
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry 'role/project/default/project-owner-devops-service.devops-cluster' for key 'UK_IAM_ROLE_PERM_U1'
### The error may involve io.choerodon.base.infra.mapper.RolePermissionMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO iam_role_permission ( object_version_number,created_by,creation_date,last_updated_by,last_update_date,id,role_code,permission_code ) VALUES( ?,?,?,?,?,?,?,? )
### Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry 'role/project/default/project-owner-devops-service.devops-cluster' for key 'UK_IAM_ROLE_PERM_U1'
; Duplicate entry 'role/project/default/project-owner-devops-service.devops-cluster' for key 'UK_IAM_ROLE_PERM_U1'; nested exception is java.sql.SQLIntegrityConstraintViolationException: Duplicate entry 'role/project/default/project-owner-devops-service.devops-cluster' for key 'UK_IAM_ROLE_PERM_U1'
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:242)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy131.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy213.insert(Unknown Source)
at io.choerodon.base.app.service.impl.ParsePermissionServiceImpl.insertRolePermission(ParsePermissionServiceImpl.java:412)
at io.choerodon.base.app.service.impl.ParsePermissionServiceImpl.processPermission(ParsePermissionServiceImpl.java:278)
at io.choerodon.base.app.service.impl.ParsePermissionServiceImpl.processDescription(ParsePermissionServiceImpl.java:254)
at io.choerodon.base.app.service.impl.ParsePermissionServiceImpl.processDescriptions(ParsePermissionServiceImpl.java:226)
at io.choerodon.base.api.eventhandler.ActuatorSagaHandler.refreshPermission(ActuatorSagaHandler.java:67)
at sun.reflect.GeneratedMethodAccessor807.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.choerodon.asgard.saga.consumer.SagaConsumer.invoke(SagaConsumer.java:84)
at io.choerodon.asgard.saga.consumer.SagaConsumer.lambda$null$0(SagaConsumer.java:56)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry 'role/project/default/project-owner-devops-service.devops-cluster' for key 'UK_IAM_ROLE_PERM_U1'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:955)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:372)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at sun.reflect.GeneratedMethodAccessor443.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy337.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at sun.reflect.GeneratedMethodAccessor467.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at io.choerodon.mybatis.interceptor.OvnInterceptor.intercept(OvnInterceptor.java:52)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy336.update(Unknown Source)
at sun.reflect.GeneratedMethodAccessor467.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at io.choerodon.mybatis.interceptor.MultiLanguageInterceptor.intercept(MultiLanguageInterceptor.java:77)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy336.update(Unknown Source)
at sun.reflect.GeneratedMethodAccessor467.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at io.choerodon.mybatis.interceptor.AuditInterceptor.intercept(AuditInterceptor.java:48)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy336.update(Unknown Source)
at sun.reflect.GeneratedMethodAccessor467.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy336.update(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
at sun.reflect.GeneratedMethodAccessor501.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 19 more