0

I have a very large and working Spring Boot project that is running OK with Boot 1.4.2. When I try to upgrade to 1.5.3 it works from my IDE (Intellij Idea) but it does not work on deployment. It's a Maven project, so I use the "package" directive to generate a WAR file and I get the error bellow on deployment. From what I can see, it says something is missing on the WAR but I even inspected it and the files are there... Any ideas?

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

Screenshot of the generated WAR file https://i.stack.imgur.com/Dpq9e.jpg

Marcelus Trojahn
  • 689
  • 8
  • 25
  • For some reason, changing the pom.xml to create a JAR instead of a WAR worked. All files are found and the project boots. I remember the project was changed to WAR because of deployment problems as well. I'm keeping the question open so maybe someone can come up with a reason for this. – Marcelus Trojahn Apr 28 '17 at 14:01
  • You cannot deploy a jar to a server (if with deployment you mean drop it in a servlet container). Show your pom in your question. – M. Deinum Apr 28 '17 at 14:13

1 Answers1

2

A change was made in Tomcat such that it now uses a * as the separator in war:file: URLs. This broke Spring Framework's resource resolution where the * was incorrectly interpreted as a wildcard.

The problem should have been been fixed in Spring Framework 4.3.8 which is used in Spring Boot 1.5.3 but it appears that you have found a case that wasn't considered. Can you please open a Spring Boot issue with a small sample that reproduces the problem?

You don't see the problem when you package your application as a jar file as that stops Tomcat from producing war:file: URLs for resources.

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242
  • Hello, thanks for the answer and my problem seems to be exactly what you describe. I tried to create a sample using Initializr but it worked for some reason... I can't reproduce the problem on a new project and the original one is too large to take a sample from... I don't know how I contribute to solve this, unfortunately. – Marcelus Trojahn May 02 '17 at 16:33