7 Replies Latest reply on Jan 26, 2003 9:55 PM by Dale Bronk

    Hosting multiple domains with JBoss over DSL

    Dale Bronk Newbie

      I have asked this question in other ways and received no response. So I will ask it in a different way.

      I want to host 5 very small domains that get very little traffic over my dsl connection with a single static IP. I know this is easy as I can set a virtual host for each application. I would register the same ip for each domain. This would work great as anyone going to any of the 5 domains would come to my single ip and jboss would see the virtual host and everything is great. Problem is, each domain has multiple virtual hosts and jboss doesn't like that. For example, each domain would have: www.domain_1.com, shop.domain_1.com, mail.domain_1.com, etc.

      How can I do this? I had followed some threads that suggested that each should get their own jboss instance on different ports. But it seems to me loading separate instances for each is wasteful memory management and also don't think it would solve my problem. I understand separate instances would mean separate jvm's which is nicer, but all domains are owned by the same company and they don't care that they share the same jvm.

      Any ideas would be greatly appreciated. Without this, I will stick with OrionServer which makes this incredibly easy. But OrionServer is $1500 (not terribly expensive, but not free either). I am getting ready for production so the free OrionServer for development is running out for me and I need to make a decision.


        • 1. Re: Hosting multiple domains with JBoss over DSL
          Frode Halvorsen Newbie

          This depends a bit.
          1. Are you using Jetty ?
          2. Does each of the virtual-hosts map to separate webapps?
          3. Do you intend to programmatically seperate the content on each alias ?

          I have on my Jboss 3.0.4 with default Jetty only 1 IP-address, and have set up 3 different virtual-hosts with apps mapped to root.
          In one of the apps (mapped to root) i have made a set of aliases, and the webapp serve different content based on the host-name in the request.


          • 2. Re: Hosting multiple domains with JBoss over DSL
            Dale Bronk Newbie

            I am using Jetty.
            No, each virutal host does not map to a separate webapp although I suppose I could. I need www.myco1.com, shop.myco1.com, mail.myco1.com as well as www.my-co1.com to all go to my myco.war webapp.

            I know that if it is a one to one from virtual host to webapp that is easy, but I need multiple virtual hosts to point to a single webapp. This way a user that enters www.myco1.com, myco1.com, www.my-co1.com, etc will all get to me and run the same webapp.


            • 3. Re: Hosting multiple domains with JBoss over DSL
              Frode Halvorsen Newbie


              I suppose you have deployed as a ear in order to map the webapp to root.

              In jbboss-web.xml do

              (Name doesn't matter, only internal use)
              in jetty-web.xml do :

              <?xml version="1.0" encoding="UTF-8"?>
              <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd">



              (path to saved,compiled jsp's)

              Then all request to those hosts will be redirected to this webapp.

              The last part will enable you to keep the compiled JSP's between restarts of the webapp and JBoss. Just put it in a directory unique for this webapp, and in a place where it doesn't get scratched. Perhaps in the ear.

              • 4. Re: Hosting multiple domains with JBoss over DSL
                Dale Bronk Newbie

                Thank you very much! I'll give this a try. Two last question... I like the idea of specifying where the compiled jsp's go and keeping them between restarts...

                1. JBoss is smart enough to recompile the jsp when a newer jsp is deployed, correct?
                2. How can I specify a different jsp compile directory for each app? By your example, it looks like you are setting a single directory for all jsp's from all apps.

                Thanks again,

                • 5. Re: Hosting multiple domains with JBoss over DSL
                  Frode Halvorsen Newbie

                  Hello .

                  1. Yes, no problem (unless you have deployed a compressed WAR, and the WAR is unpacked every restart, then each JSP may be given new timestamps and recompile anyway)

                  2. There is one jetty-web.xml and jboss-web.xml for each webapp (in the WEB-INF directory inside the WAR), so the specs given is for each webapp. You MUST specify different paths for each webapp, if not, any duplicate JSP-name will give you a headace....

                  It's if you use the webdefault.xml-file in the jbossweb.sar you specify defaults for all webapps.


                  • 6. Re: Hosting multiple domains with JBoss over DSL
                    Dale Bronk Newbie

                    I finally got a chance to test this and am getting errors.

                    Here is my jboss-web.xml:

                    Here is my jetty-web.xml:
                    <?xml version="1.0" encoding="UTF-8"?>
                    <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd">




                    Here is my exception during startup of JBoss 3.0.4:
                    21:33:23,099 INFO [MainDeployer] Starting deployment of package: file:/C:/ServerApps/jboss/server/d
                    21:33:23,379 INFO [jbossweb] Registered jboss.web:Jetty=0,JBossWebApplicationContext=1,context=/
                    21:33:23,800 WARN [jbossweb] WARNING: Configuration error file:/C:/ServerApps/jboss/server/default/
                    java.lang.IllegalStateException: No Method: www.dale.com
                    www.dale-dale.comshop.dale.commail.dale.com on class org.jboss.je
                    at org.mortbay.xml.XmlConfiguration.call(XmlConfiguration.java:501)
                    at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:231)
                    at org.mortbay.xml.XmlConfiguration.configure(XmlConfiguration.java:163)
                    at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:432)
                    at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
                    at org.jboss.jetty.Jetty.deploy(Jetty.java:414)
                    at org.jboss.jetty.JettyService.performDeploy(JettyService.java:243)
                    at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:300)
                    at org.jboss.deployment.MainDeployer.start(MainDeployer.java:807)
                    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:621)
                    at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:585)
                    at java.lang.reflect.Method.invoke(Native Method)
                    at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284
                    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                    at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                    at $Proxy4.deploy(Unknown Source)
                    at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:435)
                    at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDeploymentScanner.java
                    at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)
                    at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentSca


                    • 7. Re: Hosting multiple domains with JBoss over DSL <Figured it
                      Dale Bronk Newbie


                      <?xml version="1.0" encoding="ISO-8859-1"?>
                      <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.2//EN" "http://jetty.mortbay.org/configure_1_2.dtd">





                      Thanks for your help! This is working great!