-
Couldn't load subscription status.
- Fork 90
Add shaded artifact for Spotify implementation #124
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
Conversation
|
@viktortnk Are you publishing only to Maven or to Ivy as well? This PR would create proper |
|
Ready to be merged. Tested by publishing to Artifactory. |
|
The change publishes a separate artifact |
|
@viktortnk Do you think you could merge it? |
|
I don't understand the reason for the issue. Can someone else explain why ClassCastException happens. The solution should be excluding spotify dependency from |
|
Okay. Here's an elaborate explanation. I'm trying to use libraryDependencies += Seq()
"com.whisk" %% "docker-testkit-scalatest" % "0.9.7",
"com.whisk" %% "docker-testkit-impl-spotify" % "0.9.7",
)com.spotify.docker.client.exceptions.DockerExceptioncom.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: javax.ws.rs.ProcessingException: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:2812) at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2666) at com.spotify.docker.client.DefaultDockerClient.listImages(DefaultDockerClient.java:690) at com.whisk.docker.impl.spotify.SpotifyDockerCommandExecutor$$anonfun$listImages$1.apply(SpotifyDockerCommandExecutor.scala:185) at com.whisk.docker.impl.spotify.SpotifyDockerCommandExecutor$$anonfun$listImages$1.apply(SpotifyDockerCommandExecutor.scala:188) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ... Cause: java.util.concurrent.ExecutionException: javax.ws.rs.ProcessingException: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299) at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286) at jersey.repackaged.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116) at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2664) at com.spotify.docker.client.DefaultDockerClient.listImages(DefaultDockerClient.java:690) at com.whisk.docker.impl.spotify.SpotifyDockerCommandExecutor$$anonfun$listImages$1.apply(SpotifyDockerCommandExecutor.scala:185) at com.whisk.docker.impl.spotify.SpotifyDockerCommandExecutor$$anonfun$listImages$1.apply(SpotifyDockerCommandExecutor.scala:188) at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ... Cause: javax.ws.rs.ProcessingException: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected at org.glassfish.jersey.client.ClientRuntime.processFailure(ClientRuntime.java:202) at org.glassfish.jersey.client.ClientRuntime.access$400(ClientRuntime.java:79) at org.glassfish.jersey.client.ClientRuntime$2.run(ClientRuntime.java:182) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:340) at org.glassfish.jersey.client.ClientRuntime$3.run(ClientRuntime.java:210) ... Cause: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:104) at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:89) at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:44) at jnr.ffi.LibraryLoader.load(LibraryLoader.java:325) at jnr.unixsocket.Native.(Native.java:80) at jnr.unixsocket.UnixSocketChannel.(UnixSocketChannel.java:101) at jnr.unixsocket.UnixSocketChannel.open(UnixSocketChannel.java:60) at com.spotify.docker.client.UnixConnectionSocketFactory.createSocket(UnixConnectionSocketFactory.java:69) at com.spotify.docker.client.UnixConnectionSocketFactory.createSocket(UnixConnectionSocketFactory.java:44) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:118) This problem is discussed and solved by spotify/docker-client#272 and requires using shaded package. So, the solution is to use shaded But if I change my libraryDependencies ++= {
...
"com.whisk" %% "docker-testkit-scalatest" % "0.9.7",
"com.whisk" %% "docker-testkit-impl-spotify" % "0.9.7",
exclude("com.spotify", "docker-client"),
"com.spotify" % "docker-client" % "8.11.5" classifier "shaded"
}and try to run my tests, I will get another error. Here's a simple code snippet to reporduce the problem: import scala.concurrent.ExecutionContext.Implicits.global
import com.spotify.docker.client.DefaultDockerClient
import com.whisk.docker.impl.spotify.SpotifyDockerCommandExecutor
val client = DefaultDockerClient.fromEnv().build()
val ce = new SpotifyDockerCommandExecutor("localhost", client)
ce.listImages()Above causes following exception: Let's see why: client.listImages().get(0).repoTags()
//scala> client.listImages().get(0).repoTags()
res1: com.spotify.docker.client.shaded.com.google.common.collect.ImmutableList[String] = [...]So, |
|
Thanks for detailed explanation. Makes sense |
Resolves #123