[英]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.