1 Reply Latest reply on Oct 8, 2002 3:27 PM by Erik Turesson

    Virtual Host, Context-Root using Jetty

    Erik Turesson Novice

      Hello!

      I have posted the questions below in the Installation and Configuration forum, but since I have not received any answers I post them here too.

      /Erik

      ------------------------------------------

      Hello!

      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?

      /Erik

      -------------------------------------------------------

      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?

      /Erik

      ----------------------------------------------

      Hello!

      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?

      /Erik

        • 1. Re: Virtual Host, Context-Root using Jetty
          Erik Turesson Novice

          Here I am again answering my own questions.

          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?

          /Erik