无法创建内部 bean,SpringBatch StaxEventItemReader

发布于 2025-01-19 03:20:24 字数 2108 浏览 5 评论 0原文

请帮助我如何在使用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" />

Error:
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一世旳自豪 2025-01-26 03:20:24

根据您的屏幕截图,异常是 ClassNotFoundException。确保 spring-batch-infrastruct jar(包含 StaxEventItemReader 类)位于应用程序的类路径中。

According to your screenshot, the exception is a ClassNotFoundException. Make sure the spring-batch-infrastructure jar (which contains the StaxEventItemReader class) is in the classpath of your application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文