引入product-client依賴報ClassNotFoundExc

先上報錯信息,首先聲明由於剛開始不想更改版本號,所以我的springboot版本為2.1.1,springcloud版本為Greenwich.M3

D:developerjdk1.8.0_172binjava.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 FilesJetBrainsIntelliJ IDEA 2018.1.3libidea_rt.jar=57444:D:Program FilesJetBrainsIntelliJ IDEA 2018.1.3bin " -Dfile.encoding=UTF-8 -classpath D:developerjdk1.8.0_172jrelibcharsets.jar;D:developerjdk1.8.0_172jrelibdeploy.jar;D: developerjdk1.8.0_172jrelibextaccess-bridge-64.jar;D:developerjdk1.8.0_172jrelibextcldrdata.jar;D:developerjdk1.8.0_172 jrelibextdnsns.jar;D:developerjdk1.8.0_172jrelibextjaccess.jar;D:developerjdk1.8.0_172jrelibextjfxrt.jar ;D:developerjdk1.8.0_172jrelibextlocaledata.jar;D:developerjdk1.8.0_1 72jrelibextnashorn.jar;D:developerjdk1.8.0_172jrelibextsunec.jar;D:developerjdk1.8.0_172jrelibextsunjce_provider. jar;D:developerjdk1.8.0_172jrelibextsunmscapi.jar;D:developerjdk1.8.0_172jrelibextsunpkcs11.jar;D:developerjdk1.8.0 _172jrelibextzipfs.jar;D:developerjdk1.8.0_172jrelibjavaws.jar;D:developerjdk1.8.0_172jrelibjce.jar;D: developerjdk1.8.0_172jrelibjfr.jar;D:developerjdk1.8.0_172jrelibjfxswt.jar;D:developerjdk1.8.0_172jrelibjsse. jar;D:developerjdk1.8.0_172jrelibmanagement-agent.jar;D:developerjdk1.8.0_172jrelibplugin.jar;D:developerjdk1.8.0_172 jrelibresources.jar;D:developerjdk1.8.0_172jrelibrt.jar;D:IdeaProjectsimoocspring-cloudorderservertargetclasses;C:Users liuhf.m2repositoryorgspringframeworkcloudspring-cloud-starter-netflix-eureka-client2.1.0.M3spring-cloud-starter-netflix-eureka-client-2.1.0.M3.jar ;C:Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud-starter2.1.0 .M2spring-cloud-starter-2.1.0.M2.jar;C:Usersliuhf.m2repositoryorgspringframeworksecurityspring-security-rsa1.0.7.RELEASEspring-security -rsa-1.0.7.RELEASE.jar;C:Usersliuhf.m2repositoryorgbouncycastlebcpkix-jdk15on1.60bcpkix-jdk15on-1.60.jar;C:Usersliuhf.m2 repositoryorgbouncycastlebcprov-jdk15on1.60bcprov-jdk15on-1.60.jar;C:Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud-netflix-hystrix2.1.0 .M3spring-cloud-netflix-hystrix-2.1.0.M3.jar;C:Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud-netflix-eureka-client2.1.0 .M3spring-cloud-netflix-eureka-client-2.1.0.M3.jar;C:Usersliuhf.m2repositorycomnetflixeurekaeureka-client1.9.8eureka-client -1.9.8.jar;C:Usersliuhf.m2repositoryorgcodehausjettisonjettison1.3.7jettison-1.3.7.jar;C:Usersliuhf.m2repository staxstax-api1.0.1stax-api-1.0.1.jar;C:Usersliuhf.m2repositorycomnetflixnetflix-commonsnetflix-eventbus.3.0netflix -eventbus-0.3.0.jar;C:Users liuhf.m2repositorycomnetflixnetflix-commonsnetflix-infix.3.0netflix-infix-0.3.0.jar;C:Usersliuhf.m2repositorycommons-jxpathcommons -jxpath1.3commons-jxpath-1.3.jar;C:Usersliuhf.m2repositoryjoda-timejoda-time2.10.1joda-time-2.10.1.jar;C: Usersliuhf.m2repositoryorgantlrantlr-runtime3.4antlr-runtime-3.4.jar;C:Usersliuhf.m2repositoryorgantlrstringtemplate3.2.1stringtemplate -3.2.1.jar;C:Usersliuhf.m2repositoryorgapachecommonscommons-math2.2commons-math-2.2.jar;C:Usersliuhf.m2repository comnetflixarchaiusarchaius-core.7.6archaius-core-0.7.6.jar;C:Usersliuhf.m2repositorycomgoogleguavaguava16.0guava-16.0 .jar;C:Usersliuhf.m2repositoryjavaxwsrsjsr311-api1.1.1jsr311-api-1.1.1.jar;C:Usersliuhf.m2repository comnetflixservoservo-core.12.21servo-core-0.12.21.jar;C:Usersliuhf.m2repositorycomsunjerseyjersey-core1.19.1 jersey-core-1.19.1.jar;C:Usersliuhf.m2repositorycomsunjerseyjersey-client1.19. 1jersey-client-1.19.1.jar;C:Usersliuhf.m2repositorycomsunjerseycontribsjersey-apache-client41.19.1jersey-apache-client4-1.19. 1.jar;C:Usersliuhf.m2repositoryorgapachehttpcomponentshttpclient4.5.6httpclient-4.5.6.jar;C:Usersliuhf.m2repositoryorg apachehttpcomponentshttpcore4.4.10httpcore-4.4.10.jar;C:Usersliuhf.m2repositorycommons-codeccommons-codec1.11commons-codec-1.11.jar;C: Usersliuhf.m2repositorycomgoogleinjectguice4.1.0guice-4.1.0.jar;C:Usersliuhf.m2repositoryjavaxinjectjavax.inject 1javax.inject-1.jar;C:Usersliuhf.m2repositoryaopallianceaopalliance1.0aopalliance-1.0.jar;C:Usersliuhf.m2repositorycomgithub vlsicompactmapcompactmap1.2.1compactmap-1.2.1.jar;C:Usersliuhf.m2repositorycomgithubandrewomadexxdexx-collections.2dexx-collections-0.2. jar;C:Usersliuhf.m2repositorycomfasterxmljacksoncorejackson-core2.9.7jackson-core-2.9.7.jar;C:Usersliuhf.m2 repositorycomnetflixeurekaeureka-co re1.9.8eureka-core-1.9.8.jar;C:Usersliuhf.m2repositoryorgcodehauswoodstoxwoodstox-core-asl4.4.1woodstox-core-asl- 4.4.1.jar;C:Usersliuhf.m2repositoryjavaxxmlstreamstax-api1.0-2stax-api-1.0-2.jar;C:Usersliuhf. m2repositoryorgcodehauswoodstoxstax2-api3.1.4stax2-api-3.1.4.jar;C:Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud- starter-netflix-archaius2.1.0.M3spring-cloud-starter-netflix-archaius-2.1.0.M3.jar;C:Usersliuhf.m2repositoryorgspringframeworkcloudspring- cloud-netflix-archaius2.1.0.M3spring-cloud-netflix-archaius-2.1.0.M3.jar;C:Usersliuhf.m2repositorycommons-configurationcommons-configuration1.8 commons-configuration-1.8.jar;C:Usersliuhf.m2repositorycommons-langcommons-lang2.6commons-lang-2.6.jar;C:Usersliuhf.m2repository orgspringframeworkcloudspring-cloud-starter-netflix-ribbon2.1.0.M3spring-cloud-starter-netflix-ribbon-2.1.0.M3.jar;C:Usersliuhf.m2 repositorycomnetflixribbonribbon2.3.0rib bon-2.3.0.jar;C:Usersliuhf.m2repositorycomnetflixribbonribbon-transport2.3.0ribbon-transport-2.3.0.jar;C:Usersliuhf .m2repositoryioreactivexrxnetty-contexts.4.9rxnetty-contexts-0.4.9.jar;C:Usersliuhf.m2repositoryioreactivexrxnetty-servo.4. 9rxnetty-servo-0.4.9.jar;C:Usersliuhf.m2repositorycomnetflixhystrixhystrix-core1.5.12hystrix-core-1.5.12.jar;C: Usersliuhf.m2repositoryorghdrhistogramHdrHistogram2.1.9HdrHistogram-2.1.9.jar;C:Usersliuhf.m2repositoryioreactivexrxnetty.4.9 rxnetty-0.4.9.jar;C:Usersliuhf.m2repositorycomnetflixribbonribbon-core2.3.0ribbon-core-2.3.0.jar;C:Usersliuhf .m2repositorycomnetflixribbonribbon-httpclient2.3.0ribbon-httpclient-2.3.0.jar;C:Usersliuhf.m2repositorycommons-collectionscommons-collections 3.2.2commons-collections-3.2.2.jar;C:Usersliuhf.m2repositorycomnetflixnetflix-commonsnetflix-commons-util.3.0netflix-commons-util- 0.3.0.jar;C:Usersliuhf.m2repositorycomnet flixribbonribbon-loadbalancer2.3.0ribbon-loadbalancer-2.3.0.jar;C:Usersliuhf.m2repositorycomnetflixnetflix-commonsnetflix-statistics.1.1 netflix-statistics-0.1.1.jar;C:Usersliuhf.m2repositoryioreactivexrxjava1.3.8rxjava-1.3.8.jar;C:Usersliuhf.m2 repositorycomnetflixribbonribbon-eureka2.3.0ribbon-eureka-2.3.0.jar;C:Usersliuhf.m2repositoryorgslf4jslf4j-api1.7.25 slf4j-api-1.7.25.jar;C:Usersliuhf.m2repositorycomthoughtworksxstreamxstream1.4.10xstream-1.4.10.jar;C:Usersliuhf. m2repositoryxmlpullxmlpull1.1.3.1xmlpull-1.1.3.1.jar;C:Usersliuhf.m2repositoryxpp3xpp3_min1.1.4cxpp3_min-1.1.4c.jar;C: Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud-openfeign-core2.1.0.M2spring-cloud-openfeign-core-2.1.0.M2.jar;C:Users liuhf.m2repositoryorgspringframeworkbootspring-boot-autoconfigure2.1.1.RELEASEspring-boot-autoconfigure-2.1.1.RELEASE.jar;C:Usersliuhf.m2 repositoryorgspringframeworkbootspring-boot2. 1.1.RELEASEspring-boot-2.1.1.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud-netflix-ribbon2.1.0.M3spring- cloud-netflix-ribbon-2.1.0.M3.jar;C:Usersliuhf.m2repositoryorgspringframeworkbootspring-boot-starter-aop2.1.1.RELEASEspring-boot- starter-aop-2.1.1.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring-aop5.1.3.RELEASEspring-aop-5.1.3.RELEASE.jar; C:Usersliuhf.m2repositoryorgaspectjaspectjweaver1.9.2aspectjweaver-1.9.2.jar;C:Usersliuhf.m2repositoryiogithubopenfeignform feign-form-spring3.3.0feign-form-spring-3.3.0.jar;C:Usersliuhf.m2repositoryiogithubopenfeignformfeign-form3.3.0 feign-form-3.3.0.jar;C:Usersliuhf.m2repositorycomgooglecodefindbugsannotations3.0.1annotations-3.0.1.jar;C:Usersliuhf .m2repositorynetjcipjcip-annotations1.0jcip-annotations-1.0.jar;C:Usersliuhf.m2repositorycomgooglecodefindbugsjsr3053.0.1 jsr305-3.0.1.jar;C:Usersliuhf.m2repositorycomm ons-fileuploadcommons-fileupload1.3.3commons-fileupload-1.3.3.jar;C:Usersliuhf.m2repositorycommons-iocommons-io2.2commons-io-2.2. jar;C:Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud-config-client2.1.0.M3spring-cloud-config-client-2.1.0.M3.jar; C:Usersliuhf.m2repositoryorgspringframeworkcloudspring-cloud-commons2.1.0.M2spring-cloud-commons-2.1.0.M2.jar;C:Usersliuhf .m2repositoryorgspringframeworksecurityspring-security-crypto5.1.2.RELEASEspring-security-crypto-5.1.2.RELEASE.jar;C:Usersliuhf.m2repository orgspringframeworkcloudspring-cloud-context2.1.0.M2spring-cloud-context-2.1.0.M2.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring- web5.1.3.RELEASEspring-web-5.1.3.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring-beans5.1.3.RELEASEspring-beans- 5.1.3.RELEASE.jar;C:Usersliuhf.m2repositorycomfasterxmljacksoncorejackson-annotations2.9.0jackson-annotations-2.9.0.jar;C:Users liuhf.m2rep ositorycomfasterxmljacksoncorejackson-databind2.9.7jackson-databind-2.9.7.jar;C:Usersliuhf.m2repositorycomimoocproduct-client.0. 1-SNAPSHOTproduct-client-0.0.1-SNAPSHOT.jar;C:Usersliuhf.m2repositorycomimoocproduct-common.0.1-SNAPSHOTproduct-common-0.0.1- SNAPSHOT.jar;C:Usersliuhf.m2repositoryorgspringframeworkbootspring-boot-starter2.1.1.RELEASEspring-boot-starter-2.1.1.RELEASE.jar;C: Usersliuhf.m2repositoryorgspringframeworkbootspring-boot-starter-logging2.1.1.RELEASEspring-boot-starter-logging-2.1.1.RELEASE.jar;C:Users liuhf.m2repositorychqoslogbacklogback-classic1.2.3logback-classic-1.2.3.jar;C:Usersliuhf.m2repositorychqoslogback logback-core1.2.3logback-core-1.2.3.jar;C:Usersliuhf.m2repositoryorgapachelogginglog4jlog4j-to-slf4j2.11.1log4j- to-slf4j-2.11.1.jar;C:Usersliuhf.m2repositoryorgapachelogginglog4jlog4j-api2.11.1log4j-api-2.11.1.jar;C: Usersliuhf.m2repositoryorgslf4jjul-to-slf4j1.7.25j ul-to-slf4j-1.7.25.jar;C:Usersliuhf.m2repositoryjavaxannotationjavax.annotation-api1.3.2javax.annotation-api-1.3.2.jar; C:Usersliuhf.m2repositoryorgyamlsnakeyaml1.23snakeyaml-1.23.jar;C:Usersliuhf.m2repositorynetbytebuddybyte-buddy1.9.5 byte-buddy-1.9.5.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring-core5.1.3.RELEASEspring-core-5.1.3.RELEASE.jar;C: Usersliuhf.m2repositoryorgspringframeworkspring-jcl5.1.3.RELEASEspring-jcl-5.1.3.RELEASE.jar;C:Usersliuhf.m2repositoryorg springframeworkbootspring-boot-starter-web2.1.1.RELEASEspring-boot-starter-web-2.1.1.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframework bootspring-boot-starter-json2.1.1.RELEASEspring-boot-starter-json-2.1.1.RELEASE.jar;C:Usersliuhf.m2repositorycomfasterxmljackson datatypejackson-datatype-jdk82.9.7jackson-datatype-jdk8-2.9.7.jar;C:Usersliuhf.m2repositorycomfasterxmljacksondatatypejackson-datatype-jsr310 2.9.7jackson-datatype-jsr310 -2.9.7.jar;C:Usersliuhf.m2repositorycomfasterxmljacksonmodulejackson-module-parameter-names2.9.7jackson-module-parameter-names-2.9.7 .jar;C:Usersliuhf.m2repositoryorgspringframeworkbootspring-boot-starter-tomcat2.1.1.RELEASEspring-boot-starter-tomcat-2.1.1.RELEASE.jar ;C:Usersliuhf.m2repositoryorgapachetomcatembedtomcat-embed-core9.0.13tomcat-embed-core-9.0.13.jar;C:Usersliuhf .m2repositoryorgapachetomcatembedtomcat-embed-el9.0.13tomcat-embed-el-9.0.13.jar;C:Usersliuhf.m2repositoryorgapache tomcatembedtomcat-embed-websocket9.0.13tomcat-embed-websocket-9.0.13.jar;C:Usersliuhf.m2repositoryorghibernatevalidatorhibernate-validator6.0 .13.Finalhibernate-validator-6.0.13.Final.jar;C:Usersliuhf.m2repositoryjavaxvalidationvalidation-api2.0.1.Finalvalidation-api-2.0.1 .Final.jar;C:Usersliuhf.m2repositoryorgjbossloggingjboss-logging3.3.2.Finaljboss-logging-3.3.2.Final.jar;C:Users liuhf.m2repositorycomfasterxmlclas smate1.4.0classmate-1.4.0.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring-webmvc5.1.3.RELEASEspring-webmvc-5.1.3.RELEASE. jar;C:Usersliuhf.m2repositoryorgspringframeworkspring-context5.1.3.RELEASEspring-context-5.1.3.RELEASE.jar;C:Usersliuhf.m2 repositoryorgspringframeworkspring-expression5.1.3.RELEASEspring-expression-5.1.3.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframeworkbootspring-boot- starter-data-jpa2.1.1.RELEASEspring-boot-starter-data-jpa-2.1.1.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframeworkbootspring- boot-starter-jdbc2.1.1.RELEASEspring-boot-starter-jdbc-2.1.1.RELEASE.jar;C:Usersliuhf.m2repositorycomzaxxerHikariCP3.2.0 HikariCP-3.2.0.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring-jdbc5.1.3.RELEASEspring-jdbc-5.1.3.RELEASE.jar;C:Users liuhf.m2repositoryjavaxtransactionjavax.transaction-api1.3javax.transaction-api-1.3.jar;C:Usersliuhf.m2repositoryjavaxxmlbindjaxb- api2.3.1j axb-api-2.3.1.jar;C:Usersliuhf.m2repositoryjavaxactivationjavax.activation-api1.2.0javax.activation-api-1.2.0.jar;C: Usersliuhf.m2repositoryorghibernatehibernate-core5.3.7.Finalhibernate-core-5.3.7.Final.jar;C:Usersliuhf.m2repositoryjavax persistencejavax.persistence-api2.2javax.persistence-api-2.2.jar;C:Usersliuhf.m2repositoryorgjavassistjavassist3.23.1-GAjavassist-3.23.1- GA.jar;C:Usersliuhf.m2repositoryantlrantlr2.7.7antlr-2.7.7.jar;C:Usersliuhf.m2repositoryorgjbossjandex 2.0.5.Finaljandex-2.0.5.Final.jar;C:Usersliuhf.m2repositoryorgdom4jdo​​m4j2.1.1dom4j-2.1.1.jar;C:Users liuhf.m2repositoryorghibernatecommonhibernate-commons-annotations5.0.4.Finalhibernate-commons-annotations-5.0.4.Final.jar;C:Usersliuhf.m2 repositoryorgspringframeworkdataspring-data-jpa2.1.3.RELEASEspring-data-jpa-2.1.3.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframework dataspring-data-commons2.1.3.RELEASEspring-data-commons-2. 1.3.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring-orm5.1.3.RELEASEspring-orm-5.1.3.RELEASE.jar;C:Usersliuhf .m2repositoryorgspringframeworkspring-tx5.1.3.RELEASEspring-tx-5.1.3.RELEASE.jar;C:Usersliuhf.m2repositoryorgspringframeworkspring- aspects5.1.3.RELEASEspring-aspects-5.1.3.RELEASE.jar;C:Usersliuhf.m2repositorymysqlmysql-connector-java5.1.43mysql-connector-java- 5.1.43.jar;C:Usersliuhf.m2repositoryorgprojectlomboklombok1.18.4lombok-1.18.4.jar;C:Usersliuhf.m2repositorycom googlecodegsongson2.8.5gson-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 [[email protected]] 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 [[email protected]] 	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 [[email protected]] 	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 [[email protected]] 	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  

  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文件中加入如下配置的

                      org.springframework.boot          spring-boot-maven-plugin                            org.springframework.boot          spring-boot-maven-plugin          1.5.13.RELEASE                                                                repackage                                                  

但是通過上面的配置仍然沒有解決Product-client打包的問題(看來我對maven的了解還是不夠呀),好吧繼續找解決辦法,終於在這篇IDEA maven 多模塊打包問題總結解開了我的疑惑

如果在用maven構建多模塊項目時,不要將此插件放到parent pom中,否則如果有sub module不是spring boot應用,在打包時就會出錯。只將該插件添加到是spring boot項目的子模塊。上面例子中common模塊不是spring boot應用就不需要此插件,故不要將此插件放到shopping pom中

加上spring-boot-maven-plugin

                      org.springframework.boot          spring-boot-maven-plugin        

打包後的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,如下圖

                           org.springframework.cloud             spring-cloud-openfeign             2.0.0.RC1             pom             import                

     org.springframework.cloud     spring-cloud-starter-openfeign  

其實到這裡我還在糾結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-*;第二嘗試太新的版本,不按照課程中的版本當然要入坑了;不過對於我來說按照課程學習內容雖好,通過解決版本使用中遇到的問題更是一種挑戰和進步

點擊查看更多內容

JAVA Spring Cloud

發佈留言

你的電子郵件位址並不會被公開。 必要欄位標記為 *