Skip to content
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

war file with Jetty fails to boot up in Windows (broken due changes in Jetty version 9.4.32.v20200930 onward) #526

Closed
JesseChavez opened this issue Sep 23, 2022 · 1 comment · Fixed by #527

Comments

@JesseChavez
Copy link
Contributor

System/Webapp details

  • Windows
  • Java 11
  • Rails 6.1
  • JRuby 9.2.21.0
  • Warbler 2.0.5

This issue was replicated by creating a sample rails app samson.war with jetty
9.4.32.v20200930 and 9.4.49.v20220914

Booting up the rails app fails

D:\workbench\jetties>java -Dwarbler.debug=true -jar samson.war
webroot directory is C:\Users\ORIGIN~1\AppData\Local\Temp\warbler2812041445481703119webroot\samson.war
webserver.jar extracted to C:\Users\ORIGIN~1\AppData\Local\Temp\webserver3053497811769140677.jar
2022-09-23 21:29:23.839:INFO::main: Logging initialized @388ms to org.eclipse.jetty.util.log.StdErrLog
invoking webserver with: [--host, 0.0.0.0, --port, 8080, --config, jar:file:/D:/workbench/jetties/samson.war!/WEB-INF/webserver.xml, /D:/workbench/jetties/samson.war]
WARNING: jetty-runner is deprecated.
         See Jetty Documentation for startup options
         https://www.eclipse.org/jetty/documentation/
2022-09-23 21:29:23.855:INFO:oejr.Runner:main: Runner
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /D:/workbench/jetties/samson.war
        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:229)
        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.resource.Resource.newResource(Resource.java:179)
        at org.eclipse.jetty.util.resource.Resource.newResource(Resource.java:152)
        at org.eclipse.jetty.runner.Runner.configure(Runner.java:420)
        at org.eclipse.jetty.runner.Runner.main(Runner.java:563)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at WarMain.launchWebServer(WarMain.java:187)
        at WarMain.start(WarMain.java:345)
        at JarMain.doStart(JarMain.java:233)
        at WarMain.main(WarMain.java:367)
Usage: java [-Djetty.home=dir] -jar jetty-runner.jar [--help|--version] [ server opts] [[ context opts] context ...]

After digging more the issue can be replicated by using the Jetty runner directly:

The app boots up properly with Jetty 9.4.31.v20200723 (expected behaviour):

D:\workbench\jetties>java -jar jetty-runner-9.4.31.v20200723.jar /D:/workbench/jetties/samson.war
2022-09-23 22:43:00.761:INFO::main: Logging initialized @199ms to org.eclipse.jetty.util.log.StdErrLog
WARNING: jetty-runner is deprecated.
         See Jetty Documentation for startup options
         https://www.eclipse.org/jetty/documentation/
2022-09-23 22:43:00.777:INFO:oejr.Runner:main: Runner
2022-09-23 22:43:00.886:INFO:oejs.Server:main: jetty-9.4.31.v20200723; built: 2020-07-23T17:57:36.812Z; git: 450ba27947e13e66baa8cd1ce7e85a4461cacc1d; jvm 11.0.10+9-LTS
2022-09-23 22:43:05.659:WARN:oeja.AnnotationParser:main: Unrecognized ASM version, assuming ASM7
2022-09-23 22:43:06.519:INFO:oeja.AnnotationConfiguration:main: Scanning elapsed time=851ms
2022-09-23 22:43:08.328:INFO:oejs.session:main: DefaultSessionIdManager workerName=node0
2022-09-23 22:43:08.328:INFO:oejs.session:main: No SessionScavenger set, using defaults
2022-09-23 22:43:08.328:INFO:oejs.session:main: node0 Scavenging every 660000ms
2022-09-23 22:43:08.511:INFO:oejshC.ROOT:main: INFO: jruby 9.2.21.0 (2.5.8) 2022-06-27 49e5080a7c OpenJDK 64-Bit Server VM 11.0.10+9-LTS on 11.0.10+9-LTS +jit [mswin32-x86_64]
2022-09-23 22:43:08.527:INFO:oejshC.ROOT:main: INFO: using a shared (threadsafe!) runtime
2022-09-23 22:43:27.331:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@f4168b8{/,file:///C:/Users/Origination/AppData/Local/Temp/jetty-0_0_0_0-8080-samson_war-_-any-2598341243990491270.dir/webapp/,AVAILABLE}{file:///D:/workbench/jetties/samson.war}
2022-09-23 22:43:27.370:INFO:oejs.AbstractConnector:main: Started ServerConnector@1fc2b765{HTTP/1.1, (http/1.1)}{0.0.0.0:8080}
2022-09-23 22:43:27.370:INFO:oejs.Server:main: Started @26802ms

The app fails to boot up with Jetty 9.4.31.v20200723 (expected behaviour):

D:\workbench\jetties>
D:\workbench\jetties>java -jar jetty-runner-9.4.49.v20220914.jar /D:/workbench/jetties/samson.war
2022-09-23 22:44:42.156:INFO::main: Logging initialized @194ms to org.eclipse.jetty.util.log.StdErrLog
WARNING: jetty-runner is deprecated.
         See Jetty Documentation for startup options
         https://www.eclipse.org/jetty/documentation/
2022-09-23 22:44:42.156:INFO:oejr.Runner:main: Runner
java.nio.file.InvalidPathException: Illegal char <:> at index 2: /D:/workbench/jetties/samson.war
        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:229)
        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.resource.Resource.newResource(Resource.java:179)
        at org.eclipse.jetty.util.resource.Resource.newResource(Resource.java:152)
        at org.eclipse.jetty.runner.Runner.configure(Runner.java:420)
        at org.eclipse.jetty.runner.Runner.main(Runner.java:563)

Digging in the Jetty repository, it seems the change of behaviour was introduced by this changes jetty/jetty.project#5131. Browsing the comments it clearly that pull request caused the breakage jetty/jetty.project#5131 (comment).

As per @gregw in this comment states the previous behaviour is a bug
jetty/jetty.project#5871 (comment)

As a side note the Jetty Runner is not deprecated as per @gregw

@JesseChavez
Copy link
Contributor Author

Hi @olleolleolle,

I created a pull request to resolve this issue #527

Hope is all good, also no sure if I have to add in the commit the generated jar file lib/warbler_jar.jar

@olleolleolle olleolleolle linked a pull request Sep 26, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant