3 Replies Latest reply on Oct 12, 2006 1:26 PM by rcjboss

    URL problems using Apache, JBoss, mod_jk

    mlriggins

      Hello,

      I hope someone can help. I'm very new at this and I am still trying to
      figure out what I am doing.

      I have configured Apache on Machine 1 and JBoss on Machine 2 using
      mod_jk. After much trial and error, I finally got things working. I
      have a war file that exists on Machine 2 that I need to use for my site
      named Corporate.war. However, when I attempt to access my url
      www.example.com from the internet I get an error. When I use the url
      www.example.com/Corporate the site opens just fine. How do I tell
      Apache to open the site using www.example.com? I have made numerous
      changes to the VirtualHost in httpd.conf to no avail.

      Another problem I am having is that my site is not displaying static
      images located on Machine 2. Those images are not located in the same
      directory as the DocumentRoot, they are back one directory.

      Basic VirtualHost I am using:

      <VirtualHost *:80>
      ServerName www.example.com
      ServerAdmin a...@mycompany.com
      DocumentRoot 'C:\jboss-4.0.1RC2\server\default\deploy'
      JkMount /*.war loadbalancer
      JkMount /Corporate loadbalancer
      JkMount /Corporate/* loadbalancer
      JkMount /*.jsp loadbalancer
      JkMount /servlet/* loadbalancer
      ErrorLog logs/example.com-error.log
      CustomLog logs/example.com-access.log common


      Thank you in advance for any and all suggestions.

      Monica

        • 1. Re: URL problems using Apache, JBoss, mod_jk
          rcjboss

          This is something that you need to tell JBoss/Tomcat using the jboss-wex.xml.

          Follow my response for the post: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=91886

          You have the same situation.

          • 2. Re: URL problems using Apache, JBoss, mod_jk
            mlriggins

            Thanks so much for the response, however I had already tried this and it didn't work. I just tried again, and it still doesn't work.

            I get a 404 error. I have now defined a host in my server.xml for the virtual host I set up in my httpd.conf file. Now I receive a 400 error when attempting to access www.example.com/Corporate.

            Adding the jboss-web.xml file also causes me to be unable to access http://localhost/Corporate from my Apache server. The web-console opens just fine from that box.

            From my JBoss box, the localhost opens to my /Corporate site using http://localhost:8080 without a problem.

            Can you suggest anything else? Thanks again.

            Monica

            • 3. Re: URL problems using Apache, JBoss, mod_jk
              rcjboss

              The server.xml does not need to change.
              Once you have established connectivity between Apache and JBoss using ModJK, all you need is to make your application (.war) to be the default for the application server.
              Normally ROOT.war in the tomcat sar is the default web app and hence you see the JBoss page containing links for web-console, jmx console etc.

              First make sure that all your requests are being routed to JBoss from Apache:
              JKMount /* loadbalancer

              Once you do this, and hit your domain.com you should get the default "Welcome to JBoss" page.
              This will make sure all http requests are being forwarded to JBoss.

              Next just by adding the jboss-web.xml as mentioned to your .war will make sure that JBoss makes it the default.

              Then you can test it by calling your domain.com or on jboss server - http://localhost:8080

              you should get your .war files welcome page. Else you can invoke your other URLs in the .war (like /servlet/* or /*jsp etc).