无法创建内部 bean,SpringBatch StaxEventItemReader
请帮助我如何在使用SpringBatch和StaxeventItemReader读取XML文件时如何解决此错误,错误是:无法创建Inner Bean(Inner Bean)#4097d7fe of Type [org.springframework.batch.core.core.core.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.job.Job. 异常设置bean属性“ statransitions”时
.flow.support.statetransition]在用键[0]嵌套的 context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
<job id="PKREJ005-01-PE" incrementer="defaultIncrementer" job-repository="jobRepository">
<description>Job to generate report</description>
<listeners>
<listener ref="interceptorJobExecutionListener"/>
</listeners>
<step id="idStep01" parent="step01"></step>
</job>
<step id="step01">
<tasklet>
<chunk reader="xmlItemReader" processor="xmlItemProcessor" writer="xmlItemWriter" commit-interval="2"></chunk>
</tasklet>
</step>
</beans:beans>
- &gt; bean.xml
<bean id="customUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.bbva.pkre.dto.accounting.amp.AMP</value>
</list>
</property>
</bean>
<bean id="xmlItemProcessor" class="com.bbva.pkre.batch.process.AMPItemProcess" />
<bean id="xmlItemWriter" class="com.bbva.pkre.batch.writer.AMPItemWriter" />
错误: 在此处输入图像描述
Please help me how to solve this error when executing a Job reading an XML file with SpringBatch and StaxEventItemReader, the error is: cannot create inner bean (inner bean)#4097d7fe of type [org.springframework.batch.core.job.flow.support.StateTransition] while setting bean property 'stateTransitions' with key[0] nested exception is org.springframework.beans.factory.BeanCreationAxception
-> context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd">
<job id="PKREJ005-01-PE" incrementer="defaultIncrementer" job-repository="jobRepository">
<description>Job to generate report</description>
<listeners>
<listener ref="interceptorJobExecutionListener"/>
</listeners>
<step id="idStep01" parent="step01"></step>
</job>
<step id="step01">
<tasklet>
<chunk reader="xmlItemReader" processor="xmlItemProcessor" writer="xmlItemWriter" commit-interval="2"></chunk>
</tasklet>
</step>
</beans:beans>
-> bean.xml
<bean id="customUnmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<value>com.bbva.pkre.dto.accounting.amp.AMP</value>
</list>
</property>
</bean>
<bean id="xmlItemProcessor" class="com.bbva.pkre.batch.process.AMPItemProcess" />
<bean id="xmlItemWriter" class="com.bbva.pkre.batch.writer.AMPItemWriter" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的屏幕截图,异常是
ClassNotFoundException
。确保spring-batch-infrastruct
jar(包含StaxEventItemReader
类)位于应用程序的类路径中。According to your screenshot, the exception is a
ClassNotFoundException
. Make sure thespring-batch-infrastructure
jar (which contains theStaxEventItemReader
class) is in the classpath of your application.