数据处理---Spring Batch之实践
<batch:job id="job1"> 在META-INF下面加个persistence.xml <?xml version="1.0" encoding="UTF-8"?> Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exampleConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.batch.core.repository.JobRepository com.test.batch.ExampleConfiguration.jobRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jobRepository': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [launch-context.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [launch-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No persistence unit with name 'spring' found 运行的时候遇到上面的错误,就是没有上面的配置的原因 org.springframework.transaction.InvalidIsolationLevelException: Standard JPA does not support custom isolation levels - use a special JpaDialect for your JPA implementation 遇到这样的错误,是因为默认的JPA不支持自定义的事物隔离级别。可以自定义一个CustomHibernateJpaDialect extends HibernateJpaDialect,具体代码没有列出,可以找下。 在用Quartz的时候遇到 Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.scheduling.quartz.CronTriggerBean has interface org.quartz.CronTrigger as super class ? 这个是由于网上的很多例子都是quartz版本稍旧的原因,我用的是quartz?2.1.7 错误:Jobs added with no trigger must be durable 坑真的是不少,需要一个个解决。最后测试一下,是不是定时执行我们的job: public class App { 祝你好运,能够成功,。 (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |