2 Replies Latest reply on Jul 12, 2014 1:30 PM by Hristo Stoyanov

    Wildfly 8.1.0.Final virtual host configuration for local development - how to do it?

    Hristo Stoyanov Master

      Hi all,

      I need help on how to set up wildfly virtual host in such a way, that you can deploy the same WAR file in both your production server and you local development computer, without having to change your WEB-INF/jboss-web.xml, depending on the targeted deployment. Below are more details:

       

      1. I own website.com which is powered by a  s4g-web.war module, deployed into a wildfly server.

       

      2. I use the wildfly virtual host set up, so that users hitting http://website.com will be forwarded to: http://website.com:8080/s4g-web with the following configurations (+ some Ubuntu firewall port mapping, basically for http, 80--->8080):

       

      ===== wildfly's standalone.xml =======

      ...

      <server name="default-server">

                      <http-listener name="default" socket-binding="http"/>

                      <host name="default-host" alias="localhost">

                          <location name="/" handler="welcome-content"/>

                          <filter-ref name="server-header"/>

                          <filter-ref name="x-powered-by-header"/>

                      </host>

                     <host name="s4g" alias="website.com, www.website.com" default-web-module="s4g-web.war">

                          <location name="/" handler="welcome-content">

                              <filter-ref name="connection-limit"/>

                          </location>

                      </host>

      </server>

      ...

       

      ======== w4g-web.war's jboss-web.xml ==============

      <jboss-web>

          <context-root>/</context-root>

          <virtual-host>s4g</virtual-host>

      </jboss-web>

       

      3. The above setup works fine for the PROD server.

       

      4. However, I would like to deploy the same s4g-web.war to my development laptop, without having to modify the jboss-web.xml, which is major pain.

      If I do not change my local wildfly's standalone.xml, i will get undertow errors when I try to deploy the same s4g-web.war

      So, I modified my local wildfly's standalone.xml to be:

      ...

      <server name="default-server">

                      <http-listener name="default" socket-binding="http"/>

                      <host name="default-host" alias="localhost">

                          <location name="/" handler="welcome-content"/>

                          <filter-ref name="server-header"/>

                          <filter-ref name="x-powered-by-header"/>

                      </host>

                     <host name="s4g" alias="localhost" default-web-module="s4g-web.war">

                          <location name="/" handler="welcome-content">

                              <filter-ref name="connection-limit"/>

                          </location>

                      </host>

      </server>

      ...

      but I am getting different undertow errors now:

       

      11:44:15,737 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "s4g-web.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => [

          "jboss.undertow.deployment.default-server.s4g./.UndertowDeploymentInfoService is missing [jboss.undertow.server.default-server.s4g]",

          "jboss.undertow.deployment.default-server.s4g./ is missing [jboss.undertow.server.default-server.s4g]"

      ]}

      11:44:15,741 ERROR [org.jboss.as.server] (XNIO-1 task-2) JBAS015870: Deploy of deployment "s4g-web.war" was rolled back with the following failure message:

      {"JBAS014771: Services with missing/unavailable dependencies" => [

          "jboss.undertow.deployment.default-server.s4g./.UndertowDeploymentInfoService is missing [jboss.undertow.server.default-server.s4g]",

          "jboss.undertow.deployment.default-server.s4g./ is missing [jboss.undertow.server.default-server.s4g]"

      ]}

       

       

      Does anyone know how to do this dual deployment, without having to delete WEB-INF/jboss-web.xml for every local deployment and restore it back for production server deployment?

      Thanks.