微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

工厂方法“batchStubRunner”抛出异常;嵌套异常是断言失败:

如何解决工厂方法“batchStubRunner”抛出异常;嵌套异常是断言失败:

我正在从 spring-boot 2.1.13.RELEASE 升级到 2.4.4。

升级后在 spring-cloud-contract 测试中出现以下错误,运行 maven build 时。

  • Groovy 版本:3.0.6
  • spring-cloud.version : Greenwich.SR6
  • wiremock.version : 2.27.2
  • spock.version : 2.0-M4-groovy-3.0

2021-05-14 15:51:01.471  WARN [test,] 8890 --- [           main] o.s.boot.StartupInfoLogger               : InetAddress.getLocalHost().getHostName() took 5005 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).
2021-05-14 15:51:06.477  INFO [test,] 8890 --- [           main] c.i.kea.web.contract.common.Addressspec  : Starting Addressspec using Java 1.8.0_231 on pcusers-MacBook-Pro.local with PID 8890 (started by pcuser in /Users/pcuser/Workspace/branch/SR-1340/digital-investor-web-app)
2021-05-14 15:51:06.479  INFO [test,] 8890 --- [           main] c.i.kea.web.contract.common.Addressspec  : The following profiles are active: integrationtest,h2-test
2021-05-14 15:51:09.130  INFO [test,] 8890 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'com.ifds.kea.api.common.web.client.rewrite.UriCustomizerAutoConfiguration' of type [com.ifds.kea.api.common.web.client.rewrite.UriCustomizerAutoConfiguration$$EnhancerBySpringcglib$$a3e7890d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.172  INFO [test,] 8890 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@13803a94' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.199  INFO [test,] 8890 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.557  INFO [test,] 8890 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'stubrunner-org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties' of type [org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.561  INFO [test,] 8890 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration' of type [org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringcglib$$211927d4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.589  INFO [test,] 8890 --- [           main] o.s.c.c.s.AetherStubDownloaderBuilder    : Will download stubs and contracts via Aether
2021-05-14 15:51:10.017  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Desired version is [+] - will try to resolve the latest version
2021-05-14 15:51:13.216  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Resolved version is [1.0.0-20210423062638352]
2021-05-14 15:51:15.125  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Resolved artifact [com.ifds.kea.api:kea-code-api:jar:stubs:1.0.0-20210423062638352] to /var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local294260021435503282/com/ifds/kea/api/kea-code-api/1.0.0-20210423062638352/kea-code-api-1.0.0-20210423062638352-stubs.jar
2021-05-14 15:51:15.127  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Unpacking stub from JAR [URI: file:/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local294260021435503282/com/ifds/kea/api/kea-code-api/1.0.0-20210423062638352/kea-code-api-1.0.0-20210423062638352-stubs.jar]
2021-05-14 15:51:15.144  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Unpacked file to [/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/contracts2633830323280917374]
2021-05-14 15:51:18.008  INFO [test,] 8890 --- [           main] o.s.c.c.s.AetherStubDownloaderBuilder    : Will download stubs and contracts via Aether
2021-05-14 15:51:18.011  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Desired version is [+] - will try to resolve the latest version
2021-05-14 15:51:20.683  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Resolved version is [1.0.0-20210423050528085]
2021-05-14 15:51:24.328  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Resolved artifact [com.ifds.kea.api:kea-customer-api:jar:stubs:1.0.0-20210423050528085] to /var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local6763085284579893391/com/ifds/kea/api/kea-customer-api/1.0.0-20210423050528085/kea-customer-api-1.0.0-20210423050528085-stubs.jar
2021-05-14 15:51:24.329  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Unpacking stub from JAR [URI: file:/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local6763085284579893391/com/ifds/kea/api/kea-customer-api/1.0.0-20210423050528085/kea-customer-api-1.0.0-20210423050528085-stubs.jar]
2021-05-14 15:51:24.434  INFO [test,] 8890 --- [           main] o.s.c.c.stubrunner.AetherStubDownloader  : Unpacked file to [/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/contracts5025264596678888109]
2021-05-14 15:51:27.697  WARN [test,] 8890 --- [           main] o.s.w.c.s.GenericWebApplicationContext   : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'batchStubRunnerBeanPostProcessor' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Unsatisfied dependency expressed through method 'batchStubRunnerBeanPostProcessor' parameter 0; 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 Assertion Failed: 

assert value ==~ pattern.pattern
|     |   |       |
|     |   |       /api/v0/investors/[0-9]{8}/marketing-preferences
|     |   /api/v0/investors/[0-9]{8}/marketing-preferences
|     false
'api/v0/investors/10035186/marketing-preferences'

2021-05-14 15:51:27.709  INFO [test,] 8890 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-05-14 15:51:27.753  WARN [test,] 8890 --- [           main] com.getsentry.raven.dsn.Dsn              : Couldn't find a suitable DSN,defaulting to a Noop one.
2021-05-14 15:51:27.760  INFO [test,] 8890 --- [           main] com.getsentry.raven.DefaultRavenFactory  : Using noop to send events.
2021-05-14 15:51:27.768  INFO [test,] 8890 --- [           main] com.getsentry.raven.Raven                : Adding 'com.getsentry.raven.event.helper.HttpEventBuilderHelper@279afa4e' to the list of builder helpers.
2021-05-14 15:51:27.747 ERROR [test,] 8890 --- [           main] o.s.boot.SpringApplication               : Application run Failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'batchStubRunnerBeanPostProcessor' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Unsatisfied dependency expressed through method 'batchStubRunnerBeanPostProcessor' parameter 0; 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 Assertion Failed: 

assert value ==~ pattern.pattern
|     |   |       |
|     |   |       /api/v0/investors/[0-9]{8}/marketing-preferences
|     |   /api/v0/investors/[0-9]{8}/marketing-preferences
|     false
'api/v0/investors/10035186/marketing-preferences'

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。