Could not find a valid Docker environment with Maven: failed with exception ArrayIndexOutOfBoundsException (1) #8960
Replies: 1 comment
-
After debugging my maven runner i noticed that surefire forks into a new process, and that caused some problems with attaching a debugger. So i tried to disable it, and when i disable forking, the tests work, and the exception is gone! <plugin>
<artifactId>maven-surefire-plugin</artifactId>
....
<configuration>
<forkCount>0</forkCount> In stepping through with the debugger, i end up at Possibly related issue: #2939 What could be causing this problem? |
Beta Was this translation helpful? Give feedback.
-
Hello, this is a discussion for a potential bug report, or getting assistance with fixing my environment/project setup.
When i run a unit test with a testcontainer, i encounter a strange issue.
Software used:
Short summary:
Java 8, JUnit4, Maven 3, Windows 10 Pro, Docker desktop, WSL
Testcontainers version: org.testcontainers:oracle-xe:1.19.8
Surefire plugin version: 2.22.2
mvn --version
docker version
Pom.xml
The unit test is structured as follows (for legacy reasons a custom Junit4
Runner
is used):@RunWith(MyTestRunner.class)
Where the Runner creates a container as a singleton used by all tests, and then starts it:
The error i'm getting:
What i've tried:
org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy
in mytestcontainers.properties
file and provide thedocker.host
manually astcp://localhost:2375
, but this also fails with the sameArrayIndexOutOfBoundsException (1)
A problem is that the stacktrace of this
ArrayIndexOutOfBoundsException
is lost in thecatch
statement oforg.testcontainers.dockerclient.DockerClientProviderStrategy#tryOutStrategy
, so i'm not quite sure where it fails, and what i could try next to fix it?Is it an option to add (debug) logging with the entire stacktrace here?
Edit: i managed to attach a debugger to my maven unit test runner, and extract the following stacktrace:
Again, running the tests directly from my IDE can connect to Docker, and the testcontainer is downloaded, started and all test execute just fine connecting to the Oracle database over JDBC running in the container.
In this case it is connecting over the npipe named socket, so that exists and functions.
Beta Was this translation helpful? Give feedback.
All reactions