jooq-plugin icon indicating copy to clipboard operation
jooq-plugin copied to clipboard

NoClassDefFoundError on Windows

Open johnwright opened this issue 4 years ago • 4 comments

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 avatar Jun 07 '21 12:06 johnwright

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.

johnwright avatar Jun 07 '21 13:06 johnwright

@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.

jseminck avatar Jun 18 '21 14:06 jseminck

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 avatar Sep 14 '21 22:09 sgrimm

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.

monosoul avatar Jun 05 '22 13:06 monosoul