Spring Boot 1.4到1.5,无法部署

时间:2017-04-28 13:37:39

标签: maven spring-boot spring-boot-maven-plugin gmavenplus

我有一个非常大且工作正常的Spring Boot项目,可以通过Boot 1.4.2运行。当我尝试升级到1.5.3时,它可以从我的IDE(Intellij Idea)中运行,但它不适用于部署。这是一个Maven项目,所以我使用"包"生成WAR文件的指令,我在部署时得到错误。从我所看到的,它说WAR上缺少一些东西,但我甚至检查了它,文件在那里......有什么想法吗?

Caused by: java.io.FileNotFoundException: file:(...)/target/ultraip-intranet-2.0-RELEASE.war*/WEB-INF/classes/com/ultraip/intranet/entities (No such file or directory)
    at java.util.zip.ZipFile.open(Native Method) ~[na:1.8.0_131]
    at java.util.zip.ZipFile.<init>(ZipFile.java:219) ~[na:1.8.0_131]
    at java.util.zip.ZipFile.<init>(ZipFile.java:149) ~[na:1.8.0_131]
    at java.util.jar.JarFile.<init>(JarFile.java:166) ~[na:1.8.0_131]
    at java.util.jar.JarFile.<init>(JarFile.java:103) ~[na:1.8.0_131]
    at org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingJarResources(PathMatchingResourcePatternResolver.java:593) ~[spring-core-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
    at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:475) ~[spring-core-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
    at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:279) ~[spring-core-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
    at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.buildDefaultPersistenceUnitInfo(DefaultPersistenceUnitManager.java:525) ~[spring-orm-4.3.8.RELEASE.jar!/:4.3.8.RELEASE]
    ... 105 common frames omitted

生成的WAR文件的屏幕截图 http://imgur.com/a/5aORQ

1 个答案:

答案 0 :(得分:2)

在Tomcat中进行了更改,现在它使用*作为war:file:网址中的分隔符。这破坏了Spring Framework的资源解析,其中*被错误地解释为通配符。

问题应该是fixed in Spring Framework 4.3.8,它在Spring Boot 1.5.3中使用,但似乎你找到了一个未被考虑的案例。你能否用一个小样本打开Spring Boot问题来重现问题?

将应用程序打包为jar文件时没有看到问题,因为这会阻止Tomcat为资源生成war:file: URL。