testcontainers-java icon indicating copy to clipboard operation
testcontainers-java copied to clipboard

[Bug]: Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={driver=tc

Open sneakythr0ws opened this issue 2 years ago • 1 comments

Module

PostgreSQL

Testcontainers version

1.17.3

Using the latest Testcontainers version?

Yes

Host OS

Linux

Host Arch

x86

Docker version

20.10.17

What happened?

Unable to create a ConnectionFactory for 'ConnectionFactoryOptions{options={driver=tc, TC_IMAGE_TAG=9.6.8, protocol=postgresql, database=databasename}}'. Available drivers: [ postgresql, pool ]

dependencies: spring boot 2.7.3

implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
runtimeOnly 'org.postgresql:r2dbc-postgresql:0.9.2.RELEASE'
testImplementation "org.testcontainers:postgresql:1.17.3"
testImplementation "org.testcontainers:junit-jupiter:1.17.3"

config:

spring:
  r2dbc:
    url: r2dbc:tc:postgresql:///databasename?TC_IMAGE_TAG=9.6.8

Relevant log output

No response

Additional Information

No response

sneakythr0ws avatar Sep 20 '22 13:09 sneakythr0ws

Hi @sneakythr0ws, Looks like you might be missing this dependency in your gradle file which could be causing this issue: testImplementation "org.testcontainers:r2dbc:1.17.3"

Can you add this and give it a try?

If you want to use testcontainers in your main spring boot application rather than test class then you may need to change the scope of this dependency to runtime

hariohmprasath avatar Sep 21 '22 06:09 hariohmprasath