13 Replies Latest reply on May 2, 2002 9:28 AM by seanhowell

    JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts

    jkramer

      Greetings,
      I fear this topic may be beaten to death but I am in need of some guidance. I know JBoss 2.4.5 has support for virtual hosts as per the change log. What I need to know is which files need to be configured to allow this, as well as how to alter those files.
      Despite being new to Java development and newer still to JBoss inparticular, I have been charged with the task (not one I've sought) of determining how best to move our applications from Orion to JBoss (for which virtual hosting is an absolute necessity). I've gotten an existing application to run under JBoss-2.4.4 so only the virtual hosting issue is of concern to me at this point.
      Normally I would quite enjoy sorting though everything in my own time learning it and letting it soak in and all, unfortunately I am not graced with the luxury of time, so any help would be welcome help.
      I should also note that as of this posting I am still downloading the JBoss-2.4.5_Tomcat-4.0.3.zip file (sourceforge is particularily slow today), so it may very well be when I view the conf files it will all be clear, but for now I'm hedging my bets :)

      Thank you kindly in advance,
      ~Jakob Kramer

        • 1. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
          mdelamere

          Hi,

          Wow this is good news. I was using a patch from Alain Cotemeur for jboss2.4.4. So, I´m downloading now aswell and maybe I can come up with an answer (if nobody else posts).

          Hope you don´t mind me using this thread for another question. Does that mean that jboss3.0 does or will eventually support virtual hosts aswell? More good news!

          bye Michael Delamere

          • 2. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
            mdelamere

            Well, I ended up downloading a corrupted zip-archive at 4kb/s. So next try :-).

            Is someone reading this thread?

            bye Michael Delamere

            • 3. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
              jkramer

              I posted this same question to the users mailing list and this is the reply I got from Scott Stark:

              An example jboss.jcml EmbeddedCatalinaServiceSX mbean config with
              localhost and succubus virtual hosts:


              <!-- The embedded Tomcat-4.x(Catalina) service configuration -->













              www.starkinternational.com
              main.starkinternational.com






              <!-- A HTTP Connector on port 8080 -->







              A war deployed to the virtual host succubs under the root context
              needs to include a WEB-INF/jboss-web.xml descriptor with:


              <jboss-web>
              <context-root>/</context-root>
              <virtual-host>succubus</virtual-host>
              </jboss-web>

              I have tried this and it works so... Woohoo and Yippee and all other shouts of joy.

              Thanks Scott, and I hope this helps anyone else too.

              ~Jakob Kramer

              • 4. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                mdelamere

                Thanks!

                Doesn´t look too hard. As I haven´t managed to download jboss2.4.5 yet (it keeps stopping half-way and I end up with yet another corrupted zip file), I have been trying the same configuration with jboss3.0.

                It´s not working yet, although I have the feeling that I´m getting there.

                I´ll try asking my question again :-), will the above configuration also work with jboss3.0?

                bye Michael Delamere

                • 5. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                  mdelamere

                  Me again (zzzzzz) !

                  I´ve managed to download the jboss2.4.5+tomcat4.0.3 bundle. I´ve also set up the virtual hosts exactly the way it has been described above.

                  Could someone explain to me why I´m getting the following errors when restarting apache:

                  ===================================================================

                  [INFO,Engine] WarpHost[servtest.intern.delamere.de]: Installing web application at context path /examples from URL file:/usr/local/java/jboss2.4.5/catalina/webapps/examples
                  [INFO,Engine] WebappLoader[/examples]: Deploying class repositories to work directory /usr/local/java/jboss2.4.5/catalina/work/servtest.intern.delamere.de/examples
                  [INFO,Engine] StandardManager[/examples]: Seeding random number generator class java.security.SecureRandom
                  [INFO,Engine] StandardManager[/examples]: Seeding of random number generator has been completed
                  [ERROR,Engine] [org.apache.catalina.connector.warp.WarpConnector] Connection from /127.0.0.1:1348 to /127.0.0.1:8008
                  [ERROR,Engine] [org.apache.catalina.connector.warp.WarpConnector] Connection from /127.0.0.1:1349 to /127.0.0.1:8008
                  [INFO,Engine] ContextConfig[/examples]: Added certificates -> request attribute Valve
                  [INFO,Engine] ContextConfig[/examples]: Configured an authenticator for method FORM
                  [ERROR,Engine] StandardContext[/examples]: Error configuring application listener of class listeners.ContextListener
                  java.lang.NoClassDefFoundError: javax/servlet/ServletContextAttributeListener
                  at java.lang.ClassLoader.defineClass0(Native Method)
                  at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
                  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
                  at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1631)
                  at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:926)
                  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
                  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1243)

                  ===================================================================

                  I´ve got the feeling as if I´m talking to myself. Could someone PLEASE give me an answer to my questions.

                  bye Michael Delamere

                  • 6. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                    jkramer

                    Michael,

                    I don't know the answer to your question since I myself am not using apache and so cannot replicate the error, but I have asked around the office with people more familiar with apache than I, but they don't have any ideas straight away.

                    My question to you though is this: Were you able to configure each virtual host (each independant application) to use a different data source, if so how did you do this?

                    Cheers,
                    Jakob Kramer

                    • 7. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                      mdelamere

                      Hi Jakob,

                      I´m not sure exactly what you mean. Do you mean deploying in several directories, i.e. one for each application?

                      As far as I know you can specify this in the jboss.jcml.
                      This is what I did:

                      <!-- ==================================================================== -->
                      <!-- Auto deployment -->
                      <!-- ==================================================================== -->


                      J2EE:service=J2eeDeployer;
                      JCA:service=RARDeployer

                      ../deploy,../deploy/lib,/www/servtest/java</attribute


                      You´ll notice that I have added "/www/servtest/java".

                      Now I´m not sure wether this is the "only" or the "best" solution but it works.

                      bye Michael Delamere

                      • 8. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                        mdelamere

                        Well actually I have "/www/servtest/java/deploy" but I think you get my point :-)

                        • 9. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                          jkramer

                          I understand about the seperate directory thing. What I am curious about is whether or not I can have application a connect to database a and have application b connect to database b.

                          Thanks,
                          ~Jakob Kramer

                          • 10. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                            mdelamere

                            Sorry, I don´t have an answer to that question. However, I can´t imagine it.

                            You would be better off asking these types of questions to the tomcat-user mailing list. It´s near to impossible getting an answer in this forum!!

                            regards

                            Michael Delamere

                            p.s. Coming back to the virtual host question :-) :
                            did you ever get this error message from tomcat:

                            "The requested resource (/examples/) is not available."

                            • 11. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                              mdelamere

                              oh oh, got it wrong again. I meant the jboss-users mailing list of course!

                              That´s what happens to you when you hardly sleep for almost a week because you´re trying to get all this setup!

                              • 12. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                                seanhowell

                                Sorry Jakob,
                                I can see in the output the [Engine] picking up my new host but I'm missing something. I can deploy under the virtual host;

                                http://www.mycompany.com/myApp

                                but having trouble deploying a .ear directly to

                                http://www.mycompany.com

                                Where am I going wrong?

                                Cheers
                                Sean

                                • 13. Re: JBoss-2.4.5/Tomcat-4.0.3 + Virtual Hosts
                                  seanhowell

                                  Ok, scratch that, I figured it out.
                                  I can now join in the cheers, hooray!

                                  Thanks guys.