2

Hello when i trying start Spring Boot app a get a stacktrace

2016-11-18 04:41:35.492  WARN 4256 --- [  restartedMain] o.a.tomcat.jdbc.pool.PooledConnection    : Not loading a JDBC driver as driverClassName property is null.
2016-11-18 04:41:35.499 ERROR 4256 --- [  restartedMain] o.a.tomcat.jdbc.pool.ConnectionPool      : Unable to create initial connections of pool.

java.sql.SQLException: The url cannot be null
    at java.sql.DriverManager.getConnection(DriverManager.java:649) ~[na:1.8.0_111]
    at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[na:1.8.0_111]
    at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:308) ~[tomcat-jdbc-8.5.4.jar:na]
    at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:203) ~[tomcat-jdbc-8.5.4.jar:na]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:716) [tomcat-jdbc-8.5.4.jar:na]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:648) [tomcat-jdbc-8.5.4.jar:na]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:468) [tomcat-jdbc-8.5.4.jar:na]
    at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:143) [tomcat-jdbc-8.5.4.jar:na]
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118) [tomcat-jdbc-8.5.4.jar:na]
    at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107) [tomcat-jdbc-8.5.4.jar:na]

I added url in application.properties

spring.datasource.url=jdbc:oracle:thin:@localhost:1521:spring

I think it's may be problem with drivers to oracle, maven can't find this dependency

<dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc14</artifactId>
    <version>10.2.0.4.0</version>
</dependency>

So I just add external jar to my project, but i still have problem with wrong url

1
  • one cannot really reproduce the issue with the information you've given. Try a minimal test example.
    – eis
    Commented Nov 17, 2016 at 13:35

2 Answers 2

3
Not loading a JDBC driver as driverClassName property is null.

You might also want to resolve that by adding a driver class name to your properties file:

spring.datasource.driver-class-name=oracle.jdbc.OracleDriver

Are you configuring a DataSource bean somewhere within your application? Assuming you haven't disabled auto configuration you should be able to get a valid datasource configuration.

3
  • Thank you i added but i still this same problem. I didin't have DataSource bean i just add POJO class with JPA annotation i set hibernate.ddl-auto=create-drop and i hopes it's enaugh to create tables in database Commented Nov 17, 2016 at 13:03
  • Hmm. When you run the Spring Boot application is it definitely picking up the properties file? Are there any other properties configured than you know are working?
    – mixiul__
    Commented Nov 17, 2016 at 13:13
  • No I'm not sure, i have just database configuration, but application.properties is in default localization Commented Nov 17, 2016 at 13:33
0

The Oracle JDBC driver has only been a part of maven from V 11.2.0.4.. had some issues with it in the past.

Follow the link "https://blogs.oracle.com/dev2dev/entry/oracle_maven_repository_instructions_for" to download and add the driver you want to the local maven repo.

Also check Find Oracle JDBC driver in Maven repository

Please make sure you have specified and included the relevant database vendor dependency in your pom. If not, you might also experience the same error message.

Not the answer you're looking for? Browse other questions tagged or ask your own question.