Not able to connect the solace container with testcontainers module in java

aditya Member Posts: 7
edited March 2023 in Connectors & Integrations #1

I am trying to connect the solace container with java testcontainer 1.17.6 module but not able to connect everytime. I am getting the below error:

Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed

at org.testcontainers.containers.GenericContainer.doStart(

at org.testcontainers.containers.GenericContainer.start(

at com.solace.junit.AbstractPubSubPlusTestCase.<clinit>(

... 22 more

Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception

at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(

at org.testcontainers.containers.GenericContainer.doStart(

... 24 more

Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container

at org.testcontainers.containers.GenericContainer.tryStart(

at org.testcontainers.containers.GenericContainer.lambda$doStart$0(

at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(

... 25 more

Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [54997, 54998, 54999, 55000, 55001, 55002, 55003] should be listening)

at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(

at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(

at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(

at org.testcontainers.containers.GenericContainer.tryStart(

... 27 more

I have tried to connect using the below code

Sometimes it is connecting sometimes it is giving the above error. What settings should I apply so that we can connect the container every time. I have also notice that the solace container works after sometime.


  • amackenzie
    amackenzie Member, Employee Posts: 259 Solace Employee

    Have you looked at this thread:

    It seems like it could be related.

    Also, when pasting code or logs, can you format them with a code block? It makes it much easier to read.

  • aditya
    aditya Member Posts: 7
    edited March 2023 #3

    Hi @amackenzie, Sorry I will look into the format issue next time. Yes I have looked into this thread and I am not using that port but still I am getting the same issue. Please check the below code

    solace = new GenericContainer<>("solace/solace-pubsub-standard:latest").withExposedPorts(55555, 8080,8000,9000,1883,5672)
            .withSharedMemorySize(1000000000L).withEnv("username_admin_globalaccesslevel", ADMIN_USER)
            .withEnv("username_admin_password", ADMIN_PASSWORD).withEnv("system_scaling_interconnection", "1500")

    Also I have tried by adding waitingFor(Wait.forListeningPort() but no luck.

    I am using the testcontainers 1.17.6

  • swenhelge
    swenhelge Member, Employee Posts: 77 Solace Employee


    That is a repo I created a couple of years back.

    I never ran into a problem like this - it seems it is intermittent?

    The best option would be to see if you can extract the broker log from the docker container in case of failure somehow?

    And also capture a complete JUnit test log and upload it.

  • swenhelge
    swenhelge Member, Employee Posts: 77 Solace Employee

    While I never saw the issue you encounter there may be two alternative approaches that may help ..

    Using JUnit5:

    Or this here on the testcontainers site -

  • aditya
    aditya Member Posts: 7

    @swenhelge You are correct the issue seems intermittent. I have reinstalled the docker desktop and after that it is working fine. I will still check and if I face the issue again I will send you the logs . Also I will check the alternative approach. Thanks a lot for helping me.