获取 R2dbcNonTransientResourceException:不支持的 Oracle JDBC 驱动程序版本:19
Getting R2dbcNonTransientResourceException: Unsupported Oracle JDBC Driver version: 19
我正在尝试为我的 Spring 引导应用程序设置 R2DBC,该应用程序以 Oracle 19c 作为数据库并配置了 OJDBC8 和 Java 11。R2DBC 版本为 0.1.0。由于应用程序无法启动,我收到以下错误。 rRDBC 是否适用于 Oracle 19c 还是必须是 Oracle 21x?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myr2dbccon': Unexpected exception during bean creation; nested exception is io.r2dbc.spi.R2dbcNonTransientResourceException: Unsupported Oracle JDBC Driver version: 19
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=11=](AbstractBeanFactory.java:335) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.9.jar!/:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.9.jar!/:5.3.9]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.5.2.jar!/:2.5.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.2.jar!/:2.5.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.2.jar!/:2.5.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.2.jar!/:2.5.2]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
Caused by: io.r2dbc.spi.R2dbcNonTransientResourceException: Unsupported Oracle JDBC Driver version: 19
at oracle.r2dbc.impl.ReactiveJdbcAdapter.getOracleAdapter(ReactiveJdbcAdapter.java:92) ~[oracle-r2dbc-0.1.0.jar!/:0.1.0]
at oracle.r2dbc.impl.OracleConnectionFactoryImpl.<init>(OracleConnectionFactoryImpl.java:120) ~[oracle-r2dbc-0.1.0.jar!/:0.1.0]
at oracle.r2dbc.impl.OracleConnectionFactoryProviderImpl.create(OracleConnectionFactoryProviderImpl.java:93) ~[oracle-r2dbc-0.1.0.jar!/:0.1.0]
at io.r2dbc.spi.ConnectionFactories.find(ConnectionFactories.java:112) ~[r2dbc-spi-0.8.5.RELEASE.jar!/:?]
at io.r2dbc.spi.ConnectionFactories.get(ConnectionFactories.java:142) ~[r2dbc-spi-0.8.5.RELEASE.jar!/:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1231) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.9.jar!/:5.3.9]
错误与 Oracle JDBC 驱动程序版本有关,与您的 Oracle 版本无关。 Oracle R2DBC 驱动程序依赖于 Oracle JDBC 驱动程序中的特定功能,这些功能仅在较新的驱动程序版本中可用,然后仅在 Java 11(或更高)版本的驱动程序(即ojdbc11,不是 ojdbc8)。
根据 https://github.com/oracle/oracle-r2dbc,最新的 Oracle R2DBC 驱动程序需要 Oracle JDBC 21.3 驱动程序。
它还说:
The Oracle R2DBC Driver has been verified with Oracle Database
versions 18, 19, and 21.
需要说明的是,Oracle JDBC 21.3 驱动程序可以很好地与 Oracle 19c 配合使用,R2DBC 也是如此。
简而言之,您需要将 Oracle JDBC 驱动程序更新为:
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>21.3.0.0</version>
</dependency>
我正在尝试为我的 Spring 引导应用程序设置 R2DBC,该应用程序以 Oracle 19c 作为数据库并配置了 OJDBC8 和 Java 11。R2DBC 版本为 0.1.0。由于应用程序无法启动,我收到以下错误。 rRDBC 是否适用于 Oracle 19c 还是必须是 Oracle 21x?
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myr2dbccon': Unexpected exception during bean creation; nested exception is io.r2dbc.spi.R2dbcNonTransientResourceException: Unsupported Oracle JDBC Driver version: 19
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean[=11=](AbstractBeanFactory.java:335) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.9.jar!/:5.3.9]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.9.jar!/:5.3.9]
at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.5.2.jar!/:2.5.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.2.jar!/:2.5.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.2.jar!/:2.5.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.2.jar!/:2.5.2]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
Caused by: io.r2dbc.spi.R2dbcNonTransientResourceException: Unsupported Oracle JDBC Driver version: 19
at oracle.r2dbc.impl.ReactiveJdbcAdapter.getOracleAdapter(ReactiveJdbcAdapter.java:92) ~[oracle-r2dbc-0.1.0.jar!/:0.1.0]
at oracle.r2dbc.impl.OracleConnectionFactoryImpl.<init>(OracleConnectionFactoryImpl.java:120) ~[oracle-r2dbc-0.1.0.jar!/:0.1.0]
at oracle.r2dbc.impl.OracleConnectionFactoryProviderImpl.create(OracleConnectionFactoryProviderImpl.java:93) ~[oracle-r2dbc-0.1.0.jar!/:0.1.0]
at io.r2dbc.spi.ConnectionFactories.find(ConnectionFactories.java:112) ~[r2dbc-spi-0.8.5.RELEASE.jar!/:?]
at io.r2dbc.spi.ConnectionFactories.get(ConnectionFactories.java:142) ~[r2dbc-spi-0.8.5.RELEASE.jar!/:?]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.obtainFromSupplier(AbstractAutowireCapableBeanFactory.java:1231) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564) ~[spring-beans-5.3.9.jar!/:5.3.9]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.9.jar!/:5.3.9]
错误与 Oracle JDBC 驱动程序版本有关,与您的 Oracle 版本无关。 Oracle R2DBC 驱动程序依赖于 Oracle JDBC 驱动程序中的特定功能,这些功能仅在较新的驱动程序版本中可用,然后仅在 Java 11(或更高)版本的驱动程序(即ojdbc11,不是 ojdbc8)。
根据 https://github.com/oracle/oracle-r2dbc,最新的 Oracle R2DBC 驱动程序需要 Oracle JDBC 21.3 驱动程序。
它还说:
The Oracle R2DBC Driver has been verified with Oracle Database versions 18, 19, and 21.
需要说明的是,Oracle JDBC 21.3 驱动程序可以很好地与 Oracle 19c 配合使用,R2DBC 也是如此。
简而言之,您需要将 Oracle JDBC 驱动程序更新为:
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<version>21.3.0.0</version>
</dependency>