简体   繁体   English

作为Maven插件运行的Spring Boot可以运行,但是作为打包的应用程序失败

[英]Spring Boot running as maven plugin works, but fails as packaged application

I'm trying to run a Spring Boot app that uses Jersey. 我正在尝试运行一个使用Jersey的Spring Boot应用程序。 When running with 'mvn spring-boot:run' it starts up and works fine. 当使用'mvn spring-boot:run'运行时,它会启动并正常运行。

However, when I run as a packaged application ('java -jar ...') I get a FileNotFoundException that looks like: 但是,当我作为打包的应用程序运行时(“ java -jar ...”),我得到一个FileNotFoundException,看起来像:

Caused by: java.io.FileNotFoundException: /.../appsensor-ws-rest-server-boot/target/appsensor-ws-rest-server-boot-0.0.1-SNAPSHOT.jar!/lib/appsensor-ws-rest-server-2.2.0-SNAPSHOT.jar (No such file or directory)

When I look at the generated jar via 当我通过查看生成的罐子时

jar -tf target/appsensor-ws-rest-server-boot-0.0.1-SNAPSHOT.jar | grep ws-rest-server

, I get: ,我得到:

lib/appsensor-ws-rest-server-2.2.0-SNAPSHOT.jar

So the file appears to be there. 因此该文件似乎在那里。 Thoughts? 思考?

Actually found an answer after a bit more looking, and leaving this for others who might have the same problem. 经过多看,实际上找到了答案,然后将其留给可能有相同问题的其他人解决。

This resource had the right answer: http://midgetontoes.com/blog/2015/04/13/filenotfoundexception-when-using-jersey-with-spring-boot 此资源具有正确的答案: http : //midgetontoes.com/blog/2015/04/13/filenotfoundexception-when-using-jersey-with-spring-boot

Essentially, you have to modify the configuration of the spring-boot-maven-plugin in some cases and add the requiresUnpack element for any dependent jars that require unpacking. 本质上,在某些情况下,您必须修改spring-boot-maven-plugin的配置,并为需要解压缩的所有依赖jar添加requireUnpack元素。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 由 maven 插件打包的 Spring 引导应用程序不起作用,在 IDE 中工作 - Spring boot application packaged by maven plugin not working, works in IDE 运行使用带有Spring依赖项的Maven插件打包的可运行Jar的问题 - Issue running runnable Jar packaged using Maven plugin with Spring dependencies Spring DevTools 未包含在 spring-boot-maven-plugin 打包的 fat jar 中 - Spring DevTools not included in the fat jar packaged with spring-boot-maven-plugin Spring Boot AngularJs应用程序:使用wro4j-maven-plugin生成angular-bootstrap.css失败 - Spring Boot AngularJs Application: angular-bootstrap.css generation using wro4j-maven-plugin Fails 运行Spring Boot应用程序时,Maven无法启动嵌入式Tomcat容器 - Maven fails to start embedded Tomcat container when running Spring Boot application maven-cargo2-plugin 如何识别我的 Spring 引导应用程序已经有嵌入式 Tomcat 正在运行? - How can maven-cargo2-plugin recognize that my Spring Boot application already has an embedded Tomcat running? 在 spring-boot-maven-plugin 打包的 jar 中使用 ClassPath.getTopLevelClasses() 查找类 - Finding classes with ClassPath.getTopLevelClasses() in jar packaged by spring-boot-maven-plugin Spring 启动应用程序与 IntelliJ 一起工作,但是在与 gradle bootRun 一起运行时失败并出现 NoSuchMethodError - Spring boot application works with IntelliJ, however fails with NoSuchMethodError while running with gradle bootRun 使用Maven EAR打包的GWT应用程序运行SuperDevMode - Running SuperDevMode with a Maven EAR packaged GWT application 打包的Spring Boot应用程序的相对路径在哪里 - Where is the relative path to a packaged Spring Boot application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM