先上报错信息,首先声明由于刚开始不想更改版本号,所以我的springboot版本为2.1.1,springcloud版本为Greenwich.M3
D:\developer\jdk1.8.0_172\bin\java.exe -Dserver.port=8081 -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=57443 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2018.1.3\lib\idea_rt.jar=57444:D:\Program Files\JetBrains\IntelliJ IDEA 2018.1.3\bin" -Dfile.encoding=UTF-8 -classpath D:\developer\jdk1.8.0_172\jre\lib\charsets.jar;D:\developer\jdk1.8.0_172\jre\lib\deploy.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\access-bridge-64.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\cldrdata.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\dnsns.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\jaccess.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\jfxrt.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\localedata.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\nashorn.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\sunec.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\sunjce_provider.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\sunmscapi.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\sunpkcs11.jar;D:\developer\jdk1.8.0_172\jre\lib\ext\zipfs.jar;D:\developer\jdk1.8.0_172\jre\lib\javaws.jar;D:\developer\jdk1.8.0_172\jre\lib\jce.jar;D:\developer\jdk1.8.0_172\jre\lib\jfr.jar;D:\developer\jdk1.8.0_172\jre\lib\jfxswt.jar;D:\developer\jdk1.8.0_172\jre\lib\jsse.jar;D:\developer\jdk1.8.0_172\jre\lib\management-agent.jar;D:\developer\jdk1.8.0_172\jre\lib\plugin.jar;D:\developer\jdk1.8.0_172\jre\lib\resources.jar;D:\developer\jdk1.8.0_172\jre\lib\rt.jar;D:\IdeaProjects\imooc\spring-cloud\order\server\target\classes;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-starter-netflix-eureka-client\2.1.0.M3\spring-cloud-starter-netflix-eureka-client-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-starter\2.1.0.M2\spring-cloud-starter-2.1.0.M2.jar;C:\Users\liuhf\.m2\repository\org\springframework\security\spring-security-rsa\1.0.7.RELEASE\spring-security-rsa-1.0.7.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\bouncycastle\bcpkix-jdk15on\1.60\bcpkix-jdk15on-1.60.jar;C:\Users\liuhf\.m2\repository\org\bouncycastle\bcprov-jdk15on\1.60\bcprov-jdk15on-1.60.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-netflix-hystrix\2.1.0.M3\spring-cloud-netflix-hystrix-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-netflix-eureka-client\2.1.0.M3\spring-cloud-netflix-eureka-client-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\com\netflix\eureka\eureka-client\1.9.8\eureka-client-1.9.8.jar;C:\Users\liuhf\.m2\repository\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;C:\Users\liuhf\.m2\repository\stax\stax-api\1.0.1\stax-api-1.0.1.jar;C:\Users\liuhf\.m2\repository\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;C:\Users\liuhf\.m2\repository\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;C:\Users\liuhf\.m2\repository\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;C:\Users\liuhf\.m2\repository\joda-time\joda-time\2.10.1\joda-time-2.10.1.jar;C:\Users\liuhf\.m2\repository\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;C:\Users\liuhf\.m2\repository\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;C:\Users\liuhf\.m2\repository\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;C:\Users\liuhf\.m2\repository\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;C:\Users\liuhf\.m2\repository\com\google\guava\guava\16.0\guava-16.0.jar;C:\Users\liuhf\.m2\repository\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;C:\Users\liuhf\.m2\repository\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;C:\Users\liuhf\.m2\repository\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;C:\Users\liuhf\.m2\repository\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;C:\Users\liuhf\.m2\repository\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;C:\Users\liuhf\.m2\repository\org\apache\httpcomponents\httpclient\4.5.6\httpclient-4.5.6.jar;C:\Users\liuhf\.m2\repository\org\apache\httpcomponents\httpcore\4.4.10\httpcore-4.4.10.jar;C:\Users\liuhf\.m2\repository\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;C:\Users\liuhf\.m2\repository\com\google\inject\guice\4.1.0\guice-4.1.0.jar;C:\Users\liuhf\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\liuhf\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\liuhf\.m2\repository\com\github\vlsi\compactmap\compactmap\1.2.1\compactmap-1.2.1.jar;C:\Users\liuhf\.m2\repository\com\github\andrewoma\dexx\dexx-collections\0.2\dexx-collections-0.2.jar;C:\Users\liuhf\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.7\jackson-core-2.9.7.jar;C:\Users\liuhf\.m2\repository\com\netflix\eureka\eureka-core\1.9.8\eureka-core-1.9.8.jar;C:\Users\liuhf\.m2\repository\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar;C:\Users\liuhf\.m2\repository\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;C:\Users\liuhf\.m2\repository\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.1.0.M3\spring-cloud-starter-netflix-archaius-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-netflix-archaius\2.1.0.M3\spring-cloud-netflix-archaius-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;C:\Users\liuhf\.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\2.1.0.M3\spring-cloud-starter-netflix-ribbon-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\com\netflix\ribbon\ribbon\2.3.0\ribbon-2.3.0.jar;C:\Users\liuhf\.m2\repository\com\netflix\ribbon\ribbon-transport\2.3.0\ribbon-transport-2.3.0.jar;C:\Users\liuhf\.m2\repository\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;C:\Users\liuhf\.m2\repository\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;C:\Users\liuhf\.m2\repository\com\netflix\hystrix\hystrix-core\1.5.12\hystrix-core-1.5.12.jar;C:\Users\liuhf\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;C:\Users\liuhf\.m2\repository\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;C:\Users\liuhf\.m2\repository\com\netflix\ribbon\ribbon-core\2.3.0\ribbon-core-2.3.0.jar;C:\Users\liuhf\.m2\repository\com\netflix\ribbon\ribbon-httpclient\2.3.0\ribbon-httpclient-2.3.0.jar;C:\Users\liuhf\.m2\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\Users\liuhf\.m2\repository\com\netflix\netflix-commons\netflix-commons-util\0.3.0\netflix-commons-util-0.3.0.jar;C:\Users\liuhf\.m2\repository\com\netflix\ribbon\ribbon-loadbalancer\2.3.0\ribbon-loadbalancer-2.3.0.jar;C:\Users\liuhf\.m2\repository\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;C:\Users\liuhf\.m2\repository\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;C:\Users\liuhf\.m2\repository\com\netflix\ribbon\ribbon-eureka\2.3.0\ribbon-eureka-2.3.0.jar;C:\Users\liuhf\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\liuhf\.m2\repository\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;C:\Users\liuhf\.m2\repository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;C:\Users\liuhf\.m2\repository\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-openfeign-core\2.1.0.M2\spring-cloud-openfeign-core-2.1.0.M2.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.1.1.RELEASE\spring-boot-autoconfigure-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot\2.1.1.RELEASE\spring-boot-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-netflix-ribbon\2.1.0.M3\spring-cloud-netflix-ribbon-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter-aop\2.1.1.RELEASE\spring-boot-starter-aop-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-aop\5.1.3.RELEASE\spring-aop-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\aspectj\aspectjweaver\1.9.2\aspectjweaver-1.9.2.jar;C:\Users\liuhf\.m2\repository\io\github\openfeign\form\feign-form-spring\3.3.0\feign-form-spring-3.3.0.jar;C:\Users\liuhf\.m2\repository\io\github\openfeign\form\feign-form\3.3.0\feign-form-3.3.0.jar;C:\Users\liuhf\.m2\repository\com\google\code\findbugs\annotations\3.0.1\annotations-3.0.1.jar;C:\Users\liuhf\.m2\repository\net\jcip\jcip-annotations\1.0\jcip-annotations-1.0.jar;C:\Users\liuhf\.m2\repository\com\google\code\findbugs\jsr305\3.0.1\jsr305-3.0.1.jar;C:\Users\liuhf\.m2\repository\commons-fileupload\commons-fileupload\1.3.3\commons-fileupload-1.3.3.jar;C:\Users\liuhf\.m2\repository\commons-io\commons-io\2.2\commons-io-2.2.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-config-client\2.1.0.M3\spring-cloud-config-client-2.1.0.M3.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-commons\2.1.0.M2\spring-cloud-commons-2.1.0.M2.jar;C:\Users\liuhf\.m2\repository\org\springframework\security\spring-security-crypto\5.1.2.RELEASE\spring-security-crypto-5.1.2.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\cloud\spring-cloud-context\2.1.0.M2\spring-cloud-context-2.1.0.M2.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-web\5.1.3.RELEASE\spring-web-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-beans\5.1.3.RELEASE\spring-beans-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\liuhf\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.7\jackson-databind-2.9.7.jar;C:\Users\liuhf\.m2\repository\com\imooc\product-client\0.0.1-SNAPSHOT\product-client-0.0.1-SNAPSHOT.jar;C:\Users\liuhf\.m2\repository\com\imooc\product-common\0.0.1-SNAPSHOT\product-common-0.0.1-SNAPSHOT.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter\2.1.1.RELEASE\spring-boot-starter-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.1.1.RELEASE\spring-boot-starter-logging-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\liuhf\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\liuhf\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.11.1\log4j-to-slf4j-2.11.1.jar;C:\Users\liuhf\.m2\repository\org\apache\logging\log4j\log4j-api\2.11.1\log4j-api-2.11.1.jar;C:\Users\liuhf\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\liuhf\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\liuhf\.m2\repository\org\yaml\snakeyaml\1.23\snakeyaml-1.23.jar;C:\Users\liuhf\.m2\repository\net\bytebuddy\byte-buddy\1.9.5\byte-buddy-1.9.5.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-core\5.1.3.RELEASE\spring-core-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-jcl\5.1.3.RELEASE\spring-jcl-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.1.1.RELEASE\spring-boot-starter-web-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.1.1.RELEASE\spring-boot-starter-json-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.7\jackson-datatype-jdk8-2.9.7.jar;C:\Users\liuhf\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.7\jackson-datatype-jsr310-2.9.7.jar;C:\Users\liuhf\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.7\jackson-module-parameter-names-2.9.7.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.1.1.RELEASE\spring-boot-starter-tomcat-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.13\tomcat-embed-core-9.0.13.jar;C:\Users\liuhf\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.13\tomcat-embed-el-9.0.13.jar;C:\Users\liuhf\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.13\tomcat-embed-websocket-9.0.13.jar;C:\Users\liuhf\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.13.Final\hibernate-validator-6.0.13.Final.jar;C:\Users\liuhf\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\liuhf\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\liuhf\.m2\repository\com\fasterxml\classmate\1.4.0\classmate-1.4.0.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-webmvc\5.1.3.RELEASE\spring-webmvc-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-context\5.1.3.RELEASE\spring-context-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-expression\5.1.3.RELEASE\spring-expression-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter-data-jpa\2.1.1.RELEASE\spring-boot-starter-data-jpa-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.1.1.RELEASE\spring-boot-starter-jdbc-2.1.1.RELEASE.jar;C:\Users\liuhf\.m2\repository\com\zaxxer\HikariCP\3.2.0\HikariCP-3.2.0.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-jdbc\5.1.3.RELEASE\spring-jdbc-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\javax\transaction\javax.transaction-api\1.3\javax.transaction-api-1.3.jar;C:\Users\liuhf\.m2\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;C:\Users\liuhf\.m2\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;C:\Users\liuhf\.m2\repository\org\hibernate\hibernate-core\5.3.7.Final\hibernate-core-5.3.7.Final.jar;C:\Users\liuhf\.m2\repository\javax\persistence\javax.persistence-api\2.2\javax.persistence-api-2.2.jar;C:\Users\liuhf\.m2\repository\org\javassist\javassist\3.23.1-GA\javassist-3.23.1-GA.jar;C:\Users\liuhf\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\liuhf\.m2\repository\org\jboss\jandex\2.0.5.Final\jandex-2.0.5.Final.jar;C:\Users\liuhf\.m2\repository\org\dom4j\dom4j\2.1.1\dom4j-2.1.1.jar;C:\Users\liuhf\.m2\repository\org\hibernate\common\hibernate-commons-annotations\5.0.4.Final\hibernate-commons-annotations-5.0.4.Final.jar;C:\Users\liuhf\.m2\repository\org\springframework\data\spring-data-jpa\2.1.3.RELEASE\spring-data-jpa-2.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\data\spring-data-commons\2.1.3.RELEASE\spring-data-commons-2.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-orm\5.1.3.RELEASE\spring-orm-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-tx\5.1.3.RELEASE\spring-tx-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\org\springframework\spring-aspects\5.1.3.RELEASE\spring-aspects-5.1.3.RELEASE.jar;C:\Users\liuhf\.m2\repository\mysql\mysql-connector-java\5.1.43\mysql-connector-java-5.1.43.jar;C:\Users\liuhf\.m2\repository\org\projectlombok\lombok\1.18.4\lombok-1.18.4.jar;C:\Users\liuhf\.m2\repository\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar com.imooc.order.OrderApplication
2018-12-12 10:30:17.451 INFO 12128 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$ac375347] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-12-12 10:30:18.775 INFO 12128 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname
2018-12-12 10:30:18.791 INFO 12128 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2018-12-12 10:30:18.822 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2018-12-12 10:30:19.139 INFO 12128 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2018-12-12 10:30:19.139 INFO 12128 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2018-12-12 10:30:19.217 INFO 12128 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2018-12-12 10:30:19.217 INFO 12128 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2018-12-12 10:30:19.342 INFO 12128 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2018-12-12 10:30:19.530 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2018-12-12 10:30:19.530 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2018-12-12 10:30:19.530 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2018-12-12 10:30:19.530 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2018-12-12 10:30:19.530 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2018-12-12 10:30:19.530 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2018-12-12 10:30:19.530 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2018-12-12 10:30:19.639 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : The response status is 200
2018-12-12 10:30:19.639 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Not registering with Eureka server per configuration
2018-12-12 10:30:19.655 INFO 12128 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1544581819639 with initial instances count: 1
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.1.RELEASE)
2018-12-12 10:30:20.999 INFO 12128 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8080/
2018-12-12 10:30:23.108 INFO 12128 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=order, profiles=[dev], label=null, version=8f6f502827ddbf876e550cc8cea7cc552c7fbaaf, state=null
2018-12-12 10:30:23.108 INFO 12128 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='configClient'}, MapPropertySource {name='https://gitee.com/codelhf/spring-cloud-config/order-dev.yml'}]}
2018-12-12 10:30:23.108 INFO 12128 --- [ main] com.imooc.order.OrderApplication : No active profile set, falling back to default profiles: default
2018-12-12 10:30:23.499 INFO 12128 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2018-12-12 10:30:23.546 INFO 12128 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 47ms. Found 2 repository interfaces.
2018-12-12 10:30:23.702 INFO 12128 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=258d3afa-936f-387d-970a-20cf7dd7a764
2018-12-12 10:30:23.718 WARN 12128 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.imooc.product.client.ProductClient': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.openfeign.FeignClientFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
2018-12-12 10:30:23.718 INFO 12128 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-12-12 10:30:23.733 ERROR 12128 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.imooc.product.client.ProductClient': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.openfeign.FeignClientFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:228) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.1.RELEASE.jar:2.1.1.RELEASE]
at com.imooc.order.OrderApplication.main(OrderApplication.java:14) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.imooc.product.client.ProductClient': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.openfeign.FeignClientFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1236) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1151) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getSingletonFactoryBeanForTypeCheck(AbstractAutowireCapableBeanFactory.java:974) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:848) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:574) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:514) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:477) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:227) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1401) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1200) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1164) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
... 19 common frames omitted
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.cloud.openfeign.FeignClientFactoryBean] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:686) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:583) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:568) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:248) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
... 32 common frames omitted
Caused by: java.lang.NoClassDefFoundError: feign/Feign$Builder
at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_172]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_172]
at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_172]
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:668) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE]
... 35 common frames omitted
Caused by: java.lang.ClassNotFoundException: feign.Feign$Builder
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_172]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_172]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_172]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_172]
... 39 common frames omitted
Process finished with exit code 1
- 一开始遇到这个报错以为是我的product服务打包的问题,因为product-client模块打包失败,无法引入product-common,一直提示如下报错信息
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project product-client: Compilation failure: Compilation failure:
[ERROR] /D:/IdeaProjects/imooc/spring-cloud/product/client/src/main/java/com/imooc/product/client/ProductClient.java:[3,32] 程序包com.imooc.product.common不存在
[ERROR] /D:/IdeaProjects/imooc/spring-cloud/product/client/src/main/java/com/imooc/product/client/ProductClient.java:[4,32] 程序包com.imooc.product.common不存在
[ERROR] /D:/IdeaProjects/imooc/spring-cloud/product/client/src/main/java/com/imooc/product/client/ProductClient.java:[15,10] 找不到符号
[ERROR] 符号: 类 ProductInfoOutput
[ERROR] 位置: 接口 com.imooc.product.client.ProductClient
[ERROR] /D:/IdeaProjects/imooc/spring-cloud/product/client/src/main/java/com/imooc/product/client/ProductClient.java:[18,42] 找不到符号
[ERROR] 符号: 类 DecreaseStockInput
[ERROR] 位置: 接口 com.imooc.product.client.ProductClient
所以我将product-common中的ProductOutput和DecreaseStock两个类放在了product-client模块中(ps之前的操作中在order-server模块提示缺少这两个类),使prodcut-client不在依赖product-commot模块,暂时完成了打包,
2. 虽然暂时完成了打包,可以遇到了最上面的order-server引用product-client后提示feignClassNotFound的报错信息,很自然的想到是product-client模块的打包的问题,在网上了很多文章例如
这篇文章maven多模块打包遇到问题详解中的在父工程pom文件中加入如下配置的
<plugins>
<!--创建项目时自带的 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- 自己添加的 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.13.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
但是通过上面的配置仍然没有解决Product-client打包的问题(看来我对maven的了解还是不够呀),好吧继续找解决办法,终于在这篇IDEA maven 多模块打包问题总结解开了我的疑惑
如果在用maven构建多模块项目时,不要将此插件放到parent pom中,否则如果有sub module不是spring boot应用,在打包时就会出错。只将该插件添加到是spring boot项目的子模块。上面例子中common模块不是spring boot应用就不需要此插件,故不要将此插件放到shopping pom中
加上spring-boot-maven-plugin
<plugins>
<!--创建项目时自带的 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
打包后的jar包结构
不加spring-boot-maven-plugin后打包的结构,里面只有自己写的类
个人的理解,在打包到本地仓库的jar包,product、product-client、product-common和product-server之间有依赖关系,所以即使order-server中只引用了product-client,而且product-client包中只有自己的类也可以使用到product-common中的类
3. 在Spring Boot 2下使用Feign找不到@EnableFeignClients的解决办法这篇文章中的方法感觉复杂本人并没有尝试
Spring Cloud对Feign的支持由org.springframework.cloud:spring-cloud-netflix-core移到org.springframework.cloud:spring-cloud-openfeign-core下,而Finchley.M9版本下的spring-cloud-starter-openfeign:2.0.0.M2的pom依赖文件中导入的是spring-cloud-netflix-core而非spring-cloud-openfeign-core,需要我们在pom文件中添加对应依赖管理使spring-cloud-starter-openfeign版本更新到2.0.0.RC1,如下图
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-openfeign</artifactId>
<version>2.0.0.RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
其实到这里我还在纠结spring-cloud-starter-feign、spring-cloud-openfeign-core和spring-cloud-starter-openfeign的选择
对比一下上面M2版本的依赖树,可以很明显地看到与Feign相关的依赖包的变化是org.springframework.cloud:spring-cloud-netflix-core换成了org.springframework.cloud:spring-cloud-openfeign-core
直接看一下import信息,发现注解的类名为org.springframework.cloud.openfeign.EnableFeignClients,与上面看到的做对比,就可以发现@EnableFeignClients注解由org.springframework.cloud.netflix.feign.EnableFeignClients换为org.springframework.cloud.openfeign.EnableFeignClients
即在M2版本中@EnableFeignClients的类已经换了,但对应的spring-cloud-starter-openfeign下的依赖却没有更新,所以就找不到对应的类了
后来对比了两个依赖的结构后选择spring-cloud-starter-openfeign就好了
对于当时为什么选择spring-cloud-openfeign-core,首先我的springboot版本为2.1.1,springcloud版本为Greenwich.M3,也是参考下面内容选择的
Spring Cloud对Feign的支持由org.springframework.cloud:spring-cloud-netflix-core移到org.springframework.cloud:spring-cloud-openfeign-core下,而Finchley.M9版本下的spring-cloud-starter-openfeign:2.0.0.M2的pom依赖文件中导入的是spring-cloud-netflix-core而非spring-cloud-openfeign-core,需要我们在pom文件中添加对应依赖管理使spring-cloud-starter-openfeign版本更新到2.0.0.RC1,如下图
最后总结一下,第一是自己对spring cloud组件的使用不熟,引入组件依赖的套路spring-cloud-starter-*;第二尝试太新的版本,不按照课程中的版本当然要入坑了;不过对于我来说按照课程学习内容虽好,通过解决版本使用中遇到的问题更是一种挑战和进步