Skip to content

Classpath wildcards cannot be used with Java 11 or above #21312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
artyomkorzun opened this issue May 5, 2020 · 0 comments
Closed

Classpath wildcards cannot be used with Java 11 or above #21312

artyomkorzun opened this issue May 5, 2020 · 0 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@artyomkorzun
Copy link

OS: Windows 10
Java: AdoptOpenJDK (build 11.0.6+10 on 2020-01-14)
Spring Boot: 2.2.6
Tomcat: 9.0.31
Stacktrace:

java.nio.file.InvalidPathException: Illegal char <*> at index 42: c:\Temp\Projects\testt\distrib\lib\custom\*
	at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
	at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
	at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
	at sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
	at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
	at java.io.File.toPath(File.java:2290)
	at java.util.zip.ZipFile$Source.get(ZipFile.java:1222)
	at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:726)
	at java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:843)
	at java.util.zip.ZipFile.<init>(ZipFile.java:246)
	at java.util.zip.ZipFile.<init>(ZipFile.java:176)
	at java.util.jar.JarFile.<init>(JarFile.java:346)
	at java.util.jar.JarFile.<init>(JarFile.java:317)
	at java.util.jar.JarFile.<init>(JarFile.java:283)
	at org.springframework.boot.web.servlet.server.StaticResourceJars.isResourcesJar(StaticResourceJars.java:125)
	at org.springframework.boot.web.servlet.server.StaticResourceJars.addUrlFile(StaticResourceJars.java:103)
	at org.springframework.boot.web.servlet.server.StaticResourceJars.addUrl(StaticResourceJars.java:90)
	at org.springframework.boot.web.servlet.server.StaticResourceJars.getUrlsFrom(StaticResourceJars.java:56)
	at org.springframework.boot.web.servlet.server.StaticResourceJars.getUrls(StaticResourceJars.java:48)
	at org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory.getUrlsOfJarsWithMetaInfResources(AbstractServletWebServerFactory.java:275)
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.access$300(TomcatServletWebServerFactory.java:101)
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory$StaticResourceConfigurer.lifecycleEvent(TomcatServletWebServerFactory.java:733)
	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5051)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.util.concurrent.FutureTask.run(FutureTask.java)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
	at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
	at java.util.concurrent.FutureTask.run(FutureTask.java)
	at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
	at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
	at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:467)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:107)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:88)
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:438)
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:191)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)

Under java 8 a different exception is thrown from JarFile constructor so that the exception goes into catch block:

org.springframework.boot.web.servlet.server.StaticResourceJars::isResourcesJar(File file)

private boolean isResourcesJar(File file) {
	try {
	    return isResourcesJar(new JarFile(file));
	}
	catch (IOException ex) {
	    return false; 
	}
}

Thanks

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 5, 2020
@philwebb philwebb added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels May 5, 2020
@philwebb philwebb added this to the 2.1.x milestone May 5, 2020
@philwebb philwebb self-assigned this May 5, 2020
@philwebb philwebb changed the title Spring Boot fails with a wildcard in the classpath under java 11 Classpath wildcards cannot be used with Java 11 May 5, 2020
@philwebb philwebb changed the title Classpath wildcards cannot be used with Java 11 Classpath wildcards cannot be used with Java 11 or above May 5, 2020
@philwebb philwebb modified the milestones: 2.1.x, 2.1.14 May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants