我正在编写一个简单的spring批处理应用程序,它从一个文件中读取数据并将其写入cassandradb。
如果我在一个简单的java项目中运行cassandra crud操作,并且只有一个依赖项,那么我就能够正确地运行它。我可以成功地执行积垢操作。
依赖关系:com.populture.client kundera cassandra 2.5
现在问题来了!
我正在将相同的代码与spring批处理应用程序集成。我的结局是以下例外:
10:22:19,816 DEBUG ThreadPoolTaskExecutor-1 dao.JdbcStepExecutionDao:203 - Truncating long message before update of StepExecution, original message is: org.springframework.batch.core.JobExecutionException: Partition handler returned an unsuccessful step
at org.springframework.batch.core.partition.support.PartitionStep.doExecute(PartitionStep.java:110)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:196)
at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:375)
at org.springframework.batch.core.job.flow.FlowJob.access$100(FlowJob.java:43)
at org.springframework.batch.core.job.flow.FlowJob$JobFlowExecutor.executeStep(FlowJob.java:135)
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)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:124)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:103)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:266)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:118)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
; com.impetus.kundera.KunderaException: com.impetus.kundera.KunderaException: Entitymatadata should not be null
at com.impetus.kundera.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:174)
at org.springframework.batch.admin.zipfeed.ZipLocationFeedWriter.write(ZipLocationFeedWriter.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
现在我进一步比较了这两个应用程序的调试。运行spring批处理应用程序时,下面的注解似乎没有得到反映。仅供参考,我已经提供了我用来执行crud操作的bean。同一个bean用于独立应用程序(junit)。
请让我知道如何使这个工作。运行批处理应用程序时,注解似乎没有得到反映(仅供参考,为了便于理解,我也拍摄了屏幕截图)
@Entity
@Table(name = "ZipLookUp", schema = "ZipDB@cassandra_pu")
public class ZipLocationBean {
@Id
@Column(name = "ZIP_CODE")
private String zipcode;
@Column(name = "CITY")
private String city;
@Column(name = "STATE")
private String state;
@Column(name = "COUNTRY")
private String country;
@Column(name = "LATITUDE")
private double latitude;
@Column(name = "LONGITUDE")
private double longitude;
// Getters and setters;
}
1条答案
按热度按时间gmxoilav1#
请确认您是否有:
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
存在于Spring配置中。-维韦克