3

我们有一个带有 Spring Batch 和 Spring Batch Admin 的项目。最近我们java.util.EmptyStackException在运行批处理过程时得到了。

谷歌搜索后,我对这个问题有了一些了解,并通过将 jettison jar 从 1.1 升级到 1.3.2 来解决它。

我们通过在 pom.xml 中排除 spring 批处理核心声明中的 jettison 并在pom.xml添加 jettison 作为依赖项来做到这一点。

我们的问题是这是解决这个问题的正确方法吗?由于将 jettison 升级到 1.3.2,Spring Batch 会不会有任何问题?

我们得到的错误的堆栈跟踪:

Caused by: java.util.EmptyStackException
    at org.codehaus.jettison.util.FastStack.peek(FastStack.java:39)
    at org.codehaus.jettison.mapped.MappedXMLStreamWriter.writeEndElement(MappedXMLStreamWriter.java:200)
    at com.thoughtworks.xstream.io.xml.StaxWriter.endNode(StaxWriter.java:107)
    at com.thoughtworks.xstream.io.WriterWrapper.endNode(WriterWrapper.java:37)
    at com.thoughtworks.xstream.io.path.PathTrackingWriter.endNode(PathTrackingWriter.java:48)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:138)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.visit(AbstractReflectionConverter.java:113)
    at com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:129)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:95)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:54)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:63)
    at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:78)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:63)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:98)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:38)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:845)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:834)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:815)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:805)
    at org.springframework.batch.core.repository.dao.XStreamExecutionContextStringSerializer.serialize(XStreamExecutionContextStringSerializer.java:43)
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.serializeContext(JdbcExecutionContextDao.java:212)
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.updateExecutionContext(JdbcExecutionContextDao.java:122)
    at org.springframework.batch.core.repository.support.SimpleJobRepository.updateExecutionContext(SimpleJobRepository.java:188)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    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.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy61.updateExecutionContext(Unknown Source)
    at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:145)
    at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:61)
    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:144)
    ... 7 more
4

1 回答 1

0

我最近也遇到了这个。我不确定你是否有完整的堆栈跟踪,但在我的应用程序中有一个调用:

sun.misc.Unsafe

2016 年发生了一个变化,它破坏了一些像 groovy 这样的 jvm 语言。抛弃 1.1 显然没有使用这个“不安全”调用,它可能会在 JVM 版本中发生变化(它不是普通 java API 的一部分)

于 2017-11-23T12:43:53.443 回答