{"id":236,"date":"2018-03-25T14:54:57","date_gmt":"2018-03-25T05:54:57","guid":{"rendered":"http:\/\/ito-u-oti.com\/?p=236"},"modified":"2018-05-05T21:25:06","modified_gmt":"2018-05-05T12:25:06","slug":"post-236","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=236","title":{"rendered":"Junit\u3067spring batch\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc [IllegalStateException]"},"content":{"rendered":"<h2 id=\"outline__1\">Junit\u3067spring batch\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc [IllegalStateException]<\/h2>\n<p>\u521d\u6b69\u7684\u306a\u30df\u30b9\u304c\u4e00\u756a\u6c17\u3065\u304d\u306b\u304f\u304b\u3063\u305f\u308a\u3059\u308b\u3002<\/p>\n<h3 id=\"outline__1_1\">\u4e8b\u8c61<\/h3>\n<p>Junit\u3067spring batch\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc<\/p>\n<h3 id=\"outline__1_2\">\u30a8\u30e9\u30fc\u5185\u5bb9<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;2018\/01\/04 12:02:24] &#x5B;main] &#x5B;o.s.c.s.GenericApplicationContext] &#x5B;WARN ] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jobLauncherTestUtils': Unsatisfied dependency expressed through method 'setJob' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.batch.core.Job' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}\r\n&#x5B;2018\/01\/04 12:02:24] &#x5B;main] &#x5B;o.s.t.c.TestContextManager] &#x5B;ERROR] Caught exception while allowing TestExecutionListener &#x5B;org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1fbf16f] to prepare test instance &#x5B;service.sample01.Sample01JobTaskletTest@ab05ed]\r\njava.lang.IllegalStateException: Failed to load ApplicationContext\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) &#x5B;junit.jar:4.12]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) &#x5B;junit.jar:4.12]\r\n\tat org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) &#x5B;junit.jar:4.12]\r\n\tat org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) &#x5B;junit.jar:4.12]\r\n\tat org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) &#x5B;junit.jar:4.12]\r\n\tat org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) &#x5B;junit.jar:4.12]\r\n\tat org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.junit.runners.ParentRunner.run(ParentRunner.java:363) &#x5B;junit.jar:4.12]\r\n\tat org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) &#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.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.UnsatisfiedDependencyException: Error creating bean with name 'jobLauncherTestUtils': Unsatisfied dependency expressed through method 'setJob' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.batch.core.Job' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:667) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1225) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:552) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.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-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ~&#x5B;spring-test-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\t... 25 common frames omitted\r\nCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.batch.core.Job' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1474) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1102) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\tat org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:659) ~&#x5B;spring-beans-4.3.5.RELEASE.jar:4.3.5.RELEASE]\r\n\t... 43 common frames omitted\r\n<\/pre>\n<h3 id=\"outline__1_3\">\u539f\u56e0<\/h3>\n<p>spring batch\u306e\u30b8\u30e7\u30d6\u306e\u8a2d\u5b9a\u3092\u3057\u3066\u3044\u308bXML\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u306a\u304b\u3063\u305f\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3001\u300cNo qualifying bean of type &#8216;org.springframework.batch.core.Job&#8217;\u300d\u304c\u53cd\u5fdc\u3057\u3066\u3044\u305f\u3002<\/p>\n<h3 id=\"outline__1_4\">\u89e3\u6c7a\u7b56<\/h3>\n<p>xml\u30d5\u30a1\u30a4\u30eb\u3092\u60f3\u5b9a\u901a\u308a\u5168\u3066\u8aad\u307f\u8fbc\u3093\u3067\u3044\u308b\u304b\u3092\u898b\u76f4\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Junit\u3067spring batch\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3088\u3046\u3068\u3057\u305f\u3089\u30a8\u30e9\u30fc [IllegalStateE [&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,24,7],"tags":[87,89,10],"class_list":["post-236","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-batch","category-spring","category-error-bugs","tag-batch","tag-illegalstateexception","tag-spring"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/236","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=236"}],"version-history":[{"count":4,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/236\/revisions"}],"predecessor-version":[{"id":465,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/236\/revisions\/465"}],"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=236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}