【发布时间】:2023-01-13 13:24:13
【问题描述】:
当我尝试使用如下非反应性方法时,我能够毫无问题地建立连接。
spring.datasource.url=jdbc:sqlserver://AAAAA1011.na.app.corp\\bbbb;databaseName=mydb;integratedSecurity=true;authenticationScheme=JavaKerberos
但是当我尝试使用 Reactive R2dbc 和 MsSql 服务器方法时,如下所示,然后我面临异常,下面是代码:
@Bean
@Override
public ConnectionFactory connectionFactory() {
ConnectionFactory connectionFactory = ConnectionFactories.get(ConnectionFactoryOptions.builder()
.option(ConnectionFactoryOptions.DRIVER, "mssql")
.option(ConnectionFactoryOptions.HOST, "AAAAA1011.na.app.corp/bbbb")
.option(ConnectionFactoryOptions.DATABASE, "mydb")
.option(ConnectionFactoryOptions.USER, "NA\\user")
.option(Option.valueOf("integratedSecurity"), true)
.option(Option.valueOf("authenticationScheme"), "JavaKerberos")
.build());
return connectionFactory;
}`
异常堆栈跟踪:
org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.r2dbc.spi.ConnectionFactory]: Factory method 'connectionFactory' threw exception; nested exception is java.lang.IllegalStateException: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={database=mydb, host=AAAAA1011.na.app.corp/bbbb, driver=mssql, authenticationScheme=JavaKerberos, integratedSecurity=true, user=NA\user}}'. Available drivers: [ pool, sqlserver ]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.23.jar:5.3.23]
我找到了这个链接:https://github.com/r2dbc/r2dbc-mssql/issues/101 ,提到 r2dbc 似乎不支持 Kerberos,但那是在 2019 年写的,现在已经 3 年了,不确定上面是否有效。
如果有人知道上述问题,你能帮帮我吗..
【问题讨论】:
-
好吧,票证仍然开放,所以没有 kerberos 支持。只有用户/密码。
标签: spring spring-boot reactive-programming spring-webflux spring-data-r2dbc