Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1958

Can't Run Unexpanded WAR With # in the Name

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 2.2.7.Final
    • Core
    • None
    • Hide
      1. Build a Spring Boot executable war using Undertow as the embedded servlet container. Make sure war filename contains #
      2. Run the war as a jar like java -jar war#file.war
      3. Send any web request to the server and it will throw the exception.
      Show
      Build a Spring Boot executable war using Undertow as the embedded servlet container. Make sure war filename contains # Run the war as a jar like java -jar war#file.war Send any web request to the server and it will throw the exception.

    Description

      All our WAR files have name with ## so Tomcat doesn't use version in the context name, for example,

         server##1.0.war

      It worked fine with Tomcat. We recently switched to Embedded Undertow with Spring Boot. The server throws following exception:

      2021-09-05 12:04:53.341 ERROR 23052 — [   XNIO-1 I/O-1] io.undertow.request                      : UT005071: Undertow request failed HttpServerExchange{ GET /catalog-server} java.lang.RuntimeException: java.net.MalformedURLException: No !/ in spec 'file:/tmp/war/catalog-server'

      Apparently, the war filename is not properly encoded and the # is treated as fragment and everything after # is dropped by URL class. 

      Here is the stack trace:

      2021-09-05 12:04:53.341 ERROR 23052 --- [   XNIO-1 I/O-1] io.undertow.request                      : UT005071: Undertow request failed HttpServerExchange{ GET /catalog-server} java.lang.RuntimeException: java.net.MalformedURLException: No !/ in spec 'file:/tmp/war/catalog-server'        at io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:126)        at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:146)        at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:69)        at org.springframework.boot.web.embedded.undertow.DeploymentManagerHttpHandlerFactory$DeploymentManagerHandler.handleRequest(DeploymentManagerHttpHandlerFactory.java:75)        at io.undertow.server.handlers.ProxyPeerAddressHandler.handleRequest(ProxyPeerAddressHandler.java:129)        at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:104)        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)        at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:255)        at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)        at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)        at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)        at io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)         at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291)        at org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286)        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)         at org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:178)         at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612)        at org.xnio.nio.WorkerThread.run(WorkerThread.java:479)Caused by: java.net.MalformedURLException: No !/ in spec 'file:/tmp/war/catalog-server'        at java.base/java.net.URL.<init>(URL.java:661)        at java.base/java.net.URL.<init>(URL.java:523)        at java.base/java.net.URL.<init>(URL.java:470)        at org.springframework.boot.web.embedded.undertow.JarResourceManager.getResource(JarResourceManager.java:51)        at org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory$LoaderHidingResourceManager.getResource(UndertowServletWebServerFactory.java:586)        at org.springframework.boot.web.embedded.undertow.CompositeResourceManager.getResource(CompositeResourceManager.java:51)        at io.undertow.servlet.handlers.ServletPathMatches.getServletHandlerByPath(ServletPathMatches.java:96)

      Attachments

        1. exec-war-bug.zip
          3 kB
        2. test-server##1.0.war
          17.25 MB
        3. test-server-tomcat##1.0.war
          16.54 MB

        Activity

          People

            rhn-cservice-bbaranow Bartosz Baranowski
            aolzhang Zhihong Zhang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: