title: JDEPS Module Not Found Exception when listing dependancies
body: <p>I have been working with JLink to create minimal JRE for various Spring Boot applications. I have successfully done this manually by figuring out the required Modules via trial and error. After successfully doing this I have been attempting to automate this process using JDeps.</p>
  <p>First attempt was to scan the built Jar for my application. I am using Java 14 jdeps to analyze a Java 11 codebase.</p>
  <p><code>jdeps --class-path BOOT-INF/classes --module-path BOOT-INF/lib/,${JAVA_HOME}/jmods --add-modules=ALL-MODULE-PATH --list-deps  target/camel-account-sapi-0.0.2-SNAPSHOT.jar</code></p>
  <p>Which results in several not found dependencies.</p>
  <pre><code>Error: Missing dependencies: classes not found from the module path and classpath.
  To suppress this error, use --ignore-missing-deps to continue.
  
  camel-account-sapi-0.0.2-SNAPSHOT.jar
     com.ms3.camelaccountsapi.CamelAccountSapiApplication -&gt; org.springframework.boot.SpringApplication         not found
     com.ms3.camelaccountsapi.CamelAccountSapiApplication -&gt; org.springframework.boot.autoconfigure.SpringBootApplication not found
     com.ms3.camelaccountsapi.CamelAccountSapiApplication -&gt; org.springframework.context.ConfigurableApplicationContext not found
     com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -&gt; org.apache.camel.builder.RouteBuilder              not found
     com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -&gt; org.apache.camel.model.rest.RestDefinition         not found
     com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -&gt; org.apache.camel.model.rest.RestOperationParamDefinition not found
     com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -&gt; org.apache.camel.model.rest.RestParamType          not found
     com.ms3.camelaccountsapi.routes.GeneratedRoutesInterface -&gt; org.springframework.stereotype.Component           not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; com.datasonnet.document.MediaTypes                 not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.Exchange                          not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.Expression                        not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.LoggingLevel                      not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.Predicate                         not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.builder.DatasonnetBuilder         not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.builder.RouteBuilder              not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.builder.SimpleBuilder             not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.builder.ValueBuilder              not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.model.ChoiceDefinition            not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.model.OnExceptionDefinition       not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.model.ProcessorDefinition         not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.apache.camel.model.RouteDefinition             not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.slf4j.Logger                                   not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.slf4j.LoggerFactory                            not found
     com.ms3.camelaccountsapi.routes.RoutesImplementation -&gt; org.springframework.stereotype.Component           not found
     org.springframework.boot.loader.PropertiesLauncher -&gt; org.springframework.util.Assert                    not found
     org.springframework.boot.loader.jarmode.JarModeLauncher -&gt; org.springframework.core.io.support.SpringFactoriesLoader not found
     org.springframework.boot.loader.jarmode.JarModeLauncher -&gt; org.springframework.util.ClassUtils                not found
  </code></pre>
  <p>Adding <code>--ignore-missing-deps</code> results in something more meaning full but incomplete:</p>
  <pre><code>java.base
  java.logging
  </code></pre>
  <p>Next I extracted the applications using <code>java -Djarmode=layertools -jar ./target/camel-account-sapi-0.0.2-SNAPSHOT.jar extract</code></p>
  <p>This gives me the BOOT-INF/lib folder containing all 150 of the JAR dependancies. So I attempted to run a similar JDeps command as before with a few extra options:
  <code>jdeps --module-path temp/BOOT-INF/lib/,${JAVA_HOME}/jmods --add-modules=ALL-MODULE-PATH --multi-release 11 --list-deps --ignore-missing-deps --recursive --compile-time  temp/BOOT-INF/lib/*</code></p>
  <p>This however results in an Exception</p>
  <pre><code>Exception in thread &quot;main&quot; java.lang.module.FindException: Module java.annotation not found, required by org.apache.tomcat.embed.core
      at java.base/java.lang.module.Resolver.findFail(Resolver.java:894)
      at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
      at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
      at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
      at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
      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)
  </code></pre>
  <p>I noticed that some of the JARs in the /lib folder could successfully be analyzed so I wrote a Bash script to run the same command on each of the /lib jars while ignoring exceptions. 15 of the 150 fail to be analyzed due to <code>Module not found</code> however the resulting list of required Modules from the other 135 is quite close. It is only missing one required Module <code>jdk.crypto.ec</code> and found all others:</p>
  <p><code>java.sql,java.security.jgss,java.logging,java.xml,java.compiler,jdk.unsupported,java.transaction.xa,java.rmi,java.management,java.instrument,java.naming,java.base,java.datatransfer,jdk.httpserver,java.scripting,java.desktop,java.prefs</code></p>
  <p>Am I going in the wrong direction? Or what could/should be done to resolved these missing Module issues? I believe, for example that the &quot;Missing&quot; module above <code>java.annotation</code> may exist in one of the other JARs? I believe this to be the case even more so due to a few of the other 15 failed jdeps commands.</p>
  <pre><code>temp/BOOT-INF/lib/tomcat-embed-core-9.0.38.jar
  Exception in thread &quot;main&quot; java.lang.module.FindException: Module java.annotation not found, required by org.apache.tomcat.embed.core
      at java.base/java.lang.module.Resolver.findFail(Resolver.java:894)
      at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
      at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
      at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
      at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
      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)
  error
  temp/BOOT-INF/lib/tomcat-embed-websocket-9.0.38.jar
  Exception in thread &quot;main&quot; java.lang.module.FindException: Module org.apache.tomcat.embed.core not found, required by org.apache.tomcat.embed.websocket
      at java.base/java.lang.module.Resolver.findFail(Resolver.java:894)
      at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
      at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
      at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
      at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
      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)
  error
  </code></pre>