PDA

View Full Version : DuplicateJobConfigurationException



Ronald
Nov 20th, 2007, 01:57 AM
Hi,

I am building a prototype batch implementation based on the NFL job example. I get the following stacktrace with the NFL job and my own implementation with the latest build of the libraries (1.0-m3-20071120). Both were working fine with (1.0-m3-20071016).

Does anyone have an idea how to fix this?



org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'oneoffpaymentjob' defined in class path resource [config/bfi-oop-job.xml]: Initialization of bean failed; nested exception is org.springframework.beans.FatalBeanException: Cannot register job configuration; nested exception is org.springframework.batch.core.configuration.Dupli cateJobConfigurationException: A job configuration with this name [oneoffpaymentjob] was already registered

Caused by: org.springframework.beans.FatalBeanException: Cannot register job configuration; nested exception is org.springframework.batch.core.configuration.Dupli cateJobConfigurationException: A job configuration with this name [oneoffpaymentjob] was already registered

Caused by: org.springframework.batch.core.configuration.Dupli cateJobConfigurationException: A job configuration with this name [oneoffpaymentjob] was already registered

at org.springframework.batch.execution.configuration. MapJobConfigurationRegistry.register(MapJobConfigu rationRegistry.java:52)

at org.springframework.batch.execution.configuration. JobConfigurationRegistryBeanPostProcessor.postProc essAfterInitialization(JobConfigurationRegistryBea nPostProcessor.java:93)

at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyBeanPostProcessors AfterInitialization(AbstractAutowireCapableBeanFac tory.java:313)

at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.initializeBean(Abstract AutowireCapableBeanFactory.java:1176)

at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:427)

at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 49)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:155)

at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:291)

at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:352)
at org.springframework.test.AbstractSingleSpringConte xtTests.createApplicationContext(AbstractSingleSpr ingContextTests.java:199)

at org.springframework.test.AbstractSingleSpringConte xtTests.loadContextLocations(AbstractSingleSpringC ontextTests.java:179)

at org.springframework.test.AbstractSingleSpringConte xtTests.loadContext(AbstractSingleSpringContextTes ts.java:158)

at org.springframework.test.AbstractSpringContextTest s.getContext(AbstractSpringContextTests.java:105)
at org.springframework.test.AbstractSingleSpringConte xtTests.setUp(AbstractSingleSpringContextTests.jav a:87)
at junit.framework.TestCase.runBare(TestCase.java:128 )
at org.springframework.test.ConditionalTestCase.runBa re(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.ja va:106)
at junit.framework.TestResult.runProtected(TestResult .java:124)
at junit.framework.TestResult.run(TestResult.java:109 )
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:2 30)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)

Dave Syer
Nov 20th, 2007, 02:28 AM
Check your configuration and make sure that only one job configuration with that name is present. How this behaves depends how you deploy the JobConfigurationRegistry, and the way that is handled in the samples was changed recently (which might or might not be the cause of the change you are seeing). You don't have to do it the same way of course.

Ronald
Nov 20th, 2007, 06:15 AM
I found my problem. I had two JobConfigurationRegistryBeanPostProcessors in my configuration. One in the job and one in the container configuration. Which causes each bean to be registered twice.

Thanks for the help.