7 Replies Latest reply on Jul 18, 2011 10:32 PM by Weinan Li

    How to access a web project in domain mode?

    Weinan Li Newbie

      I've successfully deployed a 'my-webapp.war' into 'main-server-group', using the 'default' profile:

       

       

      <subsystem xmlns="urn:jboss:domain:web:1.0">
      ...    <virtual-server name="10.0.1.3" enable-welcome-root="true">
              <alias name="other.com"/>
          </virtual-server>
          <virtual-server name="example.com"/>
      </subsystem>
      

       

      ^^^ The master host is 10.0.1.3, the slave host is 10.0.1.18

       

      And the war is successfully deployed in the server-group. The question is: how can I access the my-webapp.war in domain? Shall I use the alias name of the virtual server? Like http://other.com:8080/my-webapp

        • 1. Re: How to access a web project in domain mode?
          Weinan Li Newbie

          I've modified the config to:

           

          <virtual-server name="other" enable-welcome-root="true">
              <alias name="other.com"/>
          </virtual-server>
          

           

          The war is deployed successfully in this server-group:

           

          Screen shot 2011-07-14 at 11.41.10 AM.png

           

          And the log from master host(10.0.1.3):

           

          [Server:server-one] 11:23:05,703 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "my-webapp.war"
          [Server:server-one] 11:23:05,752 INFO  [org.jboss.web] (MSC service thread 1-2) registering web context: /my-webapp
          [Server:server-one] 11:23:05,798 INFO  [org.jboss.as.server.controller] (pool-1-thread-3) Deployed "my-webapp.war"
          

           

          I've tried to access the WAR resource in this server host via master host IP:

           

          http://10.0.1.3:8080/my-webapp
          

           

          or slave host IP:

           

          http://10.0.1.18:8080/my-webapp
          

           

          But all are just return blank page.

           

          Does that mean the war resources deployed in server group cannot be accessed directly from HTTP port?

          • 2. Re: How to access a web project in domain mode?
            Emanuel Muckenhuber Master

            I don't really understand what you are trying to do with the virtual-servers. Can you just try to change the interface to <any-ipv4-address />, deploy the .war - then you should be able to access http://localhost:8080/my-webapp/ and http://10.0.1.3:8080/my-webapp - on the master. As soon as you connect the slave the equivalent should work.

            • 3. Re: How to access a web project in domain mode?
              Weinan Li Newbie

              I've added following thing to host.xml in both master and slave:

               

                     <management-interfaces>
                        <native-interface interface="any" port="9999" />
                        <http-interface interface="any" port="9990"/>
                     </management-interfaces>
              ...
                  <interfaces>
              ...
                      <interface name="any"><any-ipv4-address/></interface>
                  </interfaces>
              

               

              And then I've tried to access 'http://localhost:8080/my-webapp' on both master and slave.

              Both returns:

               

              curl http://localhost:8080/my-webapp
              curl: (7) couldn't connect to host
              

               

              btw, I'm a little bit curious about the domain config. Because one host can serve multiple server groups. If both groups have web resources and use 8080 ports, how will the AS solve the conflicts? Does that mean, different server groups on same hosts must have different ports to serve?

              • 4. Re: How to access a web project in domain mode?
                Emanuel Muckenhuber Master

                Weinan Li wrote:

                 

                And then I've tried to access 'http://localhost:8080/my-webapp' on both master and slave.

                Above you changed the interfaces for the management ports only which does not affect the socket-binding (standard-sockets) which is used by the web connector.

                 

                Weinan Li wrote:

                 

                btw, I'm a little bit curious about the domain config. Because one host can serve multiple server groups. If both groups have web resources and use 8080 ports, how will the AS solve the conflicts? Does that mean, different server groups on same hosts must have different ports to serve?

                Correct in this case you can specify a 'port-offset' attribute for each server in the host.xml. This is part of the socket-binding reference and is an offset which will be added to each configured port.

                • 5. Re: How to access a web project in domain mode?
                  Weinan Li Newbie
                  [domain@10.0.1.3:9999 /] /profile=default/subsystem=web/virtual-server=other.com:add
                  {
                      "outcome" => "success",
                      "result" => {"server-groups" => [("main-server-group" => {
                      "master" => {
                          "host" => "master",
                          "response" => {"outcome" => "success"}
                      },
                      "slave" => {
                          "host" => "slave",
                          "response" => {
                              "outcome" => "success",
                              "result" => undefined
                          }
                      }
                  })]}
                  }
                  

                   

                  Thank you for your help Emanuel! The problem is that I forgot to add the web module dynamically  because of the bug currently in white rabbit. After adding it I can access the resources in both master and slave with its ip.

                   

                  Here I have another question, what's the meaning of alias name and name of the virtual server? Does that just used to identify the server group or could be used to access a server group as a whole? 

                  • 6. Re: How to access a web project in domain mode?
                    Emanuel Muckenhuber Master

                    Weinan Li wrote:

                     

                    Here I have another question, what's the meaning of alias name and name of the virtual server? Does that just used to identify the server group or could be used to access a server group as a whole? 

                    This has just something to do with the web container and virtual hosts and is not related to anything else in the management layer. I guess the 'virtual-server' element should be renamed to 'virtual-host' to make this a bit more clear.

                    1 of 1 people found this helpful
                    • 7. Re: How to access a web project in domain mode?
                      Weinan Li Newbie

                      yeah 'virtual-host' sounds more reasonable ;-)