sharding-jdbc 1.5.4.1 默认主键生成器,主键冲突
@亮_dangdang 你好,想跟你请教个问题:
使用默认的主键生成器,报主键冲突。请问为什么会冲突呢?不是分布式自增id吗?
两台服务均衡。
错误信息:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '216101960267333632' for key 'PRIMARY'
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: INSERT INTO t_wx_user_account_flow ( flow_id, flow_type, user_account_type, uid, amount, order_time, loan_id, invest_id, available_old, available_new, freeze_old, freeze_new, total_old, total_new, withdraw_old, withdraw_new, order_id, remark, create_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '216101960267333632' for key 'PRIMARY'
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) ~[mybatis-spring-1.3.1.jar!/:1.3.1]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) ~[mybatis-spring-1.3.1.jar!/:1.3.1]
at com.sun.proxy.$Proxy112.insert(Unknown Source) ~[?:?]
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278) ~[mybatis-spring-1.3.1.jar!/:1.3.1]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:57) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) ~[mybatis-3.4.5.jar!/:3.4.5]
at com.sun.proxy.$Proxy133.insert(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72) ~[druid-1.1.6.jar!/:1.1.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.sun.proxy.$Proxy134.insert(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor155.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72) ~[druid-1.1.6.jar!/:1.1.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.sun.proxy.$Proxy134.insert(Unknown Source) ~[?:?]
at com.xiaoying.payrisk.service.impl.WxUserAccountFlowServiceImpl.insert(WxUserAccountFlowServiceImpl.java:28) ~[classes!/:?]
at com.xiaoying.payrisk.service.impl.WxUserAccountFlowServiceImpl$$FastClassBySpringCGLIB$$7ed4daab.invoke(<generated>) ~[classes!/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72) ~[druid-1.1.6.jar!/:1.1.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.xiaoying.payrisk.service.impl.WxUserAccountFlowServiceImpl$$EnhancerBySpringCGLIB$$fb94d254.insert(<generated>) ~[classes!/:?]
at com.xiaoying.payrisk.service.impl.WxUserAccountFlowServiceImpl$$FastClassBySpringCGLIB$$7ed4daab.invoke(<generated>) ~[classes!/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) ~[spring-tx-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72) ~[druid-1.1.6.jar!/:1.1.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.xiaoying.payrisk.service.impl.WxUserAccountFlowServiceImpl$$EnhancerBySpringCGLIB$$24899dc4.insert(<generated>) ~[classes!/:?]
at com.xiaoying.payrisk.service.AccFlowScreenService.saveAccFlow(AccFlowScreenService.java:101) ~[classes!/:?]
at com.xiaoying.payrisk.service.AccFlowScreenService.flowScreem(AccFlowScreenService.java:50) ~[classes!/:?]
at com.xiaoying.payrisk.service.AccFlowScreenService$$FastClassBySpringCGLIB$$24f47cc3.invoke(<generated>) ~[classes!/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72) ~[druid-1.1.6.jar!/:1.1.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.xiaoying.payrisk.service.AccFlowScreenService$$EnhancerBySpringCGLIB$$b3c18ba7.flowScreem(<generated>) ~[classes!/:?]
at com.xiaoying.payrisk.service.AccFlowScreenService$$FastClassBySpringCGLIB$$24f47cc3.invoke(<generated>) ~[classes!/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.alibaba.druid.support.spring.stat.DruidStatInterceptor.invoke(DruidStatInterceptor.java:72) ~[druid-1.1.6.jar!/:1.1.6]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671) ~[spring-aop-4.3.17.RELEASE.jar!/:4.3.17.RELEASE]
at com.xiaoying.payrisk.service.AccFlowScreenService$$EnhancerBySpringCGLIB$$7016ee27.flowScreem(<generated>) ~[classes!/:?]
at com.xiaoying.payrisk.service.cmq.CmqConsumerService.lambda$null$0(CmqConsumerService.java:94) ~[classes!/:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_152]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_152]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '216101960267333632' for key 'PRIMARY'
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: INSERT INTO t_wx_user_account_flow ( flow_id, flow_type, user_account_type, uid, amount, order_time, loan_id, invest_id, available_old, available_new, freeze_old, freeze_new, total_old, total_new, withdraw_old, withdraw_new, order_id, remark, create_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '216101960267333632' for key 'PRIMARY'
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185) ~[mybatis-3.4.5.jar!/:3.4.5]
at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.1.jar!/:1.3.1]
... 72 more
Caused by: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '216101960267333632' for key 'PRIMARY'
at com.dangdang.ddframe.rdb.sharding.executor.threadlocal.ExecutorExceptionHandler.handleException(ExecutorExceptionHandler.java:61) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.execute(ExecutorEngine.java:129) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.executePreparedStatement(ExecutorEngine.java:96) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.type.prepared.PreparedStatementExecutor.execute(PreparedStatementExecutor.java:93) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:140) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.4.5.jar!/:3.4.5]
at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) ~[mybatis-3.4.5.jar!/:3.4.5]
at com.sun.proxy.$Proxy147.update(Unknown Source) ~[?:?]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185) ~[mybatis-3.4.5.jar!/:3.4.5]
at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.1.jar!/:1.3.1]
... 72 more
Caused by: com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '216101960267333632' for key 'PRIMARY'
at com.dangdang.ddframe.rdb.sharding.executor.threadlocal.ExecutorExceptionHandler.handleException(ExecutorExceptionHandler.java:61) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.executeInternal(ExecutorEngine.java:181) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.syncExecute(ExecutorEngine.java:155) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.execute(ExecutorEngine.java:124) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.executePreparedStatement(ExecutorEngine.java:96) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.type.prepared.PreparedStatementExecutor.execute(PreparedStatementExecutor.java:93) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:140) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.4.5.jar!/:3.4.5]
at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) ~[mybatis-3.4.5.jar!/:3.4.5]
at com.sun.proxy.$Proxy147.update(Unknown Source) ~[?:?]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185) ~[mybatis-3.4.5.jar!/:3.4.5]
at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.1.jar!/:1.3.1]
... 72 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '216101960267333632' for key 'PRIMARY'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_152]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_152]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_152]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_152]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1197) ~[mysql-connector-java-5.1.46.jar!/:5.1.46]
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:498) ~[druid-1.1.6.jar!/:1.1.6]
at com.dangdang.ddframe.rdb.sharding.executor.type.prepared.PreparedStatementExecutor$3.execute(PreparedStatementExecutor.java:97) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.type.prepared.PreparedStatementExecutor$3.execute(PreparedStatementExecutor.java:93) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.executeInternal(ExecutorEngine.java:175) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.syncExecute(ExecutorEngine.java:155) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.execute(ExecutorEngine.java:124) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.ExecutorEngine.executePreparedStatement(ExecutorEngine.java:96) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.executor.type.prepared.PreparedStatementExecutor.execute(PreparedStatementExecutor.java:93) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at com.dangdang.ddframe.rdb.sharding.jdbc.core.statement.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:140) ~[sharding-jdbc-core-1.5.4.1.jar!/:?]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.4.5.jar!/:3.4.5]
at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) ~[mybatis-3.4.5.jar!/:3.4.5]
at com.sun.proxy.$Proxy147.update(Unknown Source) ~[?:?]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198) ~[mybatis-3.4.5.jar!/:3.4.5]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185) ~[mybatis-3.4.5.jar!/:3.4.5]
at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.1.jar!/:1.3.1]
... 72 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
今天冲突的数据:
冲突的日志打印时间:
库里面已存在的那个id记录的插入时间:
两个时间非常相近,感觉像是同一时间拿到两个一样的id,一条插入成功了。一条插入失败了(主键冲突)。