-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Jetty 12.x startup fails because MetaInfConfiguration is throwing an exception while parsing java classpath with URIUtil when classpath contains wildcard ./mypath/* #11092
Comments
There's only 1 place a glob is supported for classpath stuff, and that's the How are you configuring your |
I can only share partial parts. jettyWebAppContext.setWelcomeFiles(new String[0]); In some situation for a one context containing static files : And some part of the classpath is declared this way. Here is a more complete stacktrace: java.nio.file.InvalidPathException: Illegal char <*> at index 66: D:\XXXXXXXXXXXXX\YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY.\optional-lib* |
Yes, this is totally within the processing of The thing is, when using a WebAppContext, we have to support the Servlet spec, which means scanning the various jars / classes that exist on the WebAppContext and server level. In previous versions of Jetty, that entry would result in a We have tried in the past to mimic the behavior of the In short, using glob on the The best short term fix for this is to make the error more clear. It's been a while since we looked at this issue, I wonder if there are new APIs (or jmx details) that we can use to find the actual resolved list of JARs instead of relying on |
If there is a way to avoid the failure, like with a warning, i would love that. |
@jdgenerix have you tried this on jetty-11? Does it produce a problem? |
@janbartel jetty-11 quietly drops the string entry with the glob. It does this by taking the String, converting to File/Path, and then trying to use it, but fails (as that is an invalid File/Path). |
Thanks to @janbartel for your suggestion. I've used a workaround to avoid using a wildcard in the classpath, and i don't have exception anymore. on Windows :
on Linux : |
Jetty version(s)
12.0.4
Jetty Environment
ee10
Java version/vendor
(use: java -version)
Java VM: OpenJDK 64-Bit Server VM 17.0.8.1+1, mixed mode, sharing, Eclipse Adoptium
OS type/version
Windows 10 Enterprise
Description
org.eclipse.jetty.ee10.webapp.MetaInfConfiguration is calling URIUtil::toURI with values from the classpath. If the classpath contains wildcard values like .\mypath* it fails with an java.nio.file.InvalidPathException
Extract from MetaInfConfiguration :
java.nio.file.InvalidPathException: Illegal char <*> at index xx : C:\temp\test.\mypath*
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) ~[?:?]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) ~[?:?]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) ~[?:?]
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) ~[?:?]
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:232) ~[?:?]
at java.base/java.nio.file.Path.of(Path.java:147) ~[?:?]
at java.base/java.nio.file.Paths.get(Paths.java:69) ~[?:?]
at org.eclipse.jetty.util.URIUtil.toURI(URIUtil.java:1841) ~[jetty-util-12.0.4.jar:12.0.4]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[?:?]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[?:?]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[?:?]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
at org.eclipse.jetty.ee10.webapp.MetaInfConfiguration.findAndFilterContainerPaths(MetaInfConfiguration.java:165) ~[jetty-ee10-webapp-12.0.4.jar:12.0.4]
How to reproduce?
import org.eclipse.jetty.util.URIUtil;
public class URIUtilTest {
public static void main(String[] args) {
URIUtil.toURI("C:\mainpath\mypath\*");
}
}
The text was updated successfully, but these errors were encountered: