Reputation: 71
I just trying to do some tests with Kotlin, I'm from .NET this is new territory. I've DBeaver installed on my machine and I can connect to the remote MySQL without issues.
I generate the project from start.spring.io with the following options: Gradle - Groovy, Sprint Boot: 3.0.0, Packaging: Jar and Java: 17
With dependencies: Spring Web, Spring Data R2DBC and MySQL Driver
My application.properties:
spring.r2dbc.url=r2dbc:pool:mysql://192.168.1.2:3306/DBEmployee
spring.r2dbc.username=root
spring.r2dbc.password=password
logging.level.root=DEBUG
When I try to run the app I have this error: 2022-12-18T10:01:16.162Z ERROR 8340 --- [ main] o.s.boot.SpringApplication : Application run failed ... Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.r2dbc.spi.ConnectionFactory]: Factory method 'connectionFactory' threw exception with message: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={database=DBEmployee, host=192.168.1.2, driver=mysql, password=REDACTED, protocol=, port=3306, user=root}}'. Available drivers: [ pool ] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171) ~[spring-beans-6.0.2.jar:6.0.2] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:648) ~[spring-beans-6.0.2.jar:6.0.2] ... 19 common frames omitted Caused by: java.lang.IllegalStateException: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={database=DBEmployee, host=192.168.1.2, driver=mysql, password=REDACTED, protocol=, port=3306, user=root}}'. Available drivers: [ pool ] at io.r2dbc.spi.ConnectionFactories.get(ConnectionFactories.java:143) ~[r2dbc-spi-1.0.0.RELEASE.jar:na]
This is supose to be a simple thing... Can someone help me please?
Thank you.
Upvotes: 0
Views: 354
Reputation: 78
I have a similiar error, but the root cause is the scope of dependency, change to: runtimeOnly
works.
Upvotes: 0
Reputation: 55
as Koziołek mentioned you should add the following to your gradle build file as a dependency:
runtimeOnly 'dev.miku:r2dbc-mysql:0.8.2.RELEASE'
Upvotes: 1