Контракт Spring Cloud Не удалось создать экземпляр [org.springframework.cloud.contract.stubrunner.BatchStubRunner]

Я пытаюсь интегрировать Spring Cloud Contract в наш существующий проект. У меня работает заглушка-верификатор. Но когда я пытаюсь использовать эту заглушку в клиенте, я получаю следующее исключение. Я пытаюсь заставить это работать в автономном режиме. Пожалуйста, дайте мне знать, если вам понадобится дополнительная информация по этому же вопросу.

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-07-10 15:26:42.330 ERROR 20476 [] --- [main] o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'stubFlowRegistrar' defined in class path resource [org/springframework/cloud/contract/stubrunner/messaging/integration/StubRunnerIntegrationConfiguration.class]: Unsatisfied dependency expressed through method 'stubFlowRegistrar' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchStubRunner' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.contract.stubrunner.BatchStubRunner]: Factory method 'batchStubRunner' threw exception; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchStubRunner' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.contract.stubrunner.BatchStubRunner]: Factory method 'batchStubRunner' threw exception; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1134)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1064)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:835)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:741)
        ... 47 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.contract.stubrunner.BatchStubRunner]: Factory method 'batchStubRunner' threw exception; nested exception is java.lang.NullPointerException
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
        ... 60 common frames omitted
Caused by: java.lang.NullPointerException: null
        at org.springframework.cloud.contract.stubrunner.AetherFactories.newSession(AetherFactories.java:63)
        at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.<init>(AetherStubDownloader.java:83)
        at org.springframework.cloud.contract.stubrunner.StubDownloaderBuilderProvider.getOrDefaultDownloader(StubDownloaderBuilderProvider.java:48)
        at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration.batchStubRunner(StubRunnerConfiguration.java:75)
        at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringCGLIB$$52aa72bb.CGLIB$batchStubRunner$0(<generated>)
        at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringCGLIB$$52aa72bb$$FastClassBySpringCGLIB$$35176646.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
        at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringCGLIB$$52aa72bb.batchStubRunner(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
        ... 61 common frames omitted
2017-07-10 15:26:42.332 ERROR 20476 [] --- [main] o.s.test.context.TestContextManager - Caught exception while allowing TestExecutionListener 

person sagar27    schedule 10.07.2017    source источник
comment
Какую версию sc-contract вы используете? Можете ли вы представить где-нибудь свой простой проект? Если предположить, есть несоответствие между версиями Aether. Не могли бы вы попробовать использовать последние снимки и посмотреть, сохраняется ли проблема? В версии 1.2.x (цепочка релизов Edgware.BUILD-SNAPSHOT) мы потратили некоторое время на переупаковку Aether. Может, это поможет?   -  person Marcin Grzejszczak    schedule 10.07.2017
comment
В настоящее время я использую org.springframework.cloud:spring-cloud-starter-contract-stub-runner:1.1.1.RELEASE.   -  person sagar27    schedule 10.07.2017
comment
Используете поезд выпуска? Который из них? Можете ли вы проверить 1.2.0.BUILD-SNAPSHOT (от Edgware.BUILD-SNAPSHOT)?   -  person Marcin Grzejszczak    schedule 10.07.2017
comment
Спасибо Марчину за Быстрый ответ, эта версия у меня сработала. Однако возникла другая проблема, сейчас я попытаюсь ее отладить :)   -  person sagar27    schedule 10.07.2017
comment
Прохладный! Спасибо за информацию. Я дам ответ через секунду   -  person Marcin Grzejszczak    schedule 10.07.2017


Ответы (1)


Скорее всего, проблема связана с несоответствием версии Aether. Достаточно добавить версию к выпуску Edgware, где нам удалось затемнить Aether, и, наконец, Stub Runner не зависит от используемой версии Aether.

person Marcin Grzejszczak    schedule 10.07.2017