porunov / acme_client

Java ACME Client application
MIT License
111 stars 23 forks source link

jdeps may crash when analyzing acme_client.jar #26

Open BillZaumen opened 4 months ago

BillZaumen commented 4 months ago

I downloaded acme_client on a system that did not have software such as bouncycastle installed, and jdeps crashed with an error about a provider not being found. I tried an initial test, just getting the agreement URL from lets encrypt, and that worked just fine.

I've been considering using acme_client.jar in a Docker container, using jllink to reduce the size of the JRE, and wanted to use jdeps to find what modules to pass to jlink.

Documentation with just a list of the appropriate Java modules would be very helpful, at least until jlink is fixed. I was testing using Java 17. With version 17.0.9 of jdeps, the command jdeps acme_client.jar produced the following stack trace: Exception in thread "main" java.lang.module.FindException: Module org.bouncycastle.provider not found, required by org.bouncycastle.pkix at java.base/java.lang.module.Resolver.findFail(Resolver.java:893) at java.base/java.lang.module.Resolver.resolve(Resolver.java:192) at java.base/java.lang.module.Resolver.resolve(Resolver.java:141) at java.base/java.lang.module.Configuration.resolve(Configuration.java:421) at java.base/java.lang.module.Configuration.resolve(Configuration.java:255) at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:564) at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:603) at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:557) at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:533) at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)

jdeps options to suppress warnings or errors did not help.

darian-au commented 4 months ago

Hi Bill,

Unfortunately Oleksandr appears to have abandoned the acme client project. I had forked it and had been making some changes to add some convenience for my own usage and asked Oleksandr to incorporate them. My pull request was ignored and as I have had no response, I decided to release my changes on my fork instead. You can download them here.

https://github.com/darian-au/acme-client/releases

One of my changes was to not pack all the dependencies into the same jar and instead place them in a seperate lib dir. This may help your situation as all the dependencies remain intact without stripping their meta data. I tested jdeps (Java 11) on my build of the acme-client jar, it produced a report without crashing.

I hope this helps.

Cheers, Darian

BillZaumen commented 4 months ago

Thanks, Darian.

I'm still getting some errors but now I can catch a lot of, if not all of, the dependencies. We your help.are possibly using different JDKs (I'm using openjdk and tried versions 11 and 17), or it could be some error on my part, although I tried quite a few combinations of flags, etc.

Thanks very much for helping.

Regards,

Bill

On Sat, 2024-02-24 at 19:51 -0800, Darian wrote:

Hi Bill,

Unfortunately Oleksandr appears to have abandoned the acme client project. I had forked it and had been making some changes to add some convenience for my own usage and asked Oleksandr to incorporate them. My pull request was ignored and as I have had no response, I decided to release my changes on my fork instead. You can download them here.

https://github.com/darian-au/acme-client/releases

One of my changes was to not pack all the dependencies into the same jar and instead place them in a seperate lib dir. This may help your situation as all the dependencies remain intact without stripping their meta data. I tested jdeps (Java 11) on my build of the acme- client jar, it produced a report without crashing.

I hope this helps.

Cheers, Darian

darian-au commented 4 months ago

Hi Bill,

I’m unsure why it's not working for you, I tried again on both my Mac and on another Ubuntu host and copied the results below.

Cheers, Darian

$ java -version
openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment (build 11.0.21+9-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.21+9-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)

$ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed mode)

$ jdeps acme-client-3.1.0.jar 
acme-client-3.1.0.jar -> java.base
acme-client-3.1.0.jar -> not found
   com.jblur.acme_client                              -> ch.qos.logback.classic                             not found
   com.jblur.acme_client                              -> ch.qos.logback.classic.joran                       not found
   com.jblur.acme_client                              -> ch.qos.logback.core                                not found
   com.jblur.acme_client                              -> ch.qos.logback.core.joran.spi                      not found
   com.jblur.acme_client                              -> ch.qos.logback.core.util                           not found
   com.jblur.acme_client                              -> com.beust.jcommander                               not found
   com.jblur.acme_client                              -> com.google.gson                                    not found
   com.jblur.acme_client                              -> com.jblur.acme_client.command                      acme-client-3.1.0.jar
   com.jblur.acme_client                              -> com.jblur.acme_client.command.certificate          acme-client-3.1.0.jar
   com.jblur.acme_client                              -> com.jblur.acme_client.command.http                 acme-client-3.1.0.jar
   com.jblur.acme_client                              -> com.jblur.acme_client.command.registration         acme-client-3.1.0.jar
   com.jblur.acme_client                              -> com.jblur.acme_client.manager                      acme-client-3.1.0.jar
   com.jblur.acme_client                              -> java.io                                            java.base
   com.jblur.acme_client                              -> java.lang                                          java.base
   com.jblur.acme_client                              -> java.lang.annotation                               java.base
   com.jblur.acme_client                              -> java.lang.reflect                                  java.base
   com.jblur.acme_client                              -> java.net                                           java.base
   com.jblur.acme_client                              -> java.nio.file                                      java.base
   com.jblur.acme_client                              -> java.nio.file.attribute                            java.base
   com.jblur.acme_client                              -> java.security                                      java.base
   com.jblur.acme_client                              -> java.security.cert                                 java.base
   com.jblur.acme_client                              -> java.util                                          java.base
   com.jblur.acme_client                              -> org.bouncycastle.asn1                              not found
   com.jblur.acme_client                              -> org.bouncycastle.asn1.pkcs                         not found
   com.jblur.acme_client                              -> org.bouncycastle.asn1.x500                         not found
   com.jblur.acme_client                              -> org.bouncycastle.asn1.x509                         not found
   com.jblur.acme_client                              -> org.bouncycastle.pkcs                              not found
   com.jblur.acme_client                              -> org.bouncycastle.pkcs.jcajce                       not found
   com.jblur.acme_client                              -> org.bouncycastle.util.io.pem                       not found
   com.jblur.acme_client                              -> org.shredzone.acme4j                               not found
   com.jblur.acme_client                              -> org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client                              -> org.shredzone.acme4j.util                          not found
   com.jblur.acme_client                              -> org.slf4j                                          not found
   com.jblur.acme_client.command                      -> com.google.gson                                    not found
   com.jblur.acme_client.command                      -> com.jblur.acme_client                              acme-client-3.1.0.jar
   com.jblur.acme_client.command                      -> com.jblur.acme_client.manager                      acme-client-3.1.0.jar
   com.jblur.acme_client.command                      -> java.io                                            java.base
   com.jblur.acme_client.command                      -> java.lang                                          java.base
   com.jblur.acme_client.command                      -> java.security                                      java.base
   com.jblur.acme_client.command                      -> org.shredzone.acme4j                               not found
   com.jblur.acme_client.command                      -> org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command                      -> org.slf4j                                          not found
   com.jblur.acme_client.command.certificate          -> com.google.gson                                    not found
   com.jblur.acme_client.command.certificate          -> com.google.gson.reflect                            not found
   com.jblur.acme_client.command.certificate          -> com.jblur.acme_client                              acme-client-3.1.0.jar
   com.jblur.acme_client.command.certificate          -> com.jblur.acme_client.command                      acme-client-3.1.0.jar
   com.jblur.acme_client.command.certificate          -> com.jblur.acme_client.manager                      acme-client-3.1.0.jar
   com.jblur.acme_client.command.certificate          -> java.io                                            java.base
   com.jblur.acme_client.command.certificate          -> java.lang                                          java.base
   com.jblur.acme_client.command.certificate          -> java.lang.invoke                                   java.base
   com.jblur.acme_client.command.certificate          -> java.lang.reflect                                  java.base
   com.jblur.acme_client.command.certificate          -> java.net                                           java.base
   com.jblur.acme_client.command.certificate          -> java.nio.file                                      java.base
   com.jblur.acme_client.command.certificate          -> java.security.cert                                 java.base
   com.jblur.acme_client.command.certificate          -> java.time                                          java.base
   com.jblur.acme_client.command.certificate          -> java.util                                          java.base
   com.jblur.acme_client.command.certificate          -> org.shredzone.acme4j                               not found
   com.jblur.acme_client.command.certificate          -> org.shredzone.acme4j.challenge                     not found
   com.jblur.acme_client.command.certificate          -> org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command.certificate          -> org.slf4j                                          not found
   com.jblur.acme_client.command.http                 -> com.google.gson                                    not found
   com.jblur.acme_client.command.http                 -> com.google.gson.reflect                            not found
   com.jblur.acme_client.command.http                 -> com.jblur.acme_client                              acme-client-3.1.0.jar
   com.jblur.acme_client.command.http                 -> com.jblur.acme_client.command                      acme-client-3.1.0.jar
   com.jblur.acme_client.command.http                 -> java.io                                            java.base
   com.jblur.acme_client.command.http                 -> java.lang                                          java.base
   com.jblur.acme_client.command.http                 -> java.lang.reflect                                  java.base
   com.jblur.acme_client.command.http                 -> java.net                                           java.base
   com.jblur.acme_client.command.http                 -> java.nio.charset                                   java.base
   com.jblur.acme_client.command.http                 -> java.nio.file                                      java.base
   com.jblur.acme_client.command.http                 -> java.time                                          java.base
   com.jblur.acme_client.command.http                 -> java.util                                          java.base
   com.jblur.acme_client.command.http                 -> org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command.http                 -> org.slf4j                                          not found
   com.jblur.acme_client.command.registration         -> com.google.gson                                    not found
   com.jblur.acme_client.command.registration         -> com.google.gson.reflect                            not found
   com.jblur.acme_client.command.registration         -> com.jblur.acme_client                              acme-client-3.1.0.jar
   com.jblur.acme_client.command.registration         -> com.jblur.acme_client.command                      acme-client-3.1.0.jar
   com.jblur.acme_client.command.registration         -> com.jblur.acme_client.manager                      acme-client-3.1.0.jar
   com.jblur.acme_client.command.registration         -> java.lang                                          java.base
   com.jblur.acme_client.command.registration         -> java.lang.reflect                                  java.base
   com.jblur.acme_client.command.registration         -> java.net                                           java.base
   com.jblur.acme_client.command.registration         -> java.util                                          java.base
   com.jblur.acme_client.command.registration         -> org.shredzone.acme4j                               not found
   com.jblur.acme_client.command.registration         -> org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command.registration         -> org.slf4j                                          not found
   com.jblur.acme_client.manager                      -> com.jblur.acme_client                              acme-client-3.1.0.jar
   com.jblur.acme_client.manager                      -> java.lang                                          java.base
   com.jblur.acme_client.manager                      -> java.net                                           java.base
   com.jblur.acme_client.manager                      -> java.security                                      java.base
   com.jblur.acme_client.manager                      -> java.security.cert                                 java.base
   com.jblur.acme_client.manager                      -> java.time                                          java.base
   com.jblur.acme_client.manager                      -> java.util                                          java.base
   com.jblur.acme_client.manager                      -> javax.crypto                                       java.base
   com.jblur.acme_client.manager                      -> org.shredzone.acme4j                               not found
   com.jblur.acme_client.manager                      -> org.shredzone.acme4j.challenge                     not found
   com.jblur.acme_client.manager                      -> org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.manager                      -> org.shredzone.acme4j.toolbox                       not found
   com.jblur.acme_client.manager                      -> org.slf4j                                          not found
darian-au commented 4 months ago

Also included is the maven dependency tree below.

$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------< acme-client:acme-client >-----------------------
[INFO] Building acme-client 3.1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ acme-client ---
[INFO] acme-client:acme-client:jar:3.1.0
[INFO] +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] |  +- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.shredzone.acme4j:acme4j-client:jar:2.16:compile
[INFO] |  \- org.bitbucket.b_c:jose4j:jar:0.9.3:compile
[INFO] +- org.shredzone.acme4j:acme4j-utils:jar:2.16:compile
[INFO] +- org.bouncycastle:bcprov-jdk18on:jar:1.76:compile
[INFO] +- org.bouncycastle:bcpkix-jdk18on:jar:1.76:compile
[INFO] |  \- org.bouncycastle:bcutil-jdk18on:jar:1.76:compile
[INFO] +- com.google.code.gson:gson:jar:2.10.1:compile
[INFO] +- com.beust:jcommander:jar:1.72:compile
[INFO] \- org.junit.jupiter:junit-jupiter:jar:5.10.0:test
[INFO]    +- org.junit.jupiter:junit-jupiter-api:jar:5.10.0:test
[INFO]    |  +- org.opentest4j:opentest4j:jar:1.3.0:test
[INFO]    |  +- org.junit.platform:junit-platform-commons:jar:1.10.0:test
[INFO]    |  \- org.apiguardian:apiguardian-api:jar:1.1.2:test
[INFO]    +- org.junit.jupiter:junit-jupiter-params:jar:5.10.0:test
[INFO]    \- org.junit.jupiter:junit-jupiter-engine:jar:5.10.0:test
[INFO]       \- org.junit.platform:junit-platform-engine:jar:1.10.0:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.181 s
[INFO] Finished at: 2024-02-26T14:19:29+11:00
[INFO] ------------------------------------------------------------------------
BillZaumen commented 4 months ago

Hi Darian,

When I ran the command you used, I got the same result, but I also ran jdeps on the jar files in lib, with all of those jar files on the class path. In that case, I got a couple of stack traces and some error messages about split packages, but also a list of additional java modules such as java.naming, java.xml, and java.sql (possibly for a date-related class).

When I tried to use acme_client.jar, with a custom JRE, I had to add those additional modules to get it to work. I'll have to test it with your version as a next step.

Thanks again.

Regards,

Bill

On Sun, 2024-02-25 at 18:52 -0800, Darian wrote:

Hi Bill,

I’m unsure why it's not working for you, I tried again on both my Mac and on another Ubuntu host and copied the results below.

Cheers, Darian

$ java -version
openjdk version "11.0.21" 2023-10-17
OpenJDK Runtime Environment (build 11.0.21+9-post-Ubuntu-
0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.21+9-post-Ubuntu-0ubuntu122.04,
mixed mode, sharing)

$ java -version
openjdk version "11.0.17" 2022-10-18
OpenJDK Runtime Environment Temurin-11.0.17+8 (build 11.0.17+8)
OpenJDK 64-Bit Server VM Temurin-11.0.17+8 (build 11.0.17+8, mixed
mode)

$ jdeps acme-client-3.1.0.jar 
acme-client-3.1.0.jar -> java.base
acme-client-3.1.0.jar -> not found
   com.jblur.acme_client                              ->
ch.qos.logback.classic                             not found
   com.jblur.acme_client                              ->
ch.qos.logback.classic.joran                       not found
   com.jblur.acme_client                              ->
ch.qos.logback.core                                not found
   com.jblur.acme_client                              ->
ch.qos.logback.core.joran.spi                      not found
   com.jblur.acme_client                              ->
ch.qos.logback.core.util                           not found
   com.jblur.acme_client                              ->
com.beust.jcommander                               not found
   com.jblur.acme_client                              ->
com.google.gson                                    not found
   com.jblur.acme_client                              ->
com.jblur.acme_client.command                      acme-client-
3.1.0.jar
   com.jblur.acme_client                              ->
com.jblur.acme_client.command.certificate          acme-client-
3.1.0.jar
   com.jblur.acme_client                              ->
com.jblur.acme_client.command.http                 acme-client-
3.1.0.jar
   com.jblur.acme_client                              ->
com.jblur.acme_client.command.registration         acme-client-
3.1.0.jar
   com.jblur.acme_client                              ->
com.jblur.acme_client.manager                      acme-client-
3.1.0.jar
   com.jblur.acme_client                              ->
java.io                                            java.base
   com.jblur.acme_client                              ->
java.lang                                          java.base
   com.jblur.acme_client                              ->
java.lang.annotation                               java.base
   com.jblur.acme_client                              ->
java.lang.reflect                                  java.base
   com.jblur.acme_client                              ->
java.net                                           java.base
   com.jblur.acme_client                              ->
java.nio.file                                      java.base
   com.jblur.acme_client                              ->
java.nio.file.attribute                            java.base
   com.jblur.acme_client                              ->
java.security                                      java.base
   com.jblur.acme_client                              ->
java.security.cert                                 java.base
   com.jblur.acme_client                              ->
java.util                                          java.base
   com.jblur.acme_client                              ->
org.bouncycastle.asn1                              not found
   com.jblur.acme_client                              ->
org.bouncycastle.asn1.pkcs                         not found
   com.jblur.acme_client                              ->
org.bouncycastle.asn1.x500                         not found
   com.jblur.acme_client                              ->
org.bouncycastle.asn1.x509                         not found
   com.jblur.acme_client                              ->
org.bouncycastle.pkcs                              not found
   com.jblur.acme_client                              ->
org.bouncycastle.pkcs.jcajce                       not found
   com.jblur.acme_client                              ->
org.bouncycastle.util.io.pem                       not found
   com.jblur.acme_client                              ->
org.shredzone.acme4j                               not found
   com.jblur.acme_client                              ->
org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client                              ->
org.shredzone.acme4j.util                          not found
   com.jblur.acme_client                              ->
org.slf4j                                          not found
   com.jblur.acme_client.command                      ->
com.google.gson                                    not found
   com.jblur.acme_client.command                      ->
com.jblur.acme_client                              acme-client-
3.1.0.jar
   com.jblur.acme_client.command                      ->
com.jblur.acme_client.manager                      acme-client-
3.1.0.jar
   com.jblur.acme_client.command                      ->
java.io                                            java.base
   com.jblur.acme_client.command                      ->
java.lang                                          java.base
   com.jblur.acme_client.command                      ->
java.security                                      java.base
   com.jblur.acme_client.command                      ->
org.shredzone.acme4j                               not found
   com.jblur.acme_client.command                      ->
org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command                      ->
org.slf4j                                          not found
   com.jblur.acme_client.command.certificate          ->
com.google.gson                                    not found
   com.jblur.acme_client.command.certificate          ->
com.google.gson.reflect                            not found
   com.jblur.acme_client.command.certificate          ->
com.jblur.acme_client                              acme-client-
3.1.0.jar
   com.jblur.acme_client.command.certificate          ->
com.jblur.acme_client.command                      acme-client-
3.1.0.jar
   com.jblur.acme_client.command.certificate          ->
com.jblur.acme_client.manager                      acme-client-
3.1.0.jar
   com.jblur.acme_client.command.certificate          ->
java.io                                            java.base
   com.jblur.acme_client.command.certificate          ->
java.lang                                          java.base
   com.jblur.acme_client.command.certificate          ->
java.lang.invoke                                   java.base
   com.jblur.acme_client.command.certificate          ->
java.lang.reflect                                  java.base
   com.jblur.acme_client.command.certificate          ->
java.net                                           java.base
   com.jblur.acme_client.command.certificate          ->
java.nio.file                                      java.base
   com.jblur.acme_client.command.certificate          ->
java.security.cert                                 java.base
   com.jblur.acme_client.command.certificate          ->
java.time                                          java.base
   com.jblur.acme_client.command.certificate          ->
java.util                                          java.base
   com.jblur.acme_client.command.certificate          ->
org.shredzone.acme4j                               not found
   com.jblur.acme_client.command.certificate          ->
org.shredzone.acme4j.challenge                     not found
   com.jblur.acme_client.command.certificate          ->
org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command.certificate          ->
org.slf4j                                          not found
   com.jblur.acme_client.command.http                 ->
com.google.gson                                    not found
   com.jblur.acme_client.command.http                 ->
com.google.gson.reflect                            not found
   com.jblur.acme_client.command.http                 ->
com.jblur.acme_client                              acme-client-
3.1.0.jar
   com.jblur.acme_client.command.http                 ->
com.jblur.acme_client.command                      acme-client-
3.1.0.jar
   com.jblur.acme_client.command.http                 ->
java.io                                            java.base
   com.jblur.acme_client.command.http                 ->
java.lang                                          java.base
   com.jblur.acme_client.command.http                 ->
java.lang.reflect                                  java.base
   com.jblur.acme_client.command.http                 ->
java.net                                           java.base
   com.jblur.acme_client.command.http                 ->
java.nio.charset                                   java.base
   com.jblur.acme_client.command.http                 ->
java.nio.file                                      java.base
   com.jblur.acme_client.command.http                 ->
java.time                                          java.base
   com.jblur.acme_client.command.http                 ->
java.util                                          java.base
   com.jblur.acme_client.command.http                 ->
org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command.http                 ->
org.slf4j                                          not found
   com.jblur.acme_client.command.registration         ->
com.google.gson                                    not found
   com.jblur.acme_client.command.registration         ->
com.google.gson.reflect                            not found
   com.jblur.acme_client.command.registration         ->
com.jblur.acme_client                              acme-client-
3.1.0.jar
   com.jblur.acme_client.command.registration         ->
com.jblur.acme_client.command                      acme-client-
3.1.0.jar
   com.jblur.acme_client.command.registration         ->
com.jblur.acme_client.manager                      acme-client-
3.1.0.jar
   com.jblur.acme_client.command.registration         ->
java.lang                                          java.base
   com.jblur.acme_client.command.registration         ->
java.lang.reflect                                  java.base
   com.jblur.acme_client.command.registration         ->
java.net                                           java.base
   com.jblur.acme_client.command.registration         ->
java.util                                          java.base
   com.jblur.acme_client.command.registration         ->
org.shredzone.acme4j                               not found
   com.jblur.acme_client.command.registration         ->
org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.command.registration         ->
org.slf4j                                          not found
   com.jblur.acme_client.manager                      ->
com.jblur.acme_client                              acme-client-
3.1.0.jar
   com.jblur.acme_client.manager                      ->
java.lang                                          java.base
   com.jblur.acme_client.manager                      ->
java.net                                           java.base
   com.jblur.acme_client.manager                      ->
java.security                                      java.base
   com.jblur.acme_client.manager                      ->
java.security.cert                                 java.base
   com.jblur.acme_client.manager                      ->
java.time                                          java.base
   com.jblur.acme_client.manager                      ->
java.util                                          java.base
   com.jblur.acme_client.manager                      ->
javax.crypto                                       java.base
   com.jblur.acme_client.manager                      ->
org.shredzone.acme4j                               not found
   com.jblur.acme_client.manager                      ->
org.shredzone.acme4j.challenge                     not found
   com.jblur.acme_client.manager                      ->
org.shredzone.acme4j.exception                     not found
   com.jblur.acme_client.manager                      ->
org.shredzone.acme4j.toolbox                       not found
   com.jblur.acme_client.manager                      ->
org.slf4j                                          not found