Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError on Windows #15

Open
johnwright opened this issue Jun 7, 2021 · 4 comments · May be fixed by #17
Open

NoClassDefFoundError on Windows #15

johnwright opened this issue Jun 7, 2021 · 4 comments · May be fixed by #17

Comments

@johnwright
Copy link

First of all thanks very much for this plugin!

I originally ran the build on a Mac, with no issues. But on Windows, a 'NoClassDefFoundError` is being thrown. I'll include the stack trace below.

It seems to me that the problem is happening within docker-java, for some reason it's decided to create a UnixSocketFactory despite being on a Windows machine. I've tested with:

Docker Engine: v20.10.6
JDK 16.0.1
Gradle 6.7

java.lang.NoClassDefFoundError: Could not initialize class com.github.dockerjava.transport.DomainSocket
    at com.github.dockerjava.okhttp.UnixSocketFactory.createSocket(UnixSocketFactory.java:21)
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:257)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183)
    at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
    at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
    at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
    at okhttp3.RealCall.execute(RealCall.java:81)
    at com.github.dockerjava.okhttp.OkDockerHttpClient$OkResponse.<init>(OkDockerHttpClient.java:256)
    at com.github.dockerjava.okhttp.OkDockerHttpClient.execute(OkDockerHttpClient.java:230)
    at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
    at com.github.dockerjava.core.DefaultInvocationBuilder.delete(DefaultInvocationBuilder.java:56)
    at com.github.dockerjava.core.exec.RemoveContainerCmdExec.execute(RemoveContainerCmdExec.java:28)
    at com.github.dockerjava.core.exec.RemoveContainerCmdExec.execute(RemoveContainerCmdExec.java:11)
    at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
    at com.github.dockerjava.core.command.RemoveContainerCmdImpl.exec(RemoveContainerCmdImpl.java:67)
    at com.revolut.jooq.Docker.removeContainer(Docker.kt:86)
    at com.revolut.jooq.Docker.runInContainer(Docker.kt:40)
    at com.revolut.jooq.GenerateJooqClassesTask.generateClasses(GenerateJooqClassesTask.kt:152)
@johnwright
Copy link
Author

I've discovered a workaround for this - if I set the DOCKER_HOST system property to npipe:////./pipe/docker_engine then docker-java will not attempt to use a Unix domain socket.

@jseminck
Copy link

@johnwright thank you for the workaround, it fixed the problem for me as well. Perhaps we can add this to the README? But I don't really know what it means or if it has any side effects.

@sgrimm
Copy link

sgrimm commented Sep 14, 2021

A new version of the Java Docker client library was just released today that fixes this (uses npipe by default on Windows): https://github.com/docker-java/docker-java/releases/tag/3.2.12

sgrimm added a commit to sgrimm/jooq-plugin that referenced this issue Sep 14, 2021
Version 3.2.12 of the Docker client improves Windows compatibility by defaulting to named pipes rather than UNIX-domain sockets to talk to the Docker daemon on Windows. Previously, users had to explicitly set `DOCKER_HOST` on Windows.

Fixes revolut-engineering#15
@sgrimm sgrimm linked a pull request Sep 14, 2021 that will close this issue
@monosoul
Copy link

monosoul commented Jun 5, 2022

Hey all, I forked the plugin and published it under a new group: https://plugins.gradle.org/plugin/dev.monosoul.jooq-docker

This issue is fixed there.

adrianskrobaczrevolut added a commit that referenced this issue Jan 11, 2023
FCSAR-2847 Use jooq version from compile classpath for generation

* FCSAR-2847 Use jooq version from compile classpath for generation


Approved-by: Kamil Gregorczyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants