Jenkins 部署时出错:java.io.IOException:无法打开根 Jar 文件 'war:file:/apps/MYBOOTApp.jar*/BOOT-INF/lib/spring-webmvc-6.1.8.jar'

问题描述 投票:0回答:1

仅在通过 Jenkins 部署时出现以下错误。

应用程序在本地运行良好 最近升级到 springboot 3.3.0 , JDK 17 Jenkins 构建成功但部署失败 检查了 spring-webmvc-6.1.8.jar 它存在于 MYBOOTApp.jar

INFO: Starting Servlet engine: [Apache Tomcat/10.1.24]
Jun 30, 2024 6:04:02 AM org.apache.tomcat.util.scan.StandardJarScanner processURLs
WARNING: Failed to scan [jar:file:/apps/MYBOOTApp.jar!/BOOT-INF/lib/**spring-webmvc-6.1.8.jar**!/] from classloader hierarchy
java.io.IOException: Unable to open root Jar file 'war:file:/apps/MYBOOTApp.jar*/BOOT-INF/lib/spring-webmvc-6.1.8.jar'
    at org.springframework.boot.loader.jar.Handler.getRootJarFile(Handler.java:316)
    at org.springframework.boot.loader.jar.Handler.getRootJarFileFromUrl(Handler.java:298)
    at org.springframework.boot.loader.jar.Handler.openConnection(Handler.java:84)
    at java.base/java.net.URL.openConnection(URL.java:1094)
    at java.base/java.net.URL.openStream(URL.java:1161)
    at org.apache.tomcat.util.descriptor.tld.TldResourcePath.openStream(TldResourcePath.java:127)
    at org.apache.tomcat.util.descriptor.tld.TldParser.parse(TldParser.java:62)
    at org.apache.jasper.servlet.TldScanner.parseTld(TldScanner.java:275)
    at org.apache.jasper.servlet.TldScanner$TldScannerCallback.scan(TldScanner.java:315)
    at org.apache.tomcat.util.scan.StandardJarScanner.process(StandardJarScanner.java:401)
    at org.apache.tomcat.util.scan.StandardJarScanner.processURLs(StandardJarScanner.java:332)
    at org.apache.tomcat.util.scan.StandardJarScanner.doScanClassPath(StandardJarScanner.java:275)
    at org.apache.tomcat.util.scan.StandardJarScanner.scan(StandardJarScanner.java:238)
    at org.apache.jasper.servlet.TldScanner.scanJars(TldScanner.java:262)
    at org.apache.jasper.servlet.TldScanner.scan(TldScanner.java:104)
    at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:83)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4414)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:772)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:203)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:415)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:874)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:437)
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:128)
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:107)
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:516)
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:222)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:188)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:618)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
    at com.MYBOOTApp.application.Application.main(Application.java:26)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:51)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
Caused by: java.lang.IllegalStateException: Not a file URL
    at org.springframework.boot.loader.jar.Handler.getRootJarFile(Handler.java:304)
    ... 58 more

应用程序在本地运行良好 最近升级到springboot 3.3.0 Jenkins 构建成功但部署失败 检查了 spring-webmvc-6.1.8.jar 它存在于 MYBOOTApp.jar

想了解问题是什么,Springboot 升级到 2.5.6 解决了类似的问题。 但我用的是3.3.0.

spring-boot spring-mvc jenkins deployment pom.xml
1个回答
0
投票

我认为这里“无法打开根 Jar 文件 'war:file:/apps” 是关键 但我还是不明白 我在springboot3.3.3和jdk21中遇到了同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.