Not sure if anyone else is having this problem, but I've had a lot of trouble with DuplicateJobExceptions when using an AutomaticJobRegistrar that loads jobs from child ClasspathXmlApplicationContexts (following the Spring Batch User Guide).
I'm using Maven-Eclipse integration, and the classpath*: URL appears to somehow pick up the job definitions from both my src/main and src/test resources. I tried a hundred different bean definition tweaks and stepped through the framework code, only to find that changing to classpath: fixed this immediately. Maybe this is a novice error, but it might be worth updating the user guide with a brief explanation, or perhaps even simplify the example from classpath*: to classpath:, if anyone else is having the same trouble.Code:<bean class="org.springframework.batch.core.configuration.support.AutomaticJobRegistrar"> <property name="applicationContextFactories"> <bean class="org.springframework.batch.core.configuration.support.ClasspathXmlApplicationContextsFactoryBean"> <property name="resources" value="classpath:/config/jobs/*.xml" /> </bean> </property> <property name="jobLoader"> <bean class="org.springframework.batch.core.configuration.support.DefaultJobLoader"> <property name="jobRegistry" ref="jobRegistry" /> </bean> </property> </bean>


Reply With Quote
