ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

SpringBoot项目报错之java.lang.IllegalStateException: Failed to load ApplicationContext

2020-02-19 15:03:49  阅读:323  来源: 互联网

标签:lang load java web factory springframework 报错 beans org


***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call the method springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder; but it does not exist. Its class, springfox.documentation.swagger.web.UiConfigurationBuilder, is available from the following locations:

    jar:file:/Users/zhangmengjie/Documents/devTool/maven/mavenRepository/io/springfox/springfox-swagger-common/2.8.0/springfox-swagger-common-2.8.0.jar!/springfox/documentation/swagger/web/UiConfigurationBuilder.class

It was loaded from the following location:

    file:/Users/zhangmengjie/Documents/devTool/maven/mavenRepository/io/springfox/springfox-swagger-common/2.8.0/springfox-swagger-common-2.8.0.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of springfox.documentation.swagger.web.UiConfigurationBuilder

2020-02-19 14:29:35.832 ERROR 1544 --- [           main] o.s.test.context.TestContextManager      : Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@510da778] to prepare test instance [com.unicom.microserv.skyark.component.sample.web.SkyarkBasicDemoApplicationTest@1177e2c4]

java.lang.IllegalStateException: Failed to load ApplicationContext
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)
    at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108)
    at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:190)
    at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:132)
    at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiResourceController': Unsatisfied dependency expressed through field 'uiConfiguration'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uiConfig' defined in class path resource [com/unicom/skyark/component/web/config/SwaggerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.swagger.web.UiConfiguration]: Factory method 'uiConfig' threw exception; nested exception is java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:596)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:90)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:374)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1378)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:575)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
    at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:127)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99)
    at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117)
    ... 27 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uiConfig' defined in class path resource [com/unicom/skyark/component/web/config/SwaggerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.swagger.web.UiConfiguration]: Factory method 'uiConfig' threw exception; nested exception is java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:273)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1237)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
    ... 45 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.swagger.web.UiConfiguration]: Factory method 'uiConfig' threw exception; nested exception is java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622)
    ... 58 common frames omitted
Caused by: java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;
    at com.unicom.skyark.component.web.config.SwaggerConfig.uiConfig(SwaggerConfig.java:90)
    at com.unicom.skyark.component.web.config.SwaggerConfig$$EnhancerBySpringCGLIB$$64e9b651.CGLIB$uiConfig$1(<generated>)
    at com.unicom.skyark.component.web.config.SwaggerConfig$$EnhancerBySpringCGLIB$$64e9b651$$FastClassBySpringCGLIB$$b4253eab.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
    at com.unicom.skyark.component.web.config.SwaggerConfig$$EnhancerBySpringCGLIB$$64e9b651.uiConfig(<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:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 59 common frames omitted

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 9.429 s <<< FAILURE! - in com.unicom.microserv.skyark.component.sample.web.SkyarkBasicDemoApplicationTest
[ERROR] testModule(com.unicom.microserv.skyark.component.sample.web.SkyarkBasicDemoApplicationTest)  Time elapsed: 0.002 s  <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apiResourceController': Unsatisfied dependency expressed through field 'uiConfiguration'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uiConfig' defined in class path resource [com/unicom/skyark/component/web/config/SwaggerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.swagger.web.UiConfiguration]: Factory method 'uiConfig' threw exception; nested exception is java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uiConfig' defined in class path resource [com/unicom/skyark/component/web/config/SwaggerConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.swagger.web.UiConfiguration]: Factory method 'uiConfig' threw exception; nested exception is java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [springfox.documentation.swagger.web.UiConfiguration]: Factory method 'uiConfig' threw exception; nested exception is java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;
Caused by: java.lang.NoSuchMethodError: springfox.documentation.swagger.web.UiConfigurationBuilder.supportedSubmitMethods([Ljava/lang/String;)Lspringfox/documentation/swagger/web/UiConfigurationBuilder;

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   SkyarkBasicDemoApplicationTest.testModule » IllegalState Failed to load Applic...
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.514 s
[INFO] Finished at: 2020-02-19T14:29:36+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project skyark_component_sample_web: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/zhangmengjie/Documents/workspaces/IDEASpace2019/skyark_component_sample/skyark_component_sample_web/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

Process finished with exit code 1

小梦_Java成长日记 发布了14 篇原创文章 · 获赞 6 · 访问量 7599 私信 关注

标签:lang,load,java,web,factory,springframework,报错,beans,org
来源: https://blog.csdn.net/ZMJ_Alisa/article/details/104392710

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有