java - Spring Batch 2.2.3 异常 - 访问字段 'serialVersionUID' 不应该是非法的

标签 java spring spring-batch serialversionuid

我有一个 Spring Batch 作业开始抛出这个奇怪的异常。

我希望我有比这个堆栈跟踪更多的信息,我可能会,但我只是不知道要提供什么。

我四处搜寻,只发现另外一个人也出现此特定错误,但截至 2013 年 8 月尚未回复。spring.io forum

有人有什么建议吗?谢谢/w

10:44:15,096 ERROR AbstractJob,pool-15-thread-1:326 - Encountered fatal error executing job
org.springframework.batch.core.JobExecutionException: Flow execution ended unexpectedly
        at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:141)
        at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301)
        at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134)
        at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
        at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:127)
        at com.example.batch.RunScheduler.run(RunScheduler.java:62)
        at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
        at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
        at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
Caused by: org.springframework.batch.core.job.flow.FlowExecutionException: Ended flow=sourceJob at state=sourceJob.sourceStep1 with exception
        at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:161)
        at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:131)
        at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
        ... 18 more
Caused by: java.lang.IllegalStateException: Shouldn't be illegal to access field 'serialVersionUID': java.lang.IllegalAccessException: Can not set static final long field org.springframework.batch.core.StepExecution.serialVersionUID to java.lang.Long
        at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:573)
        at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:547)
        at org.springframework.batch.core.repository.dao.MapStepExecutionDao.copy(MapStepExecutionDao.java:59)
        at org.springframework.batch.core.repository.dao.MapStepExecutionDao.updateStepExecution(MapStepExecutionDao.java:109)
        at org.springframework.batch.core.repository.support.SimpleJobRepository.update(SimpleJobRepository.java:189)
        at sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at com.sun.proxy.$Proxy61.update(Unknown Source)
        at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:183)
        at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:137)
        at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
        at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
        at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:152)
        ... 20 more

最佳答案

这似乎是 Spring 3.2.0 以及可能其他版本中的一个错误。请参阅source code to org.springframework.util.ReflectionUtils.doWithFields(Class,FieldCallback,FieldFilter) at line 565 。此行的注释表明代码应该跳过静态和/或最终字段,但没有代码来实际实现此测试。当然,抛出的异常是尝试修改静态最终字段的预期结果(非静态最终字段可以通过反射修改,但静态最终被视为编译时常量,因此不允许修改)。

关于java - Spring Batch 2.2.3 异常 - 访问字段 'serialVersionUID' 不应该是非法的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20527190/

相关文章:

javascript - Spark Java框架未在tomcat服务器上运行

instance - Spring 批处理 : Restartable attribute ignored

spring - 在 Spring Batch 中,是否可以配置多个 JdbcBatchItemWriter 并行写入?

使用 MongoDB 的 Spring Social 和 Spring Security

java - quartz cron 作业未启动

java - 一个简单程序的类加载流程

java - java中给定压缩文本的lzw解压算法

java - 格式化我的系统后未安装应用程序且未签署应用程序

java - 如何将 Spring 事务传播到另一个线程?

java - Spring Security 和 LDAP 身份验证