Tomcat with Apache Web Server

Discussion in 'Java' started by Ike, Sep 30, 2006.

  1. Ike

    Ike Guest

    I am trying to set up Tomcat 5.0.28 to run under an Apache Web Server
    2.0.59. I have the correct mod_jk.so and have everything set up just fine on
    a Windows XP SP2 box.

    My CATALINA_HOME directory is C:\Tomcat

    Everything works fine with the examples for
    C:\Tomcat\webapps\servlets-examples. Additionally, everythging works fine
    with the Apache web server taking the static content as it should, and
    Tomcat taking on the servlets.

    What I want to do is have it so that when I call
    {a_domain}/servlets/myservlet that the myservlet be executed. But I cannot
    seem to get it to do this. My problem is in my httpd.conf file, and I have
    tried copying from that portion of it (which works) for servlets-examples.
    (Addtionally, I will have multiple and different a_domain's)

    Can someone please help me here and show me what I am doing wrong? Thanks,
    Ike. My httpd.conf for the relevant portion is below: p.s. yes I have
    restarted Apache and Tomcat.


    LoadModule jk_module modules/mod_jk.so

    <IfModule mod_jk.c>

    JkWorkersFile conf/workers.properties
    JkLogFile logs/mod_jk.log
    JkLogLevel error
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    JkRequestLogFormat "%w %V %T"

    Alias /jsp-examples "C:/Tomcat/webapps/jsp-examples/"

    <Directory "C:/Tomcat/webapps/jsp-examples/">
    Options Indexes +FollowSymLinks
    AllowOverride None
    Allow from all
    </Directory>

    JkMount /jsp-examples/*.jsp example

    Alias /servlets-examples "C:/Tomcat/webapps/servlets-examples/"

    <Directory "C:/Tomcat/webapps/servlets-examples/">
    Options Indexes +FollowSymLinks
    AllowOverride None
    Allow from all
    </Directory>

    JkMount /servlets-examples/* example

    #now here is my stuff, which isn;t working ###################
    #my servlet.class file is in C:\Tomcat\webapps\a_domain\WEB-INF\classes

    Alias /a_domain/servlets "C:/Tomcat/webapps/a_domain/"

    <Directory "C:/Tomcat/webapps/a_domain/">
    Options Indexes +FollowSymLinks
    AllowOverride None
    Allow from all
    </Directory>

    JkMount /a_domain/servlets/* example

    <Location /*/WEB-INF/*>
    AllowOverride None
    deny from all
    </Location>
    </IfModule>
     
    Ike, Sep 30, 2006
    #1
    1. Advertising

  2. Ike

    IchBin Guest

    Ike wrote:
    > I am trying to set up Tomcat 5.0.28 to run under an Apache Web Server
    > 2.0.59. I have the correct mod_jk.so and have everything set up just fine on
    > a Windows XP SP2 box.
    >
    > My CATALINA_HOME directory is C:\Tomcat
    >
    > Everything works fine with the examples for
    > C:\Tomcat\webapps\servlets-examples. Additionally, everythging works fine
    > with the Apache web server taking the static content as it should, and
    > Tomcat taking on the servlets.
    >
    > What I want to do is have it so that when I call
    > {a_domain}/servlets/myservlet that the myservlet be executed. But I cannot
    > seem to get it to do this. My problem is in my httpd.conf file, and I have
    > tried copying from that portion of it (which works) for servlets-examples.
    > (Addtionally, I will have multiple and different a_domain's)
    >
    > Can someone please help me here and show me what I am doing wrong? Thanks,
    > Ike. My httpd.conf for the relevant portion is below: p.s. yes I have
    > restarted Apache and Tomcat.
    >
    >
    > LoadModule jk_module modules/mod_jk.so
    >
    > <IfModule mod_jk.c>
    >
    > JkWorkersFile conf/workers.properties
    > JkLogFile logs/mod_jk.log
    > JkLogLevel error
    > JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
    > JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
    > JkRequestLogFormat "%w %V %T"
    >
    > Alias /jsp-examples "C:/Tomcat/webapps/jsp-examples/"
    >
    > <Directory "C:/Tomcat/webapps/jsp-examples/">
    > Options Indexes +FollowSymLinks
    > AllowOverride None
    > Allow from all
    > </Directory>
    >
    > JkMount /jsp-examples/*.jsp example
    >
    > Alias /servlets-examples "C:/Tomcat/webapps/servlets-examples/"
    >
    > <Directory "C:/Tomcat/webapps/servlets-examples/">
    > Options Indexes +FollowSymLinks
    > AllowOverride None
    > Allow from all
    > </Directory>
    >
    > JkMount /servlets-examples/* example
    >
    > #now here is my stuff, which isn;t working ###################
    > #my servlet.class file is in C:\Tomcat\webapps\a_domain\WEB-INF\classes
    >
    > Alias /a_domain/servlets "C:/Tomcat/webapps/a_domain/"
    >
    > <Directory "C:/Tomcat/webapps/a_domain/">
    > Options Indexes +FollowSymLinks
    > AllowOverride None
    > Allow from all
    > </Directory>
    >
    > JkMount /a_domain/servlets/* example
    >
    > <Location /*/WEB-INF/*>
    > AllowOverride None
    > deny from all
    > </Location>
    > </IfModule>
    >
    >
    >
    >


    You need to add a JkMount for the myservlet program you are trying to run.

    I never added an Alias, Location nor Directory for servlets-examples.

    This is all I added for jsp-examples:

    JkWorkersFile "conf/workers.properties"
    JkLogFile "logs/mod_jk.log"
    JkLogLevel error

    JkMount /jsp-examples default
    JkMount /jsp-examples/* default

    --
    Thanks in Advance...
    IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
    __________________________________________________________________________

    'If there is one, Knowledge is the "Fountain of Youth"'
    -William E. Taylor, Regular Guy (1952-)
     
    IchBin, Sep 30, 2006
    #2
    1. Advertising

  3. Ike

    Ike Guest

    I cannot understand why this is so seemingly complicated.

    I have C:\Tomcat as CATALINA_HOME

    Everything should go under webapps/ROOT

    I have a servlet, myservlet.class.

    I put it in C:\Tomcat\webapps\ROOT\classes.

    Im just down to what I need to put into httpd.conf, but there really is no
    documetnation I can find on this very simple exercise. Can someone who is
    doing this please explain what would go into httpd.conf using I am using
    mod_jk. Thanks, Ike
     
    Ike, Oct 1, 2006
    #3
  4. Ike

    Ike Guest

    OK....I got it (finally, despite the stupid pills)....

    myservlet.class goes in C:\Tomcat\webapps\gg\WEB-INF\classes.

    httpd.conf gets:

    JkMount /gg/servlet/* example

    now, if I hit:
    http://localhost/gg/servlet/myservlet

    it is invoked by tomcat. If I hit

    http://localhost/gg

    then it invokes the /htdocs under Apache for the typical Apache webserver --
    exactly as I want. -Ike
     
    Ike, Oct 1, 2006
    #4
  5. Ike

    Simon Brooke Guest

    in message <6YvTg.8076$>, Ike
    ('') wrote:

    > I am trying to set up Tomcat 5.0.28 to run under an Apache Web Server
    > 2.0.59. I have the correct mod_jk.so and have everything set up just fine
    > on a Windows XP SP2 box.
    >
    > My CATALINA_HOME directory is C:\Tomcat
    >
    > Everything works fine with the examples for
    > C:\Tomcat\webapps\servlets-examples. Additionally, everythging works fine
    > with the Apache web server taking the static content as it should, and
    > Tomcat taking on the servlets.
    >
    > What I want to do is have it so that when I call
    > {a_domain}/servlets/myservlet that the myservlet be executed. But I
    > {cannot
    > seem to get it to do this. My problem is in my httpd.conf file, and I
    > have tried copying from that portion of it (which works) for
    > servlets-examples. (Addtionally, I will have multiple and different
    > a_domain's)


    <VirtualHost 217.34.156.188>
    ServerAdmin
    ServerName www.stewartry-wheelers.org
    DocumentRoot /home/wheelers/public_html/
    ErrorLog /var/log/apache/wheelers_error.log
    TransferLog /var/log/apache/wheelers_access.log
    JkMount /wheelers/* ajp13
    JkMount /wheelerswiki/* ajp13
    </VirtualHost>

    <VirtualHost 217.34.156.188>
    ServerAdmin
    ServerName www.7-24.org.uk
    DocumentRoot /home/seven24/public_html/
    ErrorLog /var/log/apache/7-24_error.log
    TransferLog /var/log/apache/7-24_access.log
    JkMount /seven24/* ajp13
    </VirtualHost>

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/
     
    Simon Brooke, Oct 1, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christos Gravvanis
    Replies:
    0
    Views:
    2,052
    Christos Gravvanis
    Jul 7, 2004
  2. twins
    Replies:
    1
    Views:
    5,868
  3. Marcin Cenkier
    Replies:
    1
    Views:
    5,428
    Marcin Cenkier
    Apr 12, 2006
  4. BIG BOY
    Replies:
    13
    Views:
    36,853
    manoj212077
    Sep 19, 2009
  5. Andi
    Replies:
    5
    Views:
    1,335
Loading...

Share This Page