You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chris Ruegger <cr...@speakeasy.net> on 2002/07/25 15:41:31 UTC

Apache, Tomcat and Struts

Situation:
RedHat Linux 7.2 with Apache forwarding requests to Tomcat 4.0.4 works OK.

I'm using Struts in my Tomcat application. What I want to have happen is this:

1. Client connects to Apache with some URL "foo.com"
2. Apache has been set up to look for an "index.do" welcome-file via the DirectoryIndex
    Directive
3. Apache/AJP3 configured such that all "*.do" patterns get sent to Tomcat
4. Using Struts/Tomcat, I have mapped "index.do" to some Action in struts-config.xml
5. Tomcat process action for index.do, runs logic, forwards to JSP, etc.

I have set this up on my Linux machine. I had to add a dummy "index.do" file in the
document root that is empty. This seemed to be necessary to get Apache and Tomcat
to try to return it, and it sets the processing above into motion.

Problem:
All works fine when I access Apache from the Linux machine itself as "localhost".
However when I access Apache from another machine as "foo.com", Apache
seems to be return the empty "index.do" file and does not forward on to Tomcat.
How can I get this to work when I access everything from a remote machine?

Some relevant entries from my config files:
httpd.conf:
<IfModule mod_dir.c>
  DirectoryIndex index.do index.jsp index.html
</IfModule>

mod_jk.conf:

<VirtualHost localhost>
  ServerName localhat
  JkMount /*.do ajp13
  JkMount /*.jsp ajp13
  JkMount /servlet/* ajp13
</VirtualHost>

Is this a reasonable approach end-to-end, or how have other people implemented
the same funcitionality?

Thanks!







Re: Apache, Tomcat and Struts

Posted by Luminous Heart <lu...@yahoo.com>.
I believe your virtualhost setup is the problem here.
I had a go with virtualhosts. Make sure you have the
directory serving a specific virtualhost defined
inside the virtualhost block otherwise it will be
going to the default directory of the server.

Hope this would hlep.

--- Chris Ruegger <cr...@speakeasy.net> wrote:
> Situation:
> RedHat Linux 7.2 with Apache forwarding requests to
> Tomcat 4.0.4 works OK.
> 
> I'm using Struts in my Tomcat application. What I
> want to have happen is this:
> 
> 1. Client connects to Apache with some URL "foo.com"
> 2. Apache has been set up to look for an "index.do"
> welcome-file via the DirectoryIndex
>     Directive
> 3. Apache/AJP3 configured such that all "*.do"
> patterns get sent to Tomcat
> 4. Using Struts/Tomcat, I have mapped "index.do" to
> some Action in struts-config.xml
> 5. Tomcat process action for index.do, runs logic,
> forwards to JSP, etc.
> 
> I have set this up on my Linux machine. I had to add
> a dummy "index.do" file in the
> document root that is empty. This seemed to be
> necessary to get Apache and Tomcat
> to try to return it, and it sets the processing
> above into motion.
> 
> Problem:
> All works fine when I access Apache from the Linux
> machine itself as "localhost".
> However when I access Apache from another machine as
> "foo.com", Apache
> seems to be return the empty "index.do" file and
> does not forward on to Tomcat.
> How can I get this to work when I access everything
> from a remote machine?
> 
> Some relevant entries from my config files:
> httpd.conf:
> <IfModule mod_dir.c>
>   DirectoryIndex index.do index.jsp index.html
> </IfModule>
> 
> mod_jk.conf:
> 
> <VirtualHost localhost>
>   ServerName localhat
>   JkMount /*.do ajp13
>   JkMount /*.jsp ajp13
>   JkMount /servlet/* ajp13
> </VirtualHost>
> 
> Is this a reasonable approach end-to-end, or how
> have other people implemented
> the same funcitionality?
> 
> Thanks!
> 
> 
> 
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>