springtainer / springtainer-mongodb

MongoDB as docker-container for springboot testing
MIT License
5 stars 3 forks source link

Exception while starting mongodb-container #8

Closed frenki-d closed 5 years ago

frenki-d commented 5 years ago

Hi! I tried to use your lib, but got an exception. Libs like com.playtika.testcontainers.embedded-redis works fine, so I think it's not a problem with my docker instance.

2019-02-14 12:00:51.978  INFO 13472 --- [           main] .t.c.c.AbstractBuildingEmbeddedContainer : Starting mongodb-container with MongodbProperties(super=AbstractEmbeddedContainerProperties(enabled=true, startupTimeout=30, dockerImage=mongo:3.4.18), port=27017)
java.lang.RuntimeException: Library 'junixsocket-native-2.0.4.dll' not found!
    at org.newsclub.net.unix.NarSystem.getLibPath(NarSystem.java:132)
    at org.newsclub.net.unix.NarSystem.loadLibrary(NarSystem.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.newsclub.net.unix.NativeUnixSocket.<clinit>(NativeUnixSocket.java:35)
    at org.newsclub.net.unix.AFUNIXSocket.<init>(AFUNIXSocket.java:36)
    at org.newsclub.net.unix.AFUNIXSocket.newInstance(AFUNIXSocket.java:54)
    at com.github.dockerjava.jaxrs.ApacheUnixSocket.<init>(ApacheUnixSocket.java:51)
    at com.github.dockerjava.jaxrs.UnixConnectionSocketFactory.createSocket(UnixConnectionSocketFactory.java:66)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:119)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:373)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:394)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:450)
    at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:278)
    at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:767)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:229)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:414)
    at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:765)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:428)
    at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:324)
    at com.github.dockerjava.jaxrs.InspectImageCmdExec.execute(InspectImageCmdExec.java:27)
    at com.github.dockerjava.jaxrs.InspectImageCmdExec.execute(InspectImageCmdExec.java:13)
    at com.github.dockerjava.jaxrs.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:23)
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
    at com.github.dockerjava.core.command.InspectImageCmdImpl.exec(InspectImageCmdImpl.java:40)
    at com.avides.springboot.testcontainer.common.container.AbstractBuildingEmbeddedContainer.pullImage(AbstractBuildingEmbeddedContainer.java:170)
    at com.avides.springboot.testcontainer.common.container.AbstractBuildingEmbeddedContainer.createContainer(AbstractBuildingEmbeddedContainer.java:141)
    at com.avides.springboot.testcontainer.common.container.AbstractBuildingEmbeddedContainer.<init>(AbstractBuildingEmbeddedContainer.java:49)
    at com.avides.springboot.testcontainer.mongodb.EmbeddedMongodbContainerAutoConfiguration$MongodbContainer.<init>(EmbeddedMongodbContainerAutoConfiguration.java:39)
    at com.avides.springboot.testcontainer.mongodb.EmbeddedMongodbContainerAutoConfiguration.mongodbContainer(EmbeddedMongodbContainerAutoConfiguration.java:32)
    at com.avides.springboot.testcontainer.mongodb.EmbeddedMongodbContainerAutoConfiguration$$EnhancerBySpringCGLIB$$7ae3e8ea.CGLIB$mongodbContainer$0(<generated>)
    at com.avides.springboot.testcontainer.mongodb.EmbeddedMongodbContainerAutoConfiguration$$EnhancerBySpringCGLIB$$7ae3e8ea$$FastClassBySpringCGLIB$$c0f212b9.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363)
    at com.avides.springboot.testcontainer.mongodb.EmbeddedMongodbContainerAutoConfiguration$$EnhancerBySpringCGLIB$$7ae3e8ea.mongodbContainer(<generated>)
    ...
julian-eggers commented 5 years ago

Hi,

which OS do you use? Windows?

frenki-d commented 5 years ago

Hi, which OS do you use? Windows?

yes, it's Windows 10

julian-eggers commented 5 years ago

We only tested against Linux and Mac... Im working on a fix but I can only test with Docker Toolbox.. Do you use Docker Toolbox (Legacy) or Docker for Windows?

frenki-d commented 5 years ago

Do you use Docker Toolbox (Legacy) or Docker for Windows?

Docker for Windows

fegbers commented 5 years ago

Do you use Docker Toolbox (Legacy) or Docker for Windows?

Docker for Windows

I will setup Docker for Windows this evening. I hope i can reproduce your issue. I'm also going to test the fix mentioned by @julian-eggers. If there is some progress i will keep you updated.

fegbers commented 5 years ago

@frenki-d I could reproduce your mistake. I could solve this problem too. We will release a new common version with a suitable documentation for the problem as well as a new version of the mongo test container with the new common version. When the new version has been released, I will inform you.

fegbers commented 5 years ago

@frenki-d @julian-eggers just pushed a new version of the mongo testcontainer with the fix for windows (#9). Could you please test the new version with your Docker for Windows configuration? I just had to add a new system variable with the "DOCKER_HOST" equals "tcp://localhost:2375" and enable the feature "Expose deamon on tcp://localhost:2375 without TLS" in the Docker for Windows UI. If this works for you, we could write for this a wiki.

frenki-d commented 5 years ago

@fegbers, creating a system variable "DOCKER_HOST" fixed the error. Now I can run my mongodb tests with testcontainers. Thanks a lot for your help! =)

fegbers commented 5 years ago

I'm glad that we could help :)