0 Replies Latest reply on Jul 29, 2018 1:57 PM by Collin Aranha

    Context-root is set to '/' when deployed on any created server other than default-server [WildFly 12]

    Collin Aranha Newbie



      I am facing a very strange issue. Currently, I have upgraded to WildFly 12. I have a test war file which is to be deployed on the server: secure-server and virtual-host: secure-host


      I deploy my war file but I see the following log

      INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 73) WFLYUT0021: Registered web context: '/' for server 'secure-server'

      the context root is '/'


      when I check the CLI I find the following

      [domain@ /] /host=master/server=master-server/deployment=test_help.war/subsystem=undertow:read-resource


          "outcome" => "success",

          "result" => {

              "context-root" => "/test_help",

              "server" => "secure-server",

              "virtual-host" => "secure-host",

              "servlet" => {"equinoxbridgeservlet" => undefined},

              "websocket" => undefined




      The jboss-web.xml has the following:






      When I change the configuration and load it in the default-server and default-host the context root is fine.

      INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 75) WFLYUT0021: Registered web context: '/test_help' for server 'default-server'


      What would be wrong in the configuration?


      Message was edited by: Collin Aranha

      Finally found the reason behind it.

      I had set the <host name="secure-host" default-web-module="test_help.war">

      When debugged in the code of org/wildfly/extension/undertow/deployment/UndertowDeploymentInfoService.java   


      /*     This is to address WFLY-1894 but should probably be moved to some other place.     */   

      private String resolveContextPath() {       

      if (deploymentName.equals(host.getValue().getDefaultWebModule())) {     

            return "/";     

        } else {     

            return contextPath;     

        }     }


      So if the default web module is specified then the context-root gets set to "/" due to this my configuration was not working.