1. 程式人生 > >springcloud 入門第一坑[org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process]

springcloud 入門第一坑[org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process]

springcloud 需要和springboot搭配使用,而其中,對於初學者來說,版本的搭配是相對關鍵 .通常網上的教程都會有相應的版本搭配,而我因為已經是用了springboot 1.5.10 所以,只能挑選對應的springcloud版本,如果版本沒挑選對,就會出現異常.

記錄我花了兩天的時間理出來的一個坑.

我的配置是這樣的:


<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>1.5.10.RELEASE</version>
		 <relativePath/>
	</parent>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<all.version>0.0.1-SNAPSHOT</all.version>
	</properties>
	<modules>
		<module>test-common</module>
		<module>test-core</module>
		<module>test-uapp</module>
	</modules>
	
	<dependencyManagement>
		<dependencies>
			<dependency> 
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>Camden.SR3</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>


	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build> 


	<repositories>
		<repository>
			<id>spring-milestones</id>
			<name>Spring Milestones</name>
			<url>https://repo.spring.io/milestone</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots> 
		</repository>
	</repositories> 
	
	

於是就報了這個錯,

2018-03-15 23:27:54.141  INFO 2772 --- [           main] c.jmsw.uapp.sys.EurekaserverApplication  : No active profile set, falling back to default profiles: default
2018-03-15 23:27:54.153  INFO 2772 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot
[email protected]
5ef6ae06: startup date [Thu Mar 15 23:27:54 CST 2018]; parent: org.spring[email protected]35047d03 2018-03-15 23:27:54.192 WARN 2772 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.jmsw.uapp.sys.EurekaserverApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.eureka.server.EurekaServerConfiguration 2018-03-15 23:27:54.202 ERROR 2772 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.jmsw.uapp.sys.EurekaserverApplication]; nested exception is java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.eureka.server.EurekaServerConfiguration at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:616) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:299) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:198) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:167) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:308) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:92) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE] at com.jmsw.uapp.sys.EurekaserverApplication.main(EurekaserverApplication.java:13) [classes/:na] Caused by: java.lang.IllegalStateException: Failed to introspect annotated methods on class org.springframework.cloud.netflix.eureka.server.EurekaServerConfiguration at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:163) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.retrieveBeanMethodMetadata(ConfigurationClassParser.java:380) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:314) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:245) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:606) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE] ... 17 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/FilterRegistrationBean at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_162] at java.lang.Class.privateGetDeclaredMethods(Unknown Source) ~[na:1.8.0_162] at java.lang.Class.getDeclaredMethods(Unknown Source) ~[na:1.8.0_162] at org.springframework.core.type.StandardAnnotationMetadata.getAnnotatedMethods(StandardAnnotationMetadata.java:152) ~[spring-core-4.3.14.RELEASE.jar:4.3.14.RELEASE] ... 21 common frames omitted Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.FilterRegistrationBean at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_162] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_162] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_162] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_162] ... 25 common frames omitted

或者就是啟動成功了,但是無法訪問sprincloud的那個網頁 eureka , 

在經歷了多次啟動測試後,發現,它們兩個之間的版本搭配尤其重要,也曾經在網上搜索資料

找到過這樣的資料(轉)

Spring BootSpring Cloud
1.2.xAngel版本
1.3.xBrixton版本
1.4.xCamden版本
1.5.xDalston版本、Edgware版本
2.0.xFinchley版本

備註: 
1. 版本不對應可能造成maven編譯專案時報錯。 
2. Spring Cloud 版本採用命名的方式,使用倫敦地鐵站名。其中SRx為該版本的一個Service Release版本,x為一個遞增的數字。例如:Dalston SR4。

於是我換成過對應的dalstion 版本,但是還是不行,後面去了SpringCloud官網, https://projects.spring.io/spring-cloud/ 

在官網上已經 有給出相應的搭配版本,,,直接複製下來就好了,,於是,我歷時兩天的問題居然只是去一趟官網就.......

於是我就把Springcloud的版本改成了Edgware.SR2  ,於是就啟動成功

ps:記錄下這個問題,相信不止我一個初學者會遇到這個問題,雖然很多教程上都有給出相匹配的版本搭配,不過還是需要去了解下,還有這個需要搭配對應的jdk,目前這個版本 最好使用jdk1.8 ,,千萬不要使用9 .....

相關推薦

springcloud 入門第一[org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process]

springcloud 需要和springboot搭配使用,而其中,對於初學者來說,版本的搭配是相對關鍵 .通常網上的教程都會有相應的版本搭配,而我因為已經是用了springboot 1.5.10 所以,只能挑選對應的springcloud版本,如果版本沒挑選對,就會出現異常

Springboot 啟動時org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse config

springboot 專案在Idea部署可以正常執行,但是無論打成jar或者war,啟動都會報錯,具體錯誤如下:16:31:16 [main] INFO  o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Re

org.springframework.beans.factory.BeanDefinitionStoreException

tro eve apps scanner mark lifecycle views def 解決 1、錯誤描寫敘述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ]

SpringMVC 問題 org.springframework.beans.factory.BeanDefinitionStoreException

tom 就是 lar ioe and use dap executor gis HTTP Status 500 – Internal Server Error Type Exception Report Message Servlet.init() for servlet

搭建springmvc框架時 報org.springframework.beans.factory.BeanDefinitionStoreException:

搭建springmvc框架報底下的錯,是因為web.xml檔案中的 contextConfigLocation classpath:spring/applicationContext-*.xml 路徑錯誤,正確的應該是 contextConfigLocati

嚴重: Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: I

嚴重: Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing 

Application startup failed org.springframework.beans.factory.BeanDefinitionStoreException

最近使用了spring boot開發專案,但是對這個框架的瞭解不深,現在把每次遇到的坑發出來作為記錄。 錯誤 Application startup failed org.springframework.beans.factory.BeanDefinitionStoreExcepti

org.springframework.beans.factory.BeanDefinitionStoreException:Filed

今天在進行spring和mybatis進行整合時,出現了下列錯誤   org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class:

org.springframework.beans.factory.BeanDefinitionStoreException異常處理

今天調程式碼的時候出現了 如下的錯誤,經過多方查證,發現原來是eclipse版本的問題。 異常: 四月 26, 2017 10:54:36 上午 org.apache.catalina.core.ApplicationContext log 資訊

org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document fro

在使用idea的時候報錯: org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path

Springmvc專案遇到問題 org.springframework.beans.factory.BeanDefinitionStoreException

在做一個springmvc專案時,配好伺服器執行後可能會遇到如下問題: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate compo

ssm框架搭建過程中出現 spring-org.springframework.beans.factory.BeanDefinitionStoreException的解決

今天配置完ssm框架,啟動tomcat伺服器,報了IOException以及spring-org.springframework.beans.factory.BeanDefinitionStoreException的異常,說是找不到springmvc.xml的配置檔案以及無

org.springframework.beans.factory.parsing.BeanDefinitionParsingException

factor fast .text classpath ssr fas 結果 sso 百度 今天在練習spring aop時。調試程序出現下面錯誤 org.springframework.beans.factory.parsing.BeanDefinitionParsi

關於Spring中org.springframework.beans.factory.UnsatisfiedDependencyException異常

參數 ont 使用 容易 font body actor const 區分 這個異常是由於在applicationContext.xml中關於bean的autowirte裝配類型,在類型byName,byType,constructor三種類型中,可能會出現因無法自動裝配而

ssm整合時出現 org.springframework.beans.factory.BeanCreationException :Error creating bean with name ‘XXX’ 異常的原因及解決方法

ase wan oca conn sna aspect ava 配置 ng- ssm整合時出現 org.springframework.beans.factory.BeanCreationException :Error creating bean with name ‘X

啟動項目報錯:org.springframework.beans.factory.UnsatisfiedDependencyException

ini ali 監聽 exp date ram factor 接口 xml文件 dubbo項目: 啟動項目報錯:(web端) org.springframework.beans.factory.UnsatisfiedDependencyException: Error cr

spring 裝配容器失敗- org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

出現 rom fin exception and enum file 找到 encoding 問題1. Context initialization failed org.springframework. beans.factory.xml.XmlBeanD

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.mapper.MapperScannerConfigurer#0'

4.2 register class rop required endorsed current namespace prope 七月 05, 2018 10:26:54 上午 org.apache.tomcat.util.digester.SetPropertiesRul

SpringMVC出現錯誤-org.springframework.beans.factory.BeanCreationException

ans 百度 想法 smb ava 是不是 ger control struct 配置SpringMVC,在啟動Tomcat時出錯了: 1 org.springframework.beans.factory.BeanCreationException: 2   Erro

SpringBoot整合ES+redis時報錯( org.springframework.beans.factory.UnsatisfiedDependencyException)

1.異常資訊: Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'postServiceImpl': Unsatisfie