ID生成雪花算法报错

Blade 未结 1 187
抬头微信
抬头微信 剑者 2024-01-27 11:23

一、该问题的重现步骤是什么?

1. 运行的时候报错### Cause: java.lang.RuntimeException: Clock moved backwards.  Refusing to generate id for 2757 milliseconds

2. 

3.


二、你期待的结果是什么?实际看到的又是什么?

解决报错问题


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

 前后端分离


四、请提供详细的错误堆栈信息,这很重要。


五、若有更多详细信息,请在下面提供。



2024-01-26 08:38:59.112 [async-task-9515] [] [o.s.core.boot.config.BladeExecutorConfiguration] 


ERROR: Unexpected exception occurred invoking async method: public void org.springblade.common.event.ErrorLogListener.saveErrorLog(org.springblade.core.log.event.ErrorLogEvent)


org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 


### Error updating database.  Cause: java.lang.RuntimeException: Clock moved backwards.  Refusing to generate id for 2757 milliseconds


### The error may exist in org/springblade/modules/system/mapper/LogErrorMapper.java (best guess)


### The error may involve org.springblade.modules.system.mapper.LogErrorMapper.insert


### The error occurred while executing an update


### Cause: java.lang.RuntimeException: Clock moved backwards.  Refusing to generate id for 2757 milliseconds


at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)


at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)


at com.sun.proxy.$Proxy165.insert(Unknown Source)


at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)


at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:60)


at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)


at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)


at com.sun.proxy.$Proxy352.insert(Unknown Source)


at com.baomidou.mybatisplus.extension.service.IService.save(IService.java:63)


at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(<generated>)


at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)


at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688)


at org.springblade.modules.system.service.impl.LogErrorServiceImpl$$EnhancerBySpringCGLIB$$575cdc5.save(<generated>)


at org.springblade.modules.system.service.impl.LogServiceImpl.saveErrorLog(LogServiceImpl.java:38)


at org.springblade.common.event.ErrorLogListener.saveErrorLog(ErrorLogListener.java:55)


at org.springblade.common.event.ErrorLogListener$$FastClassBySpringCGLIB$$d15d923a.invoke(<generated>)


at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)


at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:779)


at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)


at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)


at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)


at org.springblade.core.log.aspect.LogTraceAspect.around(LogTraceAspect.java:41)


at sun.reflect.GeneratedMethodAccessor1271.invoke(Unknown Source)


at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)


at java.lang.reflect.Method.invoke(Unknown Source)


at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)


at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)


at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)


at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)


at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)


at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:95)


at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)


at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750)


at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)


at java.util.concurrent.FutureTask.run(Unknown Source)


at org.springblade.core.context.BladeRunnableWrapper.run(BladeRunnableWrapper.java:54)


at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)


at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)


at java.lang.Thread.run(Unknown Source)


Caused by: org.apache.ibatis.exceptions.PersistenceException: 


### Error updating database.  Cause: java.lang.RuntimeException: Clock moved backwards.  Refusing to generate id for 2757 milliseconds


### The error may exist in org/springblade/modules/system/mapper/LogErrorMapper.java (best guess)


### The error may involve org.springblade.modules.system.mapper.LogErrorMapper.insert


### The error occurred while executing an update


### Cause: java.lang.RuntimeException: Clock moved backwards.  Refusing to generate id for 2757 milliseconds


at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)


at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)


at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)


at sun.reflect.GeneratedMethodAccessor811.invoke(Unknown Source)


at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)


at java.lang.reflect.Method.invoke(Unknown Source)


at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)


... 37 common frames omitted


Caused by: java.lang.RuntimeException: Clock moved backwards.  Refusing to generate id for 2757 milliseconds


at com.baomidou.mybatisplus.core.toolkit.Sequence.nextId(Sequence.java:158)


at com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator.nextId(DefaultIdentifierGenerator.java:45)


at com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator.nextId(DefaultIdentifierGenerator.java:27)


at com.baomidou.mybatisplus.core.MybatisParameterHandler.populateKeys(MybatisParameterHandler.java:131)


at com.baomidou.mybatisplus.core.MybatisParameterHandler.process(MybatisParameterHandler.java:112)


at com.baomidou.mybatisplus.core.MybatisParameterHandler.processParameter(MybatisParameterHandler.java:81)


at com.baomidou.mybatisplus.core.MybatisParameterHandler.<init>(MybatisParameterHandler.java:64)


at com.baomidou.mybatisplus.core.MybatisXMLLanguageDriver.createParameterHandler(MybatisXMLLanguageDriver.java:45)


at org.apache.ibatis.session.Configuration.newParameterHandler(Configuration.java:645)


at org.apache.ibatis.executor.statement.BaseStatementHandler.<init>(BaseStatementHandler.java:69)


at org.apache.ibatis.executor.statement.PreparedStatementHandler.<init>(PreparedStatementHandler.java:41)


at org.apache.ibatis.executor.statement.RoutingStatementHandler.<init>(RoutingStatementHandler.java:46)


at org.apache.ibatis.session.Configuration.newStatementHandler(Configuration.java:658)


at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doUpdate(MybatisSimpleExecutor.java:54)


at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)


at sun.reflect.GeneratedMethodAccessor679.invoke(Unknown Source)


at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)


at java.lang.reflect.Method.invoke(Unknown Source)


at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)


at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:106)


at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)


at com.sun.proxy.$Proxy443.update(Unknown Source)


at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)


... 42 common frames omitted


1条回答
提交回复