Docker Community Forums

Share and learn in the Docker community.

Docker Java sdk application throws error in SSL configuration


(Gladiator67) #1

This is my simple docker java api application on windows 10.

package com.aaa.docker;

import com.github.dockerjava.api.DockerClient;
import com.github.dockerjava.core.DockerClientBuilder;
import com.github.dockerjava.core.DockerClientConfig;

public class JavaClient {

public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
DockerClientConfig config = DockerClientConfig.createDefaultConfigBuilder()
.withRegistryUrl(“tcp://192.168.99.100:2376”)
.withDockerCertPath("/C:/Users/joseph/.docker/machine/certs/")
.withRegistryUsername(“user01”)
.withRegistryPassword(“1111111”)
.withRegistryEmail("user01@naver.com")
.build();

  DockerClient dockerClient = DockerClientBuilder.getInstance(config).build();	
  System.out.println(dockerClient.versionCmd());

}
}

But It throws the following exception

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/data/slf4j-log4j12-1.7.19.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/data/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/data/slf4j.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Exception in thread “main” com.github.dockerjava.api.exception.DockerClientException: Error in SSL Configuration
at com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl.init(DockerCmdExecFactoryImpl.java:172)
at com.github.dockerjava.core.DockerClientImpl.withDockerCmdExecFactory(DockerClientImpl.java:157)
at com.github.dockerjava.core.DockerClientBuilder.build(DockerClientBuilder.java:47)
at com.aaa.docker.JavaClient.main(JavaClient.java:19)
Caused by: com.github.dockerjava.api.exception.DockerClientException: class “org.bouncycastle.openssl.PEMException”'s signer information does not match signer information of other classes in the same package
at com.github.dockerjava.core.LocalDirectorySSLConfig.getSSLContext(LocalDirectorySSLConfig.java:60)
at com.github.dockerjava.jaxrs.DockerCmdExecFactoryImpl.init(DockerCmdExecFactoryImpl.java:168)
… 3 more
Caused by: java.lang.SecurityException: class “org.bouncycastle.openssl.PEMException”'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.bouncycastle.openssl.PEMParser.(Unknown Source)
at com.github.dockerjava.core.util.CertificateUtils.loadPrivateKey(CertificateUtils.java:125)
at com.github.dockerjava.core.util.CertificateUtils.createKeyStore(CertificateUtils.java:45)
at com.github.dockerjava.core.LocalDirectorySSLConfig.getSSLContext(LocalDirectorySSLConfig.java:53)
… 4 more

It looks there are some problems in security configuration but i have no idea.
I need your help! Thanks in advanced!