docker-client icon indicating copy to clipboard operation
docker-client copied to clipboard

Problem create container with CXF

Open pmartin8 opened this issue 8 years ago • 5 comments

Description

I created this bug as a reopened of https://github.com/spotify/docker-client/issues/449

How to reproduce

If you start the container and javax.ws.rs.client.ClientBuilder is available in your classpath, then the container wont start because javax.ws.rs.client.ClientBuilder complains that unix: is not a valid protocol.

What do you expect

I expected that the client would use a WebClient that is able to handle unix: protocol

What happened instead

Failure to handle unix protocol.

Software:

  • docker version: Version 17.12.0-ce-mac55 (23011)
  • Spotify's docker-client version: 8.11.2

Full backtrace

com.spotify.docker.client.exceptions.DockerException: java.util.concurrent.ExecutionException: javax.ws.rs.ProcessingException: java.net.MalformedURLException: unknown protocol: unix
	at com.spotify.docker.client.DefaultDockerClient.propagate(DefaultDockerClient.java:2710)
	at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2641)
	at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:1258)
	at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:1235)
	at com.spotify.docker.client.DefaultDockerClient.pull(DefaultDockerClient.java:1229)
	at com.microflex.services.testing.runner.version.IntegrationTestRunner.startMocksOnDocker(IntegrationTestRunner.java:79)
	at com.microflex.services.testing.runner.version.IntegrationTestRunner.start(IntegrationTestRunner.java:66)
	at com.microflex.services.testing.runner.version.IntegrationTestRunner.<clinit>(IntegrationTestRunner.java:51)
	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:423)
	at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
	at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:26)
	at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59)
	at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createUnfilteredTest(JUnit4TestLoader.java:84)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:70)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:43)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:444)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.util.concurrent.ExecutionException: javax.ws.rs.ProcessingException: java.net.MalformedURLException: unknown protocol: unix
	at org.apache.cxf.endpoint.ClientCallback.get(ClientCallback.java:147)
	at org.apache.cxf.jaxrs.client.JaxrsClientCallback$JaxrsResponseFuture.get(JaxrsClientCallback.java:118)
	at com.spotify.docker.client.DefaultDockerClient.request(DefaultDockerClient.java:2639)
	... 23 more
Caused by: javax.ws.rs.ProcessingException: java.net.MalformedURLException: unknown protocol: unix
	at org.apache.cxf.jaxrs.client.AbstractClient$ConnectionFaultInterceptor.handleMessage(AbstractClient.java:1246)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
	at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:112)
	at org.apache.cxf.phase.PhaseInterceptorChain.wrapExceptionAsFault(PhaseInterceptorChain.java:374)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:332)
	at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:683)
	at org.apache.cxf.jaxrs.client.WebClient.prepareAsyncClient(WebClient.java:965)
	at org.apache.cxf.jaxrs.client.WebClient.doInvokeAsync(WebClient.java:928)
	at org.apache.cxf.jaxrs.client.AsyncInvokerImpl.method(AsyncInvokerImpl.java:174)
	... 24 more
Caused by: java.net.MalformedURLException: unknown protocol: unix
	at java.net.URL.<init>(URL.java:600)
	at java.net.URL.<init>(URL.java:490)
	at java.net.URL.<init>(URL.java:439)
	at java.net.URI.toURL(URI.java:1089)
	at org.apache.cxf.transport.http.Address.getURL(Address.java:60)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit.createConnection(URLConnectionHTTPConduit.java:113)
	at org.apache.cxf.transport.http.URLConnectionHTTPConduit.setupConnection(URLConnectionHTTPConduit.java:126)
	at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:504)
	at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)

pmartin8 avatar Mar 21 '18 20:03 pmartin8

Facing this same issue.

leandrodvd avatar Apr 10 '18 12:04 leandrodvd

I figured you can get around this by adding shaded in your pom <dependency groupId com.spotify</groupId> <artifactId>docker-client</artifactId> <version>${docker.client.version}</version> <classifier>shaded</classifier> <scope>test</scope> </dependency>

pmartin8 avatar Apr 10 '18 12:04 pmartin8

@pmartin8 can you go more in details about how and why this shaded solution works ? I tried it and got no different result.

leandrodvd avatar Apr 10 '18 15:04 leandrodvd

I cant tell you more.. but it looks my classloader loads the right classes when this shaded param is there. I dont know exactly what it does... sorry

pmartin8 avatar Apr 10 '18 19:04 pmartin8

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 24 '18 13:09 stale[bot]