java - Spring Boot 启动

标签 java spring spring-boot

我正在尝试学习 spring,教程要求我运行 mvn spring-boot:run。 但是,我有以下错误消息(我附加了一个片段)。请指教。我所做的就是从 spring.io 的网站创建一个项目,然后运行 ​​mvn spring-boot:run

2019-11-30 14:45:03.338  INFO 14260 --- [  restartedMain] com.portal.VPortal.VPortalApplication    : Starting VPortalApplication on Max with PID 14260 (C:\Users\Max\Documents\VPortal\target\classes started
by Max in C:\Users\Max\Documents\VPortal)
2019-11-30 14:45:03.338  INFO 14260 --- [  restartedMain] com.portal.VPortal.VPortalApplication    : No active profile set, falling back to default profiles: default
2019-11-30 14:45:03.368  INFO 14260 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-11-30 14:45:03.368  INFO 14260 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-11-30 14:45:04.029  INFO 14260 --- [  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.spri
ngframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-11-30 14:45:04.329  INFO 14260 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-11-30 14:45:04.335  INFO 14260 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-11-30 14:45:04.335  INFO 14260 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-30 14:45:04.386  INFO 14260 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-11-30 14:45:04.386  INFO 14260 --- [  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1018 ms
2019-11-30 14:45:04.477 ERROR 14260 --- [  restartedMain] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message:
 Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServle
tEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframewo
rk.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error c
reating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through metho
d 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/sprin
gframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed
to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.Unsatisfie
dDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor par
ameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/Da
taSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariData
Source]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: org.postgres.Driver
2019-11-30 14:45:04.493  INFO 14260 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-11-30 14:45:04.500  WARN 14260 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.conte
xt.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2019-11-30 14:45:04.510  INFO 14260 --- [  restartedMain] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-11-30 14:45:04.520 ERROR 14260 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

最佳答案

我发现了错误。在我的 application.yml 文件中,我将 org.postgres.Driver 更改为 org.postgresql.Driver

关于java - Spring Boot 启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59116900/

相关文章:

java - 引用资源文件夹而不是jar中的内容

java - TestNG 软断言输出不符合预期

java - session.createQuery() 在 spring 中不返回列表

spring-boot - 使用 wicket 和 spring-boot 的浏览器拒绝样式表

java - 在gradle中导入Apache速度会降级HttpServletResponse

java - 无法恢复的 key 异常 : Cannot recover key

spring - 由 : java. lang.NoClassDefFoundError 引起:org/springframework/boot/bind/RelaxedPropertyResolver - 微服务

java - 如何使用默认 servlet 处理程序

spring - 白标签错误页面只需输入 URL 即可?

java - com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException 不允许公钥检索