Thanks to visit codestin.com
Credit goes to github.com

Skip to content

'dockerHttpClient' should be set.Falling back to Jersey #2352

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

Open
xiaranyueming opened this issue Aug 16, 2024 · 4 comments
Open

'dockerHttpClient' should be set.Falling back to Jersey #2352

xiaranyueming opened this issue Aug 16, 2024 · 4 comments

Comments

@xiaranyueming
Copy link

在程序中出现这样的问题:
'dockerHttpClient' should be set.Falling back to Jersey, will be an error in future releases.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/Configuration
该怎么解决呢

@kabourek-p
Copy link

kabourek-p commented Aug 16, 2024

Hello,

I ran into the same warning. However I did not get the Exception.

I maneged to get rid of the warning byI following the (brief) docs here on github and reached this solution:

try(DockerClient dockerClient = openDockerClient()){
      // your  code
}

And the metod then:

    private static DockerClient openDockerClient() {
        var config = DefaultDockerClientConfig.createDefaultConfigBuilder().build();
        DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder()
                .dockerHost(config.getDockerHost())
                .sslConfig(config.getSSLConfig())
                .maxConnections(100)
                .connectionTimeout(Duration.ofSeconds(30))
                .responseTimeout(Duration.ofSeconds(45))
                .build();

        return DockerClientImpl.getInstance(config, httpClient);
    }

you also need to add this dependency with the client to your pom.xml:

        <dependency>
            <groupId>com.github.docker-java</groupId>
            <artifactId>docker-java-transport-httpclient5</artifactId>
            <version>3.4.0</version>
        </dependency>

This has removed the warning, uses the Apache HttpClient 5 and most importantly, it works. So hopefully this is the intended way.

Hope it helps.

@crimeproof
Copy link

hello,I have same error

my dependency :

    <dependency>
        <groupId>com.github.docker-java</groupId>
        <artifactId>docker-java</artifactId>
        <version>3.3.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.github.docker-java/docker-java-transport-httpclient5 -->
    <dependency>
        <groupId>com.github.docker-java</groupId>
        <artifactId>docker-java-transport-httpclient5</artifactId>
        <version>3.3.0</version>
    </dependency>`

but when i use jdk version greater than 1.8,the above problem occurs。When I changed the jdk version to 1.8,This problem is solved.
Hope it helps

@coderphonui
Copy link

Hello,

I ran into the same warning. However I did not get the Exception.

I maneged to get rid of the warning byI following the (brief) docs here on github and reached this solution:

try(DockerClient dockerClient = openDockerClient()){
      // your  code
}

And the metod then:

    private static DockerClient openDockerClient() {
        var config = DefaultDockerClientConfig.createDefaultConfigBuilder().build();
        DockerHttpClient httpClient = new ApacheDockerHttpClient.Builder()
                .dockerHost(config.getDockerHost())
                .sslConfig(config.getSSLConfig())
                .maxConnections(100)
                .connectionTimeout(Duration.ofSeconds(30))
                .responseTimeout(Duration.ofSeconds(45))
                .build();

        return DockerClientImpl.getInstance(config, httpClient);
    }

you also need to add this dependency with the client to your pom.xml:

        <dependency>
            <groupId>com.github.docker-java</groupId>
            <artifactId>docker-java-transport-httpclient5</artifactId>
            <version>3.4.0</version>
        </dependency>

This has removed the warning, uses the Apache HttpClient 5 and most importantly, it works. So hopefully this is the intended way.

Hope it helps.

This solution works for me!

Copy link

stale bot commented Apr 26, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants