{"id":228,"date":"2018-03-24T16:56:13","date_gmt":"2018-03-24T07:56:13","guid":{"rendered":"http:\/\/ito-u-oti.com\/?p=228"},"modified":"2018-05-05T21:21:14","modified_gmt":"2018-05-05T12:21:14","slug":"post-228","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=228","title":{"rendered":"Spring batch\u3067Junit\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc"},"content":{"rendered":"<h2 id=\"outline__1\">Spring batch\u3067Junit\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc<\/h2>\n<p>\u6700\u8fd1\u306fSpring batch\u306e\u65b9\u3092\u305a\u3063\u3068\u3044\u3058\u3063\u3066\u307e\u3059\u3002<\/p>\n<h3 id=\"outline__1_1\">\u4e8b\u8c61<\/h3>\n<p>Spring batch\u3067Junit\u3092\u52d5\u304b\u3057\u305f\u3068\u304d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f<br \/>\nJunit\u95a2\u4fc2\u306a\u3044\u304b\u3082<\/p>\n<h3 id=\"outline__1_2\">\u30a8\u30e9\u30fc\u5185\u5bb9<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;2017\/12\/22 10:11:52] &#x5B;main] &#x5B;o.s.t.c.TestContextManager] &#x5B;ERROR] Caught exception while allowing TestExecutionListener &#x5B;org.springframework.test.context.support.DependencyInjectionTestExecutionListener@4d6e83] to prepare test instance &#x5B;batch.sample01.Sample01JobTaskletTest@6a17c4]\r\njava.lang.IllegalStateException: Failed to load ApplicationContext\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:107) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:242) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) &#x5B;junit-4.12.jar:4.12]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) &#x5B;junit-4.12.jar:4.12]\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) &#x5B;junit-4.12.jar:4.12]\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) &#x5B;junit-4.12.jar:4.12]\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) &#x5B;junit-4.12.jar:4.12]\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) &#x5B;junit-4.12.jar:4.12]\r\n\tat org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363) &#x5B;junit-4.12.jar:4.12]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) &#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) &#x5B;.cp\/:na]\r\n\tat org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) &#x5B;.cp\/:na]\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:539) &#x5B;.cp\/:na]\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:761) &#x5B;.cp\/:na]\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:461) &#x5B;.cp\/:na]\r\n\tat org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:207) &#x5B;.cp\/:na]\r\nCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sample01Job': Post-processing of FactoryBean's singleton object failed; nested exception is org.springframework.beans.FatalBeanException: Cannot register job configuration; nested exception is org.springframework.batch.core.configuration.DuplicateJobException: A job configuration with this name &#x5B;sample01Job] was already registered\r\n\tat org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:114) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1178) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:258) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~&#x5B;spring-context-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~&#x5B;spring-context-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:109) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:246) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~&#x5B;spring-test-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\t... 25 common frames omitted\r\nCaused by: org.springframework.beans.FatalBeanException: Cannot register job configuration; nested exception is org.springframework.batch.core.configuration.DuplicateJobException: A job configuration with this name &#x5B;sample01Job] was already registered\r\n\tat org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor.postProcessAfterInitialization(JobRegistryBeanPostProcessor.java:150) ~&#x5B;spring-batch-core-4.0.0.RELEASE.jar:4.0.0.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:438) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1852) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\tat org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:111) ~&#x5B;spring-beans-5.0.2.RELEASE.jar:5.0.2.RELEASE]\r\n\t... 38 common frames omitted\r\nCaused by: org.springframework.batch.core.configuration.DuplicateJobException: A job configuration with this name &#x5B;sample01Job] was already registered\r\n\tat org.springframework.batch.core.configuration.support.MapJobRegistry.register(MapJobRegistry.java:51) ~&#x5B;spring-batch-core-4.0.0.RELEASE.jar:4.0.0.RELEASE]\r\n\tat org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor.postProcessAfterInitialization(JobRegistryBeanPostProcessor.java:146) ~&#x5B;spring-batch-core-4.0.0.RELEASE.jar:4.0.0.RELEASE]\r\n\t... 41 common frames omitted\r\n<\/pre>\n<h3 id=\"outline__1_3\">\u539f\u56e0<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;bean class=&quot;org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor&quot; p:jobRegistry-ref=&quot;jobRegistry&quot;\/&gt;\r\n<\/pre>\n<p>\u306e\u7af6\u5408\u304c\u767a\u751f\u3057\u3066\u3044\u305f\u3002<br \/>\n\u5177\u4f53\u7684\u306b\u306f\u5225\u3005\u306exml\u306b\u3042\u308b\u540c\u3058\u8a2d\u5b9a\u3092\u4e00\u7dd2\u306b\u8aad\u307f\u8fbc\u3093\u3067\u3057\u307e\u3063\u305f\u3053\u3068\u3067\u3001\u8a2d\u5b9a\u304c\u7af6\u5408\u3057\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u3002<\/p>\n<h3 id=\"outline__1_4\">\u89e3\u6c7a\u7b56<\/h3>\n<p>xml\u306e\u7af6\u5408\u3057\u3066\u3044\u308b\u8a2d\u5b9a\u306e\u524a\u9664<br \/>\n\u4eca\u56de\u3060\u3068<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;bean class=&quot;org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor&quot; p:jobRegistry-ref=&quot;jobRegistry&quot;\/&gt;\r\n<\/pre>\n<p>\u30bf\u30b0\u3092\u7247\u65b9\u306exml\u3067\u524a\u9664\u3002\u307e\u305f\u306fxml\u306e\u8aad\u307f\u8fbc\u307f\u3092\u3084\u3081\u308b\u3002<\/p>\n<h3 id=\"outline__1_5\">\u53c2\u8003<\/h3>\n<p><a href=\"http:\/\/forum.spring.io\/forum\/spring-projects\/batch\/37954-duplicatejobconfigurationexception\">DUPLICATEJOBCONFIGURATIONEXCEPTION<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Spring batch\u3067Junit\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc \u6700\u8fd1\u306fSpring batch [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":93,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86,27,7],"tags":[],"class_list":["post-228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-batch","category-junit","category-error-bugs"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=228"}],"version-history":[{"count":4,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions"}],"predecessor-version":[{"id":461,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions\/461"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/media\/93"}],"wp:attachment":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}