5

I want to use testcontainers (https://www.testcontainers.org/usage.html)

So I imported the corresponding Maven dependencies:

<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>testcontainers</artifactId>
    <version>1.10.1</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>oracle-xe</artifactId>
    <version>1.10.1</version>
    <scope>test</scope>
</dependency>

Then I right clicked the docker icon on taskbar -> Settings -> General and checked the item:

Expose daemon on tcp://localhost:2375 without TLS

Set the environment variables as described on testcontainers site:

DOCKER_CERT_PATH=C:\Users\username\.docker
DOCKER_HOST=https://localhost:2375
DOCKER_TLS_VERIFY=1

And created a JUnit-test with the code:

@Test
public void test() {
   OracleContainer oracleXE = new OracleContainer();
...

However I got the error:

Error:(82, 27) java: cannot access org.testcontainers.containers.traits.LinkableContainer
  class file for org.testcontainers.containers.traits.LinkableContainer not found

I've googled for "linkablecontainer not found" and for "org.testcontainers.containers.traits.LinkableContainer not found" but with no results.

Any ideas what went wrong?

ka3ak
  • 2,435
  • 2
  • 30
  • 57

1 Answers1

0

Different case than yours but I got the same error and it seems that it's not that common.

In my case I got the same error when the dependency for the database was not in scope test but the dependency for the testcontainers it was.

For example on pom.xml

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mssqlserver</artifactId>
        </dependency>

I forgot to remove <scope>test</scope> from the testcontainers and after that the error was gone.

I guess there isn't a global solution to this error but the cause could be some misconfiguration on pom.xml.

Manuel Pap
  • 1,309
  • 7
  • 23
  • 52