无法将“”下的属性绑定到com.zaxxer.hikari.HikariDataSource:

时间:2019-02-19 06:58:47

标签: 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

1 个答案:

答案 0 :(得分:2)

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

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

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