java - 将 ''下的属性绑定(bind)到com.zaxxer.hikari.HikariDataSource :失败

标签 java spring-boot spring-mvc

我正在尝试使用 Spring Boot(STS) 创建一个 Web 应用程序,但我得到了
通过服务器运行时出现以下错误(JBoss)

12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93)   .   ____          
  _            __ _ _

   12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93)  /\\ / 
     ___'_ __ 
     _ _(_)_ __  __ _ \ \ \ \

  12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93) ( ( )\___ | 
 '_ 
   | '_| | '_ \/ _` | \ \ \ \

  12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93)  \\/  ___)| 
   |_)| | | | | || (_| |  ) ) ) )

  12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93)   '  |____| 
  .__|_| |_|_| |_\__, | / / / /

  12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93)  
   =========|_|==============|___/=/_/_/_/

  12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93)  :: Spring Boot 
  ::        (v2.1.3.RELEASE)

  12:01:24,091 INFO  [stdout] (ServerService Thread Pool -- 93) 

  12:01:24,184 INFO  [com.example.demoSpringWeb.ServletInitializer] 
  (ServerService Thread Pool -- 93) Starting ServletInitializer on IIPLSYS0064 
  with PID 2444 (D:\MizoAttendanceTools\Server\jboss-eap- 
 7.1.0\standalone\deployments\demoSpringWeb-0.0.1-SNAPSHOT.war\WEB-INF\classes 
  started by i00629 in D:\MizoAttendanceTools\Server\jboss-eap-7.1.0\bin)
  12:01:24,184 INFO  [com.example.demoSpringWeb.ServletInitializer] 
(ServerService Thread Pool -- 93) No active profile set, falling back to 
  default profiles: default
  12:01:24,264 INFO  
 [org.springframework.boot.devtools.env.DevToolsPropertyDefaultsPostProcessor] 
(ServerService Thread Pool -- 93) For additional web related logging consider 
setting the 'logging.level.web' property to 'DEBUG'
 12:01:25,442 INFO  
[org.springframework.data.repository.config.RepositoryConfigurationDelegate] 
(ServerService Thread Pool -- 93) Bootstrapping Spring Data repositories in 
DEFAULT mode.
  12:01:25,472 INFO  
[org.springframework.data.repository.config.RepositoryConfigurationDelegate] 
(ServerService Thread Pool -- 93) Finished Spring Data repository scanning in 
16ms. Found 0 repository interfaces.
12:01:26,191 INFO  





[org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker] (ServerService Thread Pool -- 93) Bean 



'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type 


[org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$be5f65f5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
12:01:26,286 INFO  [io.undertow.servlet] (ServerService Thread Pool -- 93) Initializing Spring embedded WebApplicationContext
12:01:26,286 INFO  [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 93) Root WebApplicationContext: initialization completed in 2021 ms
12:01:26,722 ERROR [com.zaxxer.hikari.HikariConfig] (ServerService Thread Pool -- 93) Failed to load driver class org.postgresql.Driver from HikariConfig class classloader ModuleClassLoader for Module "deployment.demoSpringWeb-0.0.1-SNAPSHOT.war" from Service Module Loader
12:01:26,738 WARN  [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] (ServerService Thread Pool -- 93) Exception encountered during context initialization - cancelling refresh attempt: 
org.springframework.context.ApplicationContextException: Unable to start web 
server; nested exception is 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'servletEndpointRegistrar' defined in class path resource 

[org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthIndicatorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthIndicatorRegistry]: Factory method 'healthIndicatorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 


'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 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/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource
12:01:26,739 INFO  [org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener] (ServerService Thread Pool -- 93) 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
12:01:26,755 ERROR [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] 
(ServerService Thread Pool -- 93) 

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:

Property: driverclassname
Value: org.postgresql.Driver
Origin: "driverClassName" from property source "source"
Reason: Failed to load driver class org.postgresql.Driver in either of 
HikariConfig class loader or Thread context classloader

Action:

 Update your application's configuration

最佳答案

您的类路径上没有驱动程序。

在 pom.xml 下添加 postgresql 依赖项,如下所示。

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>

关于java - 将 ''下的属性绑定(bind)到com.zaxxer.hikari.HikariDataSource :失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54760413/

相关文章:

java - Hibernate 自定义连接

java - 如何向子进程发送命令

java - 如何在Spring/Spring Boot pom.xml中指定Java版本?

java - 考虑定义一个类型为 'org.flywaydb.core.Flyway' 的 bean

java - 从不同的应用程序模块导入依赖项时,Spring Boot REST API 将不会启动

java - 在 Eclipse 中转换为 Maven 后 Spring MVC 项目不再工作

java - 用java画一个简​​单的文本框?

java - 将 TypedQuery 转换为具有 max、min、group by 和 order by 的 criteriaQuery (JPA 2.0)

spring-mvc - spring 3 上传很多文件

java - 使用ajax发送大量json数据到 Controller