Драйвер oracle.jdbc.OracleDriver утверждает, что не принимает jdbcUrl - PullRequest
0 голосов
/ 09 мая 2019

Я пытаюсь подключиться к БД Oracle.

Когда я пытаюсь подключиться через простое соединение jdbc, это работает.

Class.forName("oracle.jdbc.driver.OracleDriver");
connection = DriverManager.getConnection("jdbc:oracle:thin:@chbsux0097.eu.novartis.net:1530:AD14", "xxxx", "xxxxx")

Однако, он не работает с Spring-boot с ошибкой ниже

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-09 12:48:51.189 ERROR 16236 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.RuntimeException: Driver oracle.jdbc.OracleDriver claims to not accept jdbcUrl, jdbc:oracle:thin@chbsux0097.eu.novartis.net:1530:AD14
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:509) ~[spring-beans-5.1.6.RELEASE.jar:5.1.6.RELEASE]

application.properties

spring.datasource.username=xx
spring.datasource.password=xxxxx
spring.datasource.url=jdbc:oracle:thin@chbsux0097.eu.novartis.net:1530:AD14
spring.datasource.driver.class=oracle.jdbc.driver.OracleDriver

1 Ответ

4 голосов
/ 09 мая 2019

Вам не хватает двоеточия в URL после thin в вашей конфигурации. Это должно быть:

spring.datasource.url=jdbc:oracle:thin:@chbsux0097.eu.novartis.net:1530:AD14

Обратите внимание, что в вашем рабочем упрощенном примере присутствует двоеточие.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...