Распаковка трикотажных библиотек в весенней загрузочной банке - PullRequest
0 голосов
/ 02 мая 2019

У меня есть весенняя загрузка проекта с зависимостью от джерси:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jersey</artifactId>
</dependency>

Когда я делаю spring-boot:run, весь контекст становится идеальным, и все работает.

Проблема возникает, когда я делаю упаковку этого проекта с mvn package, потому что requiresUnpack не распаковывает зависимости джерси. И это необходимо для этой проблемы: https://github.com/spring-projects/spring-boot/issues/1468

Внутри pom.xml я использую:

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <requiresUnpack>
                    <!-- dependencies that I want to unpack -->
                    </requiresUnpack>
                </configuration>
            </plugin>
        </plugins>          
    </build>

Тогда, когда я сделаю java -jar jarBoot.jar, вывод консоли будет:

2019-05-02 15:02:46.218 ERROR 17476 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : StandardWrapper.Throwable

org.glassfish.hk2.api.MultiException: A MultiException has 1 exceptions.  They are:
1. org.glassfish.jersey.server.internal.scanning.ResourceFinderException: java.io.FileNotFoundException: C:\Users\Francesc\microservices git\sidecar-base\target\sidecar-base-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes (El sistema no puede encontrar la ruta especificada)

        at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1009) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:975) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1067) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1059) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:385) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:342) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392) ~[jersey-container-servlet-core-2.25.1.jar!/:na]
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177) ~[jersey-container-servlet-core-2.25.1.jar!/:na]
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369) ~[jersey-container-servlet-core-2.25.1.jar!/:na]
        at javax.servlet.GenericServlet.init(GenericServlet.java:158) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913) [tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:78) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:264) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:187) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) [spring-context-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at com.micro.base.sidecarbase.SidecarApplication.main(SidecarApplication.java:13) [classes!/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_112]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_112]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_112]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
Caused by: org.glassfish.jersey.server.internal.scanning.ResourceFinderException: java.io.FileNotFoundException: C:\Users\Francesc\microservices git\sidecar-base\target\sidecar-base-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes (El sistema no puede encontrar la ruta especificada)
        at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.create(JarZipSchemeResourceFinderFactory.java:89) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.create(JarZipSchemeResourceFinderFactory.java:65) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.addResourceFinder(PackageNamesScanner.java:282) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.init(PackageNamesScanner.java:198) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.<init>(PackageNamesScanner.java:154) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.<init>(PackageNamesScanner.java:110) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:680) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:660) ~[jersey-server-2.25.1.jar!/:na]
        at com.micro.base.sidecarbase.RestResourceApplication.<init>(RestResourceApplication.java:16) ~[classes!/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_112]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_112]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_112]
        at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.8.0_112]
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1375) ~[hk2-utils-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1007) ~[hk2-locator-2.5.0-b32.jar!/:na]
        ... 33 common frames omitted
Caused by: java.io.FileNotFoundException: C:\Users\Francesc\microservices git\sidecar-base\target\sidecar-base-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes (El sistema no puede encontrar la ruta especificada)
        at java.io.FileInputStream.open0(Native Method) ~[na:1.8.0_112]
        at java.io.FileInputStream.open(Unknown Source) ~[na:1.8.0_112]
        at java.io.FileInputStream.<init>(Unknown Source) ~[na:1.8.0_112]
        at java.io.FileInputStream.<init>(Unknown Source) ~[na:1.8.0_112]
        at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source) ~[na:1.8.0_112]
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source) ~[na:1.8.0_112]
        at java.net.URL.openStream(Unknown Source) ~[na:1.8.0_112]
        at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.getInputStream(JarZipSchemeResourceFinderFactory.java:177) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.create(JarZipSchemeResourceFinderFactory.java:87) ~[jersey-server-2.25.1.jar!/:na]
        ... 47 common frames omitted

2019-05-02 15:02:46.219 ERROR 17476 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Servlet [jersey-servlet] in web application [] threw load() exception

java.io.FileNotFoundException: C:\Users\Francesc\microservices git\sidecar-base\target\sidecar-base-0.0.1-SNAPSHOT.jar!\BOOT-INF\classes (El sistema no puede encontrar la ruta especificada)
        at java.io.FileInputStream.open0(Native Method) ~[na:1.8.0_112]
        at java.io.FileInputStream.open(Unknown Source) ~[na:1.8.0_112]
        at java.io.FileInputStream.<init>(Unknown Source) ~[na:1.8.0_112]
        at java.io.FileInputStream.<init>(Unknown Source) ~[na:1.8.0_112]
        at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source) ~[na:1.8.0_112]
        at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source) ~[na:1.8.0_112]
        at java.net.URL.openStream(Unknown Source) ~[na:1.8.0_112]
        at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.getInputStream(JarZipSchemeResourceFinderFactory.java:177) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.create(JarZipSchemeResourceFinderFactory.java:87) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory.create(JarZipSchemeResourceFinderFactory.java:65) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.addResourceFinder(PackageNamesScanner.java:282) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.init(PackageNamesScanner.java:198) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.<init>(PackageNamesScanner.java:154) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.internal.scanning.PackageNamesScanner.<init>(PackageNamesScanner.java:110) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:680) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.ResourceConfig.packages(ResourceConfig.java:660) ~[jersey-server-2.25.1.jar!/:na]
        at com.micro.base.sidecarbase.RestResourceApplication.<init>(RestResourceApplication.java:16) ~[classes!/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_112]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_112]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:1.8.0_112]
        at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:1.8.0_112]
        at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1375) ~[hk2-utils-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1007) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:975) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1067) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1059) ~[hk2-locator-2.5.0-b32.jar!/:na]
        at org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:385) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:342) ~[jersey-server-2.25.1.jar!/:na]
        at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392) ~[jersey-container-servlet-core-2.25.1.jar!/:na]
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177) ~[jersey-container-servlet-core-2.25.1.jar!/:na]
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369) ~[jersey-container-servlet-core-2.25.1.jar!/:na]
        at javax.servlet.GenericServlet.init(GenericServlet.java:158) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1183) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4913) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:78) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.startConnector(TomcatEmbeddedServletContainer.java:264) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:187) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) [spring-context-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.0.RELEASE.jar!/:1.5.0.RELEASE]
        at com.micro.base.sidecarbase.SidecarApplication.main(SidecarApplication.java:13) [classes!/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_112]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_112]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_112]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [sidecar-base-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]

Кто-нибудь знает, как правильно распаковать эти банки, и у этого джерси не возникнет проблем при их сканировании?

...