Comments (5)
Hi. Could you tell what is inside 'MyDockerCassandraService' trait. It might lead to NullPointerException
if it uses 'docker' object before it is initialised.
If you make a fork of this repo and put your code there, I'll have a look
from docker-it-scala.
Hi,
Sorry for the delayed reply. MyDockerCassandraService is just a copy of your DockerCassandraService, it was a desperate move :-)
I've cloned today your repo and tried to run sbt test and it failed as follows:
[error] Uncaught exception when running whisk.docker.AllAtOnceSpec: java.lang.NullPointerException
sbt.ForkMain$ForkError
at com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl.init(DockerCmdExecFactoryImpl.java:111)
at com.github.dockerjava.core.DockerClientImpl.withDockerCmdExecFactory(DockerClientImpl.java:60)
at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:61)
at whisk.docker.Docker.<init>(Docker.scala:7)
at whisk.docker.DockerKit$class.$init$(DockerKit.scala:12)
at whisk.docker.AllAtOnceSpec.<init>(AllAtOnceSpec.scala:8)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:646)
at sbt.ForkMain$Run$2.call(ForkMain.java:294)
at sbt.ForkMain$Run$2.call(ForkMain.java:284)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] Uncaught exception when running whisk.docker.MongodbServiceSpec: java.lang.NullPointerException
sbt.ForkMain$ForkError
at com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl.init(DockerCmdExecFactoryImpl.java:111)
at com.github.dockerjava.core.DockerClientImpl.withDockerCmdExecFactory(DockerClientImpl.java:60)
at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:61)
at whisk.docker.Docker.<init>(Docker.scala:7)
at whisk.docker.DockerKit$class.$init$(DockerKit.scala:12)
at whisk.docker.MongodbServiceSpec.<init>(MongodbServiceSpec.scala:8)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:646)
at sbt.ForkMain$Run$2.call(ForkMain.java:294)
at sbt.ForkMain$Run$2.call(ForkMain.java:284)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] Uncaught exception when running whisk.docker.KafkaServiceSpec: java.lang.NullPointerException
sbt.ForkMain$ForkError
at com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl.init(DockerCmdExecFactoryImpl.java:111)
at com.github.dockerjava.core.DockerClientImpl.withDockerCmdExecFactory(DockerClientImpl.java:60)
at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:61)
at whisk.docker.Docker.<init>(Docker.scala:7)
at whisk.docker.DockerKit$class.$init$(DockerKit.scala:12)
at whisk.docker.KafkaServiceSpec.<init>(KafkaServiceSpec.scala:8)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:646)
at sbt.ForkMain$Run$2.call(ForkMain.java:294)
at sbt.ForkMain$Run$2.call(ForkMain.java:284)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[error] Uncaught exception when running whisk.docker.ElasticsearchServiceSpec: java.lang.NullPointerException
When I checked out this version - 57dbf52, and changed the
"docker-java" version to "1.2.0", because there was some problem with downloading 0.10.4, I got this error - it failed because it was trying to connect to localhost:2376:
[info] CassandraServiceSpec:
08:44:50.098 [ForkJoinPool-1-worker-13] DEBUG c.g.d.core.command.AbstrDockerCmd - Cmd: images
08:44:50.421 [ForkJoinPool-1-worker-13] DEBUG c.g.d.jaxrs.DockerCmdExecFactoryImpl - 1 * Sending client request on thread ForkJoinPool-1-worker-13
1 > GET https://localhost:2376/images/json?all=0
1 > Accept: application/json
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
[info] Exception encountered when attempting to run a suite with class name: whisk.docker.CassandraServiceSpec *** ABORTED ***
[info] Exception encountered when attempting to run a suite with class name: whisk.docker.CassandraServiceSpec (DockerTestKit.scala:37)
08:44:50.688 [ForkJoinPool-1-worker-11] DEBUG c.g.d.core.command.AbstrDockerCmd - Cmd: images
[info] Neo4jServiceSpec:
08:44:50.747 [ForkJoinPool-1-worker-11] DEBUG c.g.d.jaxrs.DockerCmdExecFactoryImpl - 1 * Sending client request on thread ForkJoinPool-1-worker-11
1 > GET https://localhost:2376/images/json?all=0
1 > Accept: application/json
[info] Exception encountered when attempting to run a suite with class name: whisk.docker.Neo4jServiceSpec *** ABORTED ***
[info] Exception encountered when attempting to run a suite with class name: whisk.docker.Neo4jServiceSpec (DockerTestKit.scala:37)
When I did
export DOCKER_HOST=http://mydockerrepo:4243
sbt test
the tests passed - the old version and today's version.
Is your docker daemon listening on port 2376? What happens when you change it and try to run the test? When the port is different from 2376 and you override the implicit val docker
- does it work for you?
Please let me know if you need more info from me.
Thanks in advance,
Uri
from docker-it-scala.
The NullPointerException may be caused by initialization order. See for example http://docs.scala-lang.org/tutorials/FAQ/initialization-order.html. It would be preferred if docker-it provided a convenient way to override the configuration.
Currently there are still options how to override the docker implicit val. One of them is the early initializer approach, e.g.
BackendITTest extends {
override implicit val docker: Docker = ...
}
with FlatSpecLike
with Matchers
...
from docker-it-scala.
According to stacktraces above, I see NullPointerException happens inside docker-java library.
Until very recent changes container definitions were bound to implicit docker: Docker
value. I made them isolated.
Hopefully that should help with safer overriding of docker
value. I suggest trying this with v0.4.0 of the library.
I'm sorry for not putting much attention to this issue :(
from docker-it-scala.
There was no updates for this issue. Before closing it, I'll just leave an example of how we overriding it
package whisk.docker.services
import com.github.dockerjava.core.DockerClientConfig
import com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl
import com.whisk.docker.{Docker, DockerKit}
trait DockerKitBase extends DockerKit {
override implicit val docker: Docker =
new Docker(
DockerClientConfig.createDefaultConfigBuilder().build(),
new DockerCmdExecFactoryImpl())
}
from docker-it-scala.
Related Issues (20)
- Concurrency issues on logs
- No support for UDP?
- Timeout or Race condition resulting in Cannot run all required containers HOT 1
- Shutdown connection before running tests HOT 1
- Pulling image timeout gives an error message about not being able to pull windows image
- Publish v0.9.7 for 2.11 ? HOT 1
- Plans to publish a jar with shaded spotify docker-client? HOT 8
- Setup steps unclear HOT 2
- PostgresServiceSpec fails with driver libraries from 42 HOT 1
- Allow pausing/unpausing of containers in DockerExecutor
- Release for Scala 2.13 HOT 5
- run unpublished docker image with whisk labs docker-it-scala HOT 1
- Incompatible with ScalaTest's AsyncTestSuite
- Issues with SBT 1.3.x
- An image without a tag pulls all tags
- Persisting container across multiple test classes
- withUnlinkedDependencies not starting dependent container
- DockerContainer should have an option to configure withIpv6Address and withExtraHosts
- Missing release for docker-testkit-impl-docker-java 0.11.0 HOT 5
- Update in the GitHub Actions image's docker breaks docker-it-scala HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-it-scala.