itmuch / spring-cloud-docker-microservice-book-code

《Spring Cloud与Docker微服务架构实战》配套代码。讨论QQ群:731548893
http://www.itmuch.com
Apache License 2.0
1.17k stars 861 forks source link

microservice-simple-provider-user 启动报错 #8

Closed mrsWangxing closed 6 years ago

mrsWangxing commented 6 years ago

Eclipse 4.6.3 JDK1.8 我直接从github中导入到本地的Eclipse中,直接启动ProviderUserApplication的main方法,报错如下: 2018-09-17 11:25:06.708 WARN 9412 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.sql.DataSource' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 2018-09-17 11:25:06.716 INFO 9412 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2018-09-17 11:25:06.752 INFO 9412 --- [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2018-09-17 11:25:06.993 ERROR 9412 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

**Parameter 0 of constructor in org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.

eacdy commented 6 years ago

目测有依赖没有下载成功;执行mvn clean install 确认能构建成功后,再启动。

mrsWangxing commented 6 years ago

确实是依赖没引进来,把本地仓库的地址换了,完全重新从中央仓库下载一次就好了。 PS:后续的其他项目也遇到类似问题,不知道maven最近咋搞的,下载的包都有问题,必须删了重新下载。本地学习 没装私服 可能是网络问题。 最后谢谢@eacdy

eacdy commented 6 years ago

弄个阿里云maven镜像吧。。直连中央仓库会比较慢……