Java – hikaripool-1 – driverclassname requires JDBC URL
•
Java
I'll go back and program my old program https://github.com/JonkiPro/REST-Web-Services. I have updated spring boot from version 15.6 to version 2.0 0. I encountered many problems during compilation, but I can't handle it Well, during compilation, he threw me into the console
2018-03-18 21:54:53.339 ERROR 3220 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : HikariPool-1 - jdbcUrl is required with driverClassName. 2018-03-18 21:54:55.392 INFO 3220 --- [ost-startStop-1] j.LocalContainerEntityManagerfactorybean : Building JPA container EntityManagerFactory for persistence unit 'unit' 2018-03-18 21:54:56.698 INFO 3220 --- [ost-startStop-1] j.LocalContainerEntityManagerfactorybean : Initialized JPA EntityManagerFactory for persistence unit 'unit' 2018-03-18 21:54:56.778 ERROR 3220 --- [ost-startStop-1] com.zaxxer.hikari.HikariConfig : HikariPool-1 - jdbcUrl is required with driverClassName. 2018-03-18 21:54:56.782 ERROR 3220 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webSecurityConfig': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService' defined in file [C:\Users\Jonatan\Documents\GitHub\REST-Web-Services\web\out\production\classes\com\web\web\security\service\impl\UserDetailsServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Cannot create inner bean '(inner bean)#65d6e77b' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#65d6e77b': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Post-processing of factorybean's singleton object Failed; nested exception is java.lang.IllegalArgumentException: jdbcUrl is required with driverClassName. 2018-03-18 21:54:56.821 WARN 3220 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
spring: datasource: driver-class-name: org.postgresql.Driver url: jdbc:postgresql:database username: root password: root schema: classpath:/db/init/schema.sql
Solution
I encountered the same problem in another context
@Bean @Primary @ConfigurationProperties("app.datasource") public DataSourceProperties dataSourceProperties() { return new DataSourceProperties(); } @Bean @ConfigurationProperties("app.datasource") public DataSource dataSource(DataSourceProperties properties) { return properties.initializeDataSourceBuilder(). .build(); }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码