5 Replies Latest reply on Jan 5, 2003 4:53 PM by Manuel Camilo Cuesta Camacho

    Virtual Host using Jetty

    Erik Turesson Novice


      I am using Jboss 3.0.2 and Jetty.
      I have an application containing both ejbs and jsps.
      I have finaly managed to deploy two copies of "almost" the same .ear file. I have changed the Jndi-names and the Ejbnames so they are unique. I have created to mssql-service.xml files, with different names of corse. I define different datasources and so on. Two separate databases are used and two instances of each table is created. So far everything is OK.

      But how do I configure JBoss/Jetty to make it possible to access those .ear files as separate applications.

      I have read in the manual and in this forum about virtual hosts and context root settings. I however does not succeed.

      What I want is that for example www.app1.com should access the jsps in the file app1.ear and that www.app2.com should access the jsps in the file app2.ear.

      I have specified the virtualhost and contextroot in the jboss-web.xml. I have added listeners in the jboss-service.xml files. I have also specified the two hostnames in my hosts file on my computer. (I currently only run localy on my computer)

      What more has to be done?


        • 1. Re: Virtual Host using Jetty
          Erik Turesson Novice

          Hello again!

          I have now managed to get "one" virtual host to work.
          I deploy my ears. One is set to answer to www.app1.com and the other to www.app2.com. Both URLs works, ie Jetty responds to them. However both URLs are mapped to the same .ear file.

          How do you map one URL to one .ear file?


          • 2. Re: Virtual Host using Jetty
            Erik Turesson Novice


            Unfortunatly I am only replying to my own questions.

            Is it possible to have two virtual hosts defining the same context-root, i e "/"?

            I have found out that it is the ear that is deployed first that gets all the requests. Could it be some kind of conflict between the ears because of the context-roots?


            • 3. Re: Virtual Host using Jetty
              Erik Turesson Novice

              Here I am again answering my ownquestions.

              The text below is found on the www.mortbay.org website describing Jetty.

              Alternatively, different applications can be served from the same port using virtual hosts: SocketListener --> HttpServer +-> HttpContext --> HttpHandler(s)
              port:80 | vhost: www.alpha.com
              | path: "/"
              +-> HttpContext --> HttpHandler(s)
              vhost: www.beta.com
              path: "/"

              As I understand it different virtual hosts can have the same context root and serve different applications.

              How do you configure JBoss to do that?


              • 4. Re: Virtual Host using Jetty
                Himanshu Roongta Newbie

                You just deploy two web application with twp diffrent virtualhost
                for ex
                a> a.war deployed to root(/) with virtual host www.a.com
                b>b.war deployed to root(/) with virtual host at www.b.com

                • 5. Re: Virtual Host using Jetty
                  Manuel Camilo Cuesta Camacho Newbie

                  How can I set the context root for the virtual host in the jboss-web.xml? If I can't make this work, I'll think of running jboss and jetty separately. I know that the virtual host is set like
                  but how about the context?