title: /BOOT-INF/classes (No such file or directory) on spring boot java project
body: <p>In attempts to make a standalone JAR that I can launch cleanly and independently, I've ran into issues involving Jersey and my desirable, fat JAR. The final jar will be moved to a Docker image.</p>
  
  <p>The error that I am getting is essentially this:</p>
  
  <pre><code>Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.glassfish.jersey.server.ResourceConfig]: Factory method 'jerseyResourceConfig' threw exception; nested exception is org.glassfish.jersey.server.internal.scanning.ResourceFinderException: java.io.FileNotFoundException: /dir/myproject-1.0.0-SNAPSHOT.jar!/BOOT-INF/classes (No such file or directory)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
      ... 48 common frames omitted
  Caused by: org.glassfish.jersey.server.internal.scanning.ResourceFinderException: java.io.FileNotFoundException: /dir/myproject/target/myproject-1.0.0-SNAPSHOT.jar!/BOOT-INF/classes (No such file or directory)
      at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.create(JarZipSchemeResourceFinderFactory.java:89)
      at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.create(JarZipSchemeResourceFinderFactory.java:65)
      at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.addResourceFinder(PackageNamesScanner.java:282)
      at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.init(PackageNamesScanner.java:198)
      at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.&lt;init&gt;(PackageNamesScanner.java:154)
      at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.&lt;init&gt;(PackageNamesScanner.java:110)
      at org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:680)
      at org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:660)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
      ... 49 common frames omitted
  Caused by: java.io.FileNotFoundException: /dir/myproject/target/myproject-1.0.0-SNAPSHOT.jar!/BOOT-INF/classes (No such file or directory)
  </code></pre>
  
  <p>Here is my build profile in my POM file:</p>
  
  <pre><code>&lt;profile&gt;
      &lt;id&gt;d2&lt;/id&gt;
      &lt;activation&gt;
          &lt;activeByDefault&gt;false&lt;/activeByDefault&gt;
      &lt;/activation&gt;
      &lt;properties&gt;
          &lt;packaging.type&gt;jar&lt;/packaging.type&gt;
          &lt;log.dir&gt;logs&lt;/log.dir&gt;
          &lt;!-- updates bootstrap.properties --&gt;
          &lt;config.override.path&gt;./conf&lt;/config.override.path&gt;
      &lt;/properties&gt;
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;requiresUnpack&gt;
                          &lt;dependency&gt;
                              &lt;groupId&gt;my.com&lt;/groupId&gt;
                              &lt;artifactId&gt;myArtifact&lt;/artifactId&gt;
                          &lt;/dependency&gt;
                      &lt;/requiresUnpack&gt;
                  &lt;/configuration&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;repackage&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  &lt;/profile&gt;
  </code></pre>
  
  <p>Finally, here are all of the jersey dependencies that I am using:</p>
  
  <pre><code>org.springframework.boot:spring-boot-starter-jersey:jar:1.5.12.RELEASE:compile
  |  |  +- org.glassfish.jersey.core:jersey-server:jar:2.25.1:compile
  |  |  |  +- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile
  |  |  |  +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.25.1:compile
  |  |  +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.25.1:compile
  |  |  +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.25.1:compile
  |  |  +- org.glassfish.jersey.ext:jersey-spring3:jar:2.25.1:compile
  |  |  \- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.25.1:compile
  |  |     +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.25.1:compile
  ................................................................................
  |     |  +- org.glassfish.jersey.connectors:jersey-apache-connector:jar:2.17:compile
  ................................................................................
  |  \- io.swagger:swagger-jersey2-jaxrs:jar:1.5.6:compile
  |     +- org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.25.1:compile
  |     |  +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32:compile
  |     |  \- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile
  |     |     +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile
  |     \- org.glassfish.jersey.media:jersey-media-multipart:jar:2.25.1:compile
  </code></pre>
  
  <p>I've read through all of the sources that are referenced from this <a href="https://stackoverflow.com/questions/42194680/spring-boot-application-wont-run-when-trying-to-run-from-the-jar-file?utm_medium=organic&amp;utm_source=google_rich_qa&amp;utm_campaign=google_rich_qa">SO question</a>. I was led through a few github issues that both Spring and Jersey have apparently fixed, yet I am still dealing with these complications. 
  The unique thing about my complication is that the boot-inf/classes that are not found is directly inside my jar and referencing the project itself. Its not complaining about a different, depended on jar, its complaining about the project's own /BOOT-INF/classes.</p>
  
  <p>Any additional insight not mentioned in the aforementioned SO question would be extremely useful! I find that Java is incredibly more difficult to work with in Docker than any other stack that I've experienced (python-django and node-js). Let me know if more information is desired.</p>