You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Musomi Motilewa <mo...@islandcafe.net> on 2003/04/23 05:58:41 UTC

Servlet Execution with Virtual Hosts and Invoker Problems

Hi All-

I'm running Apache 1.3.27, Tomcat 4.1.24 and mod_jk on Gentoo 1.4 RC3. 
I'm using IP based virtual hosting on the server to mirror five live 
sites that I work on. The apache-based sites are functioning fine but 
I'm running into trouble getting Tomcat to work. So far I've only tried 
to set up one of the sites; here is my situation.

I'm able to run *.jsp pages from anywhere in the site, but when I try to 
access *.class files in the /servlet directory I get a 404 error. The 
strange thing is if I type http://ymusic.homedomain.com/servlet, I get 
the directory list of the /WEB-INF/classes directory for the site. 
Clicking on the class file in the directory list renders the class code 
(http://ymusic.homedomain.com/servlet/HelloWorld.class). Trying to 
access http://ymusic.homedomain.com/servlet/HelloWorld, gives a 404 
error (HTTP Status 404 - /servlet/HelloWorld).

Another strange thing I've noticed is that the title of the directory 
list for http://ymusic.homedomain.com/servlet/ is, Directory Listing For 
/. I would have thought I would be, Directory Listing For /servlet.

Any help would be appreciated. Thanks.

-Musomi


Here are the specifics of my installation.

Location:

    /home/ymusic/public_html
    /home/ymusic/public_html/WEB-INF/classes
    /home/ymusic/public_html/WEB-INF/lib
    /home/ymusic/public_html/WEB-INF/web.xml

Apache.conf:

    <VirtualHost 10.1.10.101>
        DocumentRoot /home/ymusic/public_html
        ServerName ymusic.homedomain.com
        AccessFileName .htaccess
    
        JkMount /*.jsp ajp13
        JkMount /servlet/* ajp13
        
        <Location "/WEB-INF/">
            AllowOverride None
            deny from all
        </Location>
    </VirtualHost>

Server.xml:

    <!-- Define an Apache-Connector Service -->
    <Service name="Tomcat-Apache">
      <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
                 port="8013" minProcessors="5" maxProcessors="75"
                 acceptCount="10" debug="0"/>
    
      <Engine name="Apache" debug="0">
        <Logger className="org.apache.catalina.logger.FileLogger"
                prefix="apache_log." suffix=".txt"
                timestamp="true"/>
                
        <Realm className="org.apache.catalina.realm.MemoryRealm" />
        
        <Host name="ymusic.homedomain.com" debug="0" 
appBase="/home/ymusic/public_html" unpackWARs="true">
            <Context path="" docBase="" debug="0" reloadable="true" 
crossContext="true" />
            <Context path="/servlet" docBase="WEB-INF/classes" debug="0" 
reloadable="true" crossContex="true" />
        </Host>
        
        <Host name="localhost" debug="0" appBase="webapps" 
unpackWARs="true" />
      </Engine>  
    </Service>

web.xml (invoker is defined in the default web.xml):

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
         PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    
        <servlet-mapping>
            <servlet-name>invoker</servlet-name>
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    
    </web-app>

Worker.properties:

    # workers.apache_log=/etc/apache/log/
    workers.tomcat_home=/opt/tomcat
    workers.java_home=/opt/blackdown-jdk-1.3.1
    ps=/
    
    worker.list=ajp13
    
    worker.ajp13.port=8013
    worker.ajp13.host=localhost
    worker.ajp13.type=ajp13
    worker.ajp13.cachesize=10
    worker.ajp13.cache_timeout=600
    worker.ajp13.socket_keepalive=1
    worker.ajp13.socket_timeout=300



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by Bill Barker <wb...@wilshire.com>.
Adding a:
  JkMount /servlet ajp13
should get rid of the really scary directory listing.  But please re-post to
http://nagoya.apache.org/bugzilla so that it doesn't get lost in the
traffic.

You also need to uncomment the <servlet> section in conf/web.xml if you want
to enable the Invoker servlet.

"Musomi Motilewa" <mo...@islandcafe.net> wrote in message
news:3EA60F71.4020700@islandcafe.net...
> Hi All-
>
> I'm running Apache 1.3.27, Tomcat 4.1.24 and mod_jk on Gentoo 1.4 RC3.
> I'm using IP based virtual hosting on the server to mirror five live
> sites that I work on. The apache-based sites are functioning fine but
> I'm running into trouble getting Tomcat to work. So far I've only tried
> to set up one of the sites; here is my situation.
>
> I'm able to run *.jsp pages from anywhere in the site, but when I try to
> access *.class files in the /servlet directory I get a 404 error. The
> strange thing is if I type http://ymusic.homedomain.com/servlet, I get
> the directory list of the /WEB-INF/classes directory for the site.
> Clicking on the class file in the directory list renders the class code
> (http://ymusic.homedomain.com/servlet/HelloWorld.class). Trying to
> access http://ymusic.homedomain.com/servlet/HelloWorld, gives a 404
> error (HTTP Status 404 - /servlet/HelloWorld).
>
> Another strange thing I've noticed is that the title of the directory
> list for http://ymusic.homedomain.com/servlet/ is, Directory Listing For
> /. I would have thought I would be, Directory Listing For /servlet.
>
> Any help would be appreciated. Thanks.
>
> -Musomi
>
>
> Here are the specifics of my installation.
>
> Location:
>
>     /home/ymusic/public_html
>     /home/ymusic/public_html/WEB-INF/classes
>     /home/ymusic/public_html/WEB-INF/lib
>     /home/ymusic/public_html/WEB-INF/web.xml
>
> Apache.conf:
>
>     <VirtualHost 10.1.10.101>
>         DocumentRoot /home/ymusic/public_html
>         ServerName ymusic.homedomain.com
>         AccessFileName .htaccess
>
>         JkMount /*.jsp ajp13
>         JkMount /servlet/* ajp13
>
>         <Location "/WEB-INF/">
>             AllowOverride None
>             deny from all
>         </Location>
>     </VirtualHost>
>
> Server.xml:
>
>     <!-- Define an Apache-Connector Service -->
>     <Service name="Tomcat-Apache">
>       <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
>                  port="8013" minProcessors="5" maxProcessors="75"
>                  acceptCount="10" debug="0"/>
>
>       <Engine name="Apache" debug="0">
>         <Logger className="org.apache.catalina.logger.FileLogger"
>                 prefix="apache_log." suffix=".txt"
>                 timestamp="true"/>
>
>         <Realm className="org.apache.catalina.realm.MemoryRealm" />
>
>         <Host name="ymusic.homedomain.com" debug="0"
> appBase="/home/ymusic/public_html" unpackWARs="true">
>             <Context path="" docBase="" debug="0" reloadable="true"
> crossContext="true" />
>             <Context path="/servlet" docBase="WEB-INF/classes" debug="0"
> reloadable="true" crossContex="true" />
>         </Host>
>
>         <Host name="localhost" debug="0" appBase="webapps"
> unpackWARs="true" />
>       </Engine>
>     </Service>
>
> web.xml (invoker is defined in the default web.xml):
>
>     <?xml version="1.0" encoding="ISO-8859-1"?>
>     <!DOCTYPE web-app
>          PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>         "http://java.sun.com/dtd/web-app_2_3.dtd">
>     <web-app>
>
>         <servlet-mapping>
>             <servlet-name>invoker</servlet-name>
>             <url-pattern>/servlet/*</url-pattern>
>         </servlet-mapping>
>
>     </web-app>
>
> Worker.properties:
>
>     # workers.apache_log=/etc/apache/log/
>     workers.tomcat_home=/opt/tomcat
>     workers.java_home=/opt/blackdown-jdk-1.3.1
>     ps=/
>
>     worker.list=ajp13
>
>     worker.ajp13.port=8013
>     worker.ajp13.host=localhost
>     worker.ajp13.type=ajp13
>     worker.ajp13.cachesize=10
>     worker.ajp13.cache_timeout=600
>     worker.ajp13.socket_keepalive=1
>     worker.ajp13.socket_timeout=300




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
This is pretty basic and appears to be issues with your configuration. 
See comments below.

Musomi Motilewa wrote:
> Hi All-
> 
> I'm running Apache 1.3.27, Tomcat 4.1.24 and mod_jk on Gentoo 1.4 RC3. 
> I'm using IP based virtual hosting on the server to mirror five live 
> sites that I work on. The apache-based sites are functioning fine but 
> I'm running into trouble getting Tomcat to work. So far I've only tried 
> to set up one of the sites; here is my situation.
> 
> I'm able to run *.jsp pages from anywhere in the site, but when I try to 
> access *.class files in the /servlet directory I get a 404 error. 

Referencing servlets via URI's can't have the .class extension.

> The 
> strange thing is if I type http://ymusic.homedomain.com/servlet, I get 
> the directory list of the /WEB-INF/classes directory for the site. 

Maybe your blocking of WEB-INF is broken, try:

<Location WEB-INF>
       AllowOverride None
       deny from all
</Location>

> Clicking on the class file in the directory list renders the class code 
> (http://ymusic.homedomain.com/servlet/HelloWorld.class). Trying to 
> access http://ymusic.homedomain.com/servlet/HelloWorld, gives a 404 
> error (HTTP Status 404 - /servlet/HelloWorld).
> 
> Another strange thing I've noticed is that the title of the directory 
> list for http://ymusic.homedomain.com/servlet/ is, Directory Listing For 
> /. I would have thought I would be, Directory Listing For /servlet.
> 

This looks wrong in your server.xml

 >            <Context path="/servlet" docBase="WEB-INF/classes" 
debug="0" reloadable="true" crossContex="true" />

you shouldn't map the /servlet context like this, just the root of your 
directory like you've done in

<Context path="" docBase="" debug="0" reloadable="true"
 > crossContext="true" />

this may be causing the above problems as well.

-Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
I'm the most experience person at this, I'm sure others on this list 
might see things that aren't obvious to me.

Question: Why are you so concerned about manipulating the invoker 
itself? In /var/tomcat4/conf/web.xml, tomcat sets up an invoker servlet 
for all webapplications, why do you need manipulate this? In fact, I 
believe all calls pass transparently to this default invoker in tomcat.

Virtual hosting in apache is pretty clear. We use Virtual hosting to 
setup https for our site. We currently just let Tomcat handle all our 
requests to /VDC/* But we could replace this easily with "JKMount 
/VDC/*.jsp ajp13" and "JKMount /VDC/servlets/* ajp13" too. We do this 
because, in reality, servlets can be mapped to any URI under /VDC/*.

in httpd.conf we have:

<IfDefine HAVE_JK>
    LoadModule jk_module modules/mod_jk.so
    Include /etc/httpd/conf/mod_jk.conf
</IfDefine>

<VirtualHost xxx.xxx.xxx.xxx>
    ServerName your.virtual.host.here

  <IfModule mod_jk.c>

     JKMount /VDC/* ajp13

     Alias /VDC/ "/var/tomcat4/webapps/VDC/"

     <Location WEB-INF>
       AllowOverride None
       deny from all
     </Location>
   </IfModule>

</VirtualHost>

NameVirtualHost xxx.xxx.xxx.xxx:443

<VirtualHost xxx.xxx.xxx.xxx:443>
    ServerName your.virtual.host.here

  <IfModule mod_jk.c>

     JKMount /VDC/* ajp13

     Alias /VDC/ "/var/tomcat4/webapps/VDC/"

     <Location WEB-INF>
       AllowOverride None
       deny from all
     </Location>
   </IfModule>

</VirtualHost>

---

in my current server.xml, all I have is (Minus comments and logging).

<?xml version="1.0" encoding="UTF-8"?>
<Server port="8005" shutdown="SHUTDOWN" debug="0">

   <Service name="Tomcat-Standalone">

    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
    port="8009" minProcessors="5" maxProcessors="75"
    enableLookups="false" redirectPort="443" acceptCount="10" debug="0"
    connectionTimeout="0" useURIValidationHack="false"
    protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

    <Engine name="Standalone" defaultHost="localhost" debug="0">

       <Host name="localhost" debug="0" appBase="webapps"
       unpackWARs="true" autoDeploy="true">

          <Context debug="0" reloadable="true"
          docBase="VDC" path="/VDC"/>

       </Host>

    </Engine>

  </Service>

</Server>

---

Our workers.properties just looks like this:

workers.tomcat_home=/var/tomcat4
ps=/
worker.list=ajp13

worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1

worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13

---

The one other thing I never seen doc is that we add the apache user to 
the tomcat4 group in Linux and set the permissions on the 
/var/tomcat4/webapps directory to a+rx.

The only differences between this and what your trying, is that your 
docBase is outside the /var/tomcat4/webapps directory and your mapping 
your context to be the ROOT in that virtual host.

          <Context debug="0" reloadable="true"
          docBase="XXX" path=""/>

-Mark

Musomi Motilewa wrote:
> Alright... I'm still getting the 404 errors. Are there any sites that do 
> a step-by-step setup of a tomcat-apache combination using an invoker and 
> virtual hosts?
> 
> Mark R. Diggory wrote:
> 
>>
>>
>> Musomi Motilewa wrote:
>>
>>> See comments below for your questions. Hope this clarifies things. 
>>> Sorry about the confusion.
>>>
>>> -Musomi
>>>
>>> Mark R. Diggory wrote:
>>>
>>>> Hey, I'm just "Joe User" trying to get by same as you. ;-)
>>>>
>>>> Musomi Motilewa wrote:
>>>>
>>>>> Hi-
>>>>>
>>>>> Let me clarify my initial email below. My main problem is that the 
>>>>> servlets are not being executed when I load them using 
>>>>> http://ymusic.homedomain.com/servlet/servletName. I don't mind 
>>>>> having the /servlet directory listed when it is accessed using 
>>>>> http://ymusic.homedomain.com/servlet/ or the code of the servlet 
>>>>> displayed when its accessed using 
>>>>> http://ymusic.homedomain.com/servlet/servletName.class.
>>>>>
>>>>> At this point any URL that contains /servlet/* is processed by 
>>>>> tomcat, which is what I want it to do.
>>>>
>>>>
>>>>
>>>>
>>>> This is unclear, it sounds like your saying you *can* execute the 
>>>> servlet using /servlet/HelloWorld?
>>>
>>>
>>>
>>>
>>>
>>> None of the servlets are being executed.
>>> Tomcat catches all URLs that contain 
>>> http://ymusic.homedomain.com/servlet/
>>> http://ymusic.homedomain.com/servlet/ - lists the contents of the 
>>> servlet directory, which is the WEB-INF/classes directory
>>> http://ymusic.homedomain.com/servlet/servletName*.class* - which is a 
>>> link to the class file, returns the code for the class
>>> http://ymusic.homedomain.com/servlet/servletName - which is a link to 
>>> the servlet returns a 404 error
>>
>>
>>
>> Here's a thought, consider looking at the default server.xml provided 
>> by tomcat, you will see a layout that looks like this:
>>
>> <Engine name="Standalone" defaultHost="localhost" debug="0">
>>     <!-- Define the default virtual host -->
>>     *<Host name="localhost" debug="0" appBase="webapps" 
>> unpackWARs="true" autoDeploy="true">*
>>         <!-- Tomcat Root Context -->
>>               *<Context path="" docBase="ROOT" debug="0"/>*
>>         <!-- Tomcat Examples Context -->
>>         <Context path="/examples" docBase="examples" debug="0" 
>> reloadable="true" crossContext="true">
>>             ...
>>         </Context>
>>     </Host>
>> </Engine>
>>
>> Notice that while the path for the ROOT Context is "", that the 
>> docBase is in the directory ROOT (ie /var/tomcat4/webapps/ROOT). It 
>> may be the case that the <host docBase="..."> shouldn't be the 
>> directory of your webapplication itself. Maybe your config should have 
>> its host in "/home/ymusic" and the contexts docbase in "public_html", 
>> while keeping the the contexts path "", like this:
>>
>> <!-- Define an Apache-Connector Service -->
>> <Service name="Tomcat-Apache">
>>     <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
>>         port="8013" minProcessors="5" maxProcessors="75"
>>         acceptCount="10" debug="0"/>
>>     <Engine name="Apache" debug="0">
>>         <Logger            
>> className="org.apache.catalina.logger.FileLogger"
>>         prefix="apache_log." suffix=".txt"
>>         timestamp="true"/>
>>         <Realm
>>         className="org.apache.catalina.realm.MemoryRealm" />
>>         <Host name="ymusic.homedomain.com" debug="0"
>>         appBase="/home/ymusic" unpackWARs="true">
>>                     <Context path="" docBase="public_html" debug="0"
>>             reloadable="true"
>>             crossContext="true" />
>>         </Host>
>>     </Engine>
>> </Service>
>>
>>>
>>>>
>>>>> However I noticed the directory listing of the /servlet directory 
>>>>> via Tomcat is coming up as "Directory listing for /" instead of 
>>>>> "Directory listing for /servlet". I think this is one idication of 
>>>>> why I'm getting 404 errors when I try to load the servlets.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Again now it sounds like your saying the opposite, it sounds like 
>>>> your saying you *can't* execute the servlet using 
>>>> /servlet/HelloWorld and get a 404? 
>>>
>>>
>>>
>>>
>>>
>>> The servlets aren't being executed, but the servlet directory is 
>>> being listed. Youc an see all the *.class* files stored in the 
>>> WEB-INF/classes directory.
>>> Tomcat renders this list. The thing is the listing is labeled as the 
>>> directory listing for "/" not "/servlet". As if Tomcat sees the 
>>> /servlet directory as the root directory.
>>> On the other hand the 404 errors when I try to access the servlets 
>>> have "/servlet/servletName", which seems to indicate its looking for 
>>> the servlets in the /servlet path.
>>>
>>>>
>>>>> I've tried removing the following context from the server.xml file:
>>>>>
>>>> you really shouldn't be mounting the /servlet directory as a 
>>>> context, its not the way the configuration works:
>>>>
>>>> <Context> is for a Webapplication mount point with the following 
>>>> directory/war structure.
>>>>
>>>> path/WEB-INF/web.xml
>>>> path/WEB-INF/classes
>>>> path/WEB-INF/lib
>>>>
>>>> the context makes the webapplication available in tomcat. Context is 
>>>> not a directive to expose directories in Tomcat. I doubt its very 
>>>> logical to mount a directory in an webapplication as another 
>>>> webapplication.
>>>
>>>
>>>
>>>
>>>
>>> That is exactly what I want. I want to be able to call class files 
>>> stored in the WEB-INF/classes folder from jsp pages and URLS in the 
>>> site. This is the directory structure I have.
>>>
>>>   /home/ymusic/public_html
>>>   /home/ymusic/public_html/WEB-INF/classes
>>>   /home/ymusic/public_html/WEB-INF/lib
>>>   /home/ymusic/public_html/WEB-INF/web.xml
>>>
>>
>> Get your public_html webapplication mounted properly and it will be 
>> taking care of this accessability for you. Thats the job of the 
>> webapplication.
>>
>>> Tomcat is delivering the 404 error pages.
>>>
>>
>> In which case I think its your server.xml thats breaking things.
>>
>> -Mark
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by Musomi Motilewa <mo...@islandcafe.net>.
Alright... I'm still getting the 404 errors. Are there any sites that do 
a step-by-step setup of a tomcat-apache combination using an invoker and 
virtual hosts?

Mark R. Diggory wrote:

>
>
> Musomi Motilewa wrote:
>
>> See comments below for your questions. Hope this clarifies things. 
>> Sorry about the confusion.
>>
>> -Musomi
>>
>> Mark R. Diggory wrote:
>>
>>> Hey, I'm just "Joe User" trying to get by same as you. ;-)
>>>
>>> Musomi Motilewa wrote:
>>>
>>>> Hi-
>>>>
>>>> Let me clarify my initial email below. My main problem is that the 
>>>> servlets are not being executed when I load them using 
>>>> http://ymusic.homedomain.com/servlet/servletName. I don't mind 
>>>> having the /servlet directory listed when it is accessed using 
>>>> http://ymusic.homedomain.com/servlet/ or the code of the servlet 
>>>> displayed when its accessed using 
>>>> http://ymusic.homedomain.com/servlet/servletName.class.
>>>>
>>>> At this point any URL that contains /servlet/* is processed by 
>>>> tomcat, which is what I want it to do.
>>>
>>>
>>>
>>> This is unclear, it sounds like your saying you *can* execute the 
>>> servlet using /servlet/HelloWorld?
>>
>>
>>
>>
>> None of the servlets are being executed.
>> Tomcat catches all URLs that contain 
>> http://ymusic.homedomain.com/servlet/
>> http://ymusic.homedomain.com/servlet/ - lists the contents of the 
>> servlet directory, which is the WEB-INF/classes directory
>> http://ymusic.homedomain.com/servlet/servletName*.class* - which is a 
>> link to the class file, returns the code for the class
>> http://ymusic.homedomain.com/servlet/servletName - which is a link to 
>> the servlet returns a 404 error
>
>
> Here's a thought, consider looking at the default server.xml provided 
> by tomcat, you will see a layout that looks like this:
>
> <Engine name="Standalone" defaultHost="localhost" debug="0">
>     <!-- Define the default virtual host -->
>     *<Host name="localhost" debug="0" appBase="webapps" 
> unpackWARs="true" autoDeploy="true">*
>         <!-- Tomcat Root Context -->
>               *<Context path="" docBase="ROOT" debug="0"/>*
>         <!-- Tomcat Examples Context -->
>         <Context path="/examples" docBase="examples" debug="0" 
> reloadable="true" crossContext="true">
>             ...
>         </Context>
>     </Host>
> </Engine>
>
> Notice that while the path for the ROOT Context is "", that the 
> docBase is in the directory ROOT (ie /var/tomcat4/webapps/ROOT). It 
> may be the case that the <host docBase="..."> shouldn't be the 
> directory of your webapplication itself. Maybe your config should have 
> its host in "/home/ymusic" and the contexts docbase in "public_html", 
> while keeping the the contexts path "", like this:
>
> <!-- Define an Apache-Connector Service -->
> <Service name="Tomcat-Apache">
>     <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
>         port="8013" minProcessors="5" maxProcessors="75"
>         acceptCount="10" debug="0"/>
>     <Engine name="Apache" debug="0">
>         <Logger    
>         className="org.apache.catalina.logger.FileLogger"
>         prefix="apache_log." suffix=".txt"
>         timestamp="true"/>
>         <Realm
>         className="org.apache.catalina.realm.MemoryRealm" />
>         <Host name="ymusic.homedomain.com" debug="0"
>         appBase="/home/ymusic" unpackWARs="true">
>                     <Context path="" docBase="public_html" debug="0"
>             reloadable="true"
>             crossContext="true" />
>         </Host>
>     </Engine>
> </Service>
>
>>
>>>
>>>> However I noticed the directory listing of the /servlet directory 
>>>> via Tomcat is coming up as "Directory listing for /" instead of 
>>>> "Directory listing for /servlet". I think this is one idication of 
>>>> why I'm getting 404 errors when I try to load the servlets.
>>>
>>>
>>>
>>>
>>> Again now it sounds like your saying the opposite, it sounds like 
>>> your saying you *can't* execute the servlet using 
>>> /servlet/HelloWorld and get a 404? 
>>
>>
>>
>>
>> The servlets aren't being executed, but the servlet directory is 
>> being listed. Youc an see all the *.class* files stored in the 
>> WEB-INF/classes directory.
>> Tomcat renders this list. The thing is the listing is labeled as the 
>> directory listing for "/" not "/servlet". As if Tomcat sees the 
>> /servlet directory as the root directory.
>> On the other hand the 404 errors when I try to access the servlets 
>> have "/servlet/servletName", which seems to indicate its looking for 
>> the servlets in the /servlet path.
>>
>>>
>>>> I've tried removing the following context from the server.xml file:
>>>>
>>> you really shouldn't be mounting the /servlet directory as a 
>>> context, its not the way the configuration works:
>>>
>>> <Context> is for a Webapplication mount point with the following 
>>> directory/war structure.
>>>
>>> path/WEB-INF/web.xml
>>> path/WEB-INF/classes
>>> path/WEB-INF/lib
>>>
>>> the context makes the webapplication available in tomcat. Context is 
>>> not a directive to expose directories in Tomcat. I doubt its very 
>>> logical to mount a directory in an webapplication as another 
>>> webapplication.
>>
>>
>>
>>
>> That is exactly what I want. I want to be able to call class files 
>> stored in the WEB-INF/classes folder from jsp pages and URLS in the 
>> site. This is the directory structure I have.
>>
>>   /home/ymusic/public_html
>>   /home/ymusic/public_html/WEB-INF/classes
>>   /home/ymusic/public_html/WEB-INF/lib
>>   /home/ymusic/public_html/WEB-INF/web.xml
>>
>
> Get your public_html webapplication mounted properly and it will be 
> taking care of this accessability for you. Thats the job of the 
> webapplication.
>
>> Tomcat is delivering the 404 error pages.
>>
>
> In which case I think its your server.xml thats breaking things.
>
> -Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.

Musomi Motilewa wrote:
> See comments below for your questions. Hope this clarifies things. Sorry 
> about the confusion.
> 
> -Musomi
> 
> Mark R. Diggory wrote:
> 
>> Hey, I'm just "Joe User" trying to get by same as you. ;-)
>>
>> Musomi Motilewa wrote:
>>
>>> Hi-
>>>
>>> Let me clarify my initial email below. My main problem is that the 
>>> servlets are not being executed when I load them using 
>>> http://ymusic.homedomain.com/servlet/servletName. I don't mind having 
>>> the /servlet directory listed when it is accessed using 
>>> http://ymusic.homedomain.com/servlet/ or the code of the servlet 
>>> displayed when its accessed using 
>>> http://ymusic.homedomain.com/servlet/servletName.class.
>>>
>>> At this point any URL that contains /servlet/* is processed by 
>>> tomcat, which is what I want it to do.
>>
>>
>> This is unclear, it sounds like your saying you *can* execute the 
>> servlet using /servlet/HelloWorld?
> 
> 
> 
> None of the servlets are being executed.
> Tomcat catches all URLs that contain http://ymusic.homedomain.com/servlet/
> http://ymusic.homedomain.com/servlet/ - lists the contents of the 
> servlet directory, which is the WEB-INF/classes directory
> http://ymusic.homedomain.com/servlet/servletName*.class* - which is a 
> link to the class file, returns the code for the class
> http://ymusic.homedomain.com/servlet/servletName - which is a link to 
> the servlet returns a 404 error

Here's a thought, consider looking at the default server.xml provided by 
tomcat, you will see a layout that looks like this:

<Engine name="Standalone" defaultHost="localhost" debug="0">
	<!-- Define the default virtual host -->
	*<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" 
autoDeploy="true">*
		<!-- Tomcat Root Context -->
           	*<Context path="" docBase="ROOT" debug="0"/>*
		<!-- Tomcat Examples Context -->
		<Context path="/examples" docBase="examples" debug="0" 
reloadable="true" crossContext="true">
			...
		</Context>
	</Host>
</Engine>

Notice that while the path for the ROOT Context is "", that the docBase 
is in the directory ROOT (ie /var/tomcat4/webapps/ROOT). It may be the 
case that the <host docBase="..."> shouldn't be the directory of your 
webapplication itself. Maybe your config should have its host in 
"/home/ymusic" and the contexts docbase in "public_html", while keeping 
the the contexts path "", like this:

<!-- Define an Apache-Connector Service -->
<Service name="Tomcat-Apache">
	<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
         port="8013" minProcessors="5" maxProcessors="75"
         acceptCount="10" debug="0"/>
	<Engine name="Apache" debug="0">
		<Logger 	
		className="org.apache.catalina.logger.FileLogger"
		prefix="apache_log." suffix=".txt"
		timestamp="true"/>
		<Realm
		className="org.apache.catalina.realm.MemoryRealm" />
		<Host name="ymusic.homedomain.com" debug="0"
		appBase="/home/ymusic" unpackWARs="true">
             		<Context path="" docBase="public_html" debug="0"
			reloadable="true"
			crossContext="true" />
		</Host>
	</Engine>
</Service>
> 
>>
>>> However I noticed the directory listing of the /servlet directory via 
>>> Tomcat is coming up as "Directory listing for /" instead of 
>>> "Directory listing for /servlet". I think this is one idication of 
>>> why I'm getting 404 errors when I try to load the servlets.
>>
>>
>>
>> Again now it sounds like your saying the opposite, it sounds like your 
>> saying you *can't* execute the servlet using /servlet/HelloWorld and 
>> get a 404? 
> 
> 
> 
> The servlets aren't being executed, but the servlet directory is being 
> listed. Youc an see all the *.class* files stored in the WEB-INF/classes 
> directory.
> Tomcat renders this list. The thing is the listing is labeled as the 
> directory listing for "/" not "/servlet". As if Tomcat sees the /servlet 
> directory as the root directory.
> On the other hand the 404 errors when I try to access the servlets have 
> "/servlet/servletName", which seems to indicate its looking for the 
> servlets in the /servlet path.
> 
>>
>>> I've tried removing the following context from the server.xml file:
>>>
>> you really shouldn't be mounting the /servlet directory as a context, 
>> its not the way the configuration works:
>>
>> <Context> is for a Webapplication mount point with the following 
>> directory/war structure.
>>
>> path/WEB-INF/web.xml
>> path/WEB-INF/classes
>> path/WEB-INF/lib
>>
>> the context makes the webapplication available in tomcat. Context is 
>> not a directive to expose directories in Tomcat. I doubt its very 
>> logical to mount a directory in an webapplication as another 
>> webapplication.
> 
> 
> 
> That is exactly what I want. I want to be able to call class files 
> stored in the WEB-INF/classes folder from jsp pages and URLS in the 
> site. This is the directory structure I have.
> 
>   /home/ymusic/public_html
>   /home/ymusic/public_html/WEB-INF/classes
>   /home/ymusic/public_html/WEB-INF/lib
>   /home/ymusic/public_html/WEB-INF/web.xml
> 

Get your public_html webapplication mounted properly and it will be 
taking care of this accessability for you. Thats the job of the 
webapplication.

> Tomcat is delivering the 404 error pages.
> 

In which case I think its your server.xml thats breaking things.

-Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by Musomi Motilewa <mo...@islandcafe.net>.
See comments below for your questions. Hope this clarifies things. Sorry 
about the confusion.

-Musomi

Mark R. Diggory wrote:

> Hey, I'm just "Joe User" trying to get by same as you. ;-)
>
> Musomi Motilewa wrote:
>
>> Hi-
>>
>> Let me clarify my initial email below. My main problem is that the 
>> servlets are not being executed when I load them using 
>> http://ymusic.homedomain.com/servlet/servletName. I don't mind having 
>> the /servlet directory listed when it is accessed using 
>> http://ymusic.homedomain.com/servlet/ or the code of the servlet 
>> displayed when its accessed using 
>> http://ymusic.homedomain.com/servlet/servletName.class.
>>
>> At this point any URL that contains /servlet/* is processed by 
>> tomcat, which is what I want it to do.
>
> This is unclear, it sounds like your saying you *can* execute the 
> servlet using /servlet/HelloWorld?


None of the servlets are being executed.
Tomcat catches all URLs that contain http://ymusic.homedomain.com/servlet/
http://ymusic.homedomain.com/servlet/ - lists the contents of the 
servlet directory, which is the WEB-INF/classes directory
http://ymusic.homedomain.com/servlet/servletName*.class* - which is a 
link to the class file, returns the code for the class
http://ymusic.homedomain.com/servlet/servletName - which is a link to 
the servlet returns a 404 error

>
>> However I noticed the directory listing of the /servlet directory via 
>> Tomcat is coming up as "Directory listing for /" instead of 
>> "Directory listing for /servlet". I think this is one idication of 
>> why I'm getting 404 errors when I try to load the servlets.
>
>
> Again now it sounds like your saying the opposite, it sounds like your 
> saying you *can't* execute the servlet using /servlet/HelloWorld and 
> get a 404? 


The servlets aren't being executed, but the servlet directory is being 
listed. Youc an see all the *.class* files stored in the WEB-INF/classes 
directory.
Tomcat renders this list. The thing is the listing is labeled as the 
directory listing for "/" not "/servlet". As if Tomcat sees the /servlet 
directory as the root directory.
On the other hand the 404 errors when I try to access the servlets have 
"/servlet/servletName", which seems to indicate its looking for the 
servlets in the /servlet path.

>
>> I've tried removing the following context from the server.xml file:
>>
> you really shouldn't be mounting the /servlet directory as a context, 
> its not the way the configuration works:
>
> <Context> is for a Webapplication mount point with the following 
> directory/war structure.
>
> path/WEB-INF/web.xml
> path/WEB-INF/classes
> path/WEB-INF/lib
>
> the context makes the webapplication available in tomcat. Context is 
> not a directive to expose directories in Tomcat. I doubt its very 
> logical to mount a directory in an webapplication as another 
> webapplication.


That is exactly what I want. I want to be able to call class files 
stored in the WEB-INF/classes folder from jsp pages and URLS in the 
site. This is the directory structure I have.

   /home/ymusic/public_html
   /home/ymusic/public_html/WEB-INF/classes
   /home/ymusic/public_html/WEB-INF/lib
   /home/ymusic/public_html/WEB-INF/web.xml

This is how the hosting services have the accounts setup. You just dump 
your class files into the classes directory and go. This is what I'm 
trying to mimic on my server.

>
>> <Context path="/servlet" docBase="WEB-INF/classes" debug="0" 
>> reloadable="true" crossContex="true" />
>>
>> But then I get 404 errors on the the URL - 
>> http://ymusic.homedomain.com/servlet/ as well as URLs to servlets. 
>> Any other suggestions? The settings of my config files are listed 
>> below. Thanks.
>
>
> Are the 404's delivered by Tomcat or Apache? This will help determine 
> where the mis-configuration is, if delivered by Apache its in your 
> httpd.conf if by tomcat its possibly in tomcat, but could also 
> possibly be in httpd.conf.


Tomcat is delivering the 404 error pages.

>
> -Mark
>
>>
>> -Musomi
>>
>> Musomi Motilewa wrote:
>>
>>> Hi All-
>>>
>>> I'm running Apache 1.3.27, Tomcat 4.1.24 and mod_jk on Gentoo 1.4 
>>> RC3. I'm using IP based virtual hosting on the server to mirror five 
>>> live sites that I work on. The apache-based sites are functioning 
>>> fine but I'm running into trouble getting Tomcat to work. So far 
>>> I've only tried to set up one of the sites; here is my situation.
>>>
>>> I'm able to run *.jsp pages from anywhere in the site, but when I 
>>> try to access *.class files in the /servlet directory I get a 404 
>>> error. The strange thing is if I type 
>>> http://ymusic.homedomain.com/servlet, I get the directory list of 
>>> the /WEB-INF/classes directory for the site. Clicking on the class 
>>> file in the directory list renders the class code 
>>> (http://ymusic.homedomain.com/servlet/HelloWorld.class). Trying to 
>>> access http://ymusic.homedomain.com/servlet/HelloWorld, gives a 404 
>>> error (HTTP Status 404 - /servlet/HelloWorld).
>>>
>>> Another strange thing I've noticed is that the title of the 
>>> directory list for http://ymusic.homedomain.com/servlet/ is, 
>>> Directory Listing For /. I would have thought I would be, Directory 
>>> Listing For /servlet.
>>>
>>> Any help would be appreciated. Thanks.
>>>
>>> -Musomi
>>>
>>>
>>> Here are the specifics of my installation.
>>>
>>> Location:
>>>
>>>    /home/ymusic/public_html
>>>    /home/ymusic/public_html/WEB-INF/classes
>>>    /home/ymusic/public_html/WEB-INF/lib
>>>    /home/ymusic/public_html/WEB-INF/web.xml
>>>
>>> Apache.conf:
>>>
>>>    <VirtualHost 10.1.10.101>
>>>        DocumentRoot /home/ymusic/public_html
>>>        ServerName ymusic.homedomain.com
>>>        AccessFileName .htaccess
>>>           JkMount /*.jsp ajp13
>>>        JkMount /servlet/* ajp13
>>>               <Location "/WEB-INF/">
>>>            AllowOverride None
>>>            deny from all
>>>        </Location>
>>>    </VirtualHost>
>>>
>>> Server.xml:
>>>
>>>    <!-- Define an Apache-Connector Service -->
>>>    <Service name="Tomcat-Apache">
>>>      <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
>>>                 port="8013" minProcessors="5" maxProcessors="75"
>>>                 acceptCount="10" debug="0"/>
>>>         <Engine name="Apache" debug="0">
>>>        <Logger className="org.apache.catalina.logger.FileLogger"
>>>                prefix="apache_log." suffix=".txt"
>>>                timestamp="true"/>
>>>                       <Realm 
>>> className="org.apache.catalina.realm.MemoryRealm" />
>>>               <Host name="ymusic.homedomain.com" debug="0" 
>>> appBase="/home/ymusic/public_html" unpackWARs="true">
>>>            <Context path="" docBase="" debug="0" reloadable="true" 
>>> crossContext="true" />
>>>            <Context path="/servlet" docBase="WEB-INF/classes" 
>>> debug="0" reloadable="true" crossContex="true" />
>>>        </Host>
>>>               <Host name="localhost" debug="0" appBase="webapps" 
>>> unpackWARs="true" />
>>>      </Engine>     </Service>
>>>
>>> web.xml (invoker is defined in the default web.xml):
>>>
>>>    <?xml version="1.0" encoding="ISO-8859-1"?>
>>>    <!DOCTYPE web-app
>>>         PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>>>        "http://java.sun.com/dtd/web-app_2_3.dtd">
>>>    <web-app>
>>>           <servlet-mapping>
>>>            <servlet-name>invoker</servlet-name>
>>>            <url-pattern>/servlet/*</url-pattern>
>>>        </servlet-mapping>
>>>       </web-app>
>>>
>>> Worker.properties:
>>>
>>>    # workers.apache_log=/etc/apache/log/
>>>    workers.tomcat_home=/opt/tomcat
>>>    workers.java_home=/opt/blackdown-jdk-1.3.1
>>>    ps=/
>>>       worker.list=ajp13
>>>       worker.ajp13.port=8013
>>>    worker.ajp13.host=localhost
>>>    worker.ajp13.type=ajp13
>>>    worker.ajp13.cachesize=10
>>>    worker.ajp13.cache_timeout=600
>>>    worker.ajp13.socket_keepalive=1
>>>    worker.ajp13.socket_timeout=300
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Hey, I'm just "Joe User" trying to get by same as you. ;-)

Musomi Motilewa wrote:
> Hi-
> 
> Let me clarify my initial email below. My main problem is that the 
> servlets are not being executed when I load them using 
> http://ymusic.homedomain.com/servlet/servletName. I don't mind having 
> the /servlet directory listed when it is accessed using 
> http://ymusic.homedomain.com/servlet/ or the code of the servlet 
> displayed when its accessed using 
> http://ymusic.homedomain.com/servlet/servletName.class.
> 
> At this point any URL that contains /servlet/* is processed by tomcat, 
> which is what I want it to do. 

This is unclear, it sounds like your saying you *can* execute the 
servlet using /servlet/HelloWorld?

> However I noticed the directory listing 
> of the /servlet directory via Tomcat is coming up as "Directory listing 
> for /" instead of "Directory listing for /servlet". I think this is one 
> idication of why I'm getting 404 errors when I try to load the servlets. 

Again now it sounds like your saying the opposite, it sounds like your 
saying you *can't* execute the servlet using /servlet/HelloWorld and get 
a 404?


> I've tried removing the following context from the server.xml file:
> 
you really shouldn't be mounting the /servlet directory as a context, 
its not the way the configuration works:

<Context> is for a Webapplication mount point with the following 
directory/war structure.

path/WEB-INF/web.xml
path/WEB-INF/classes
path/WEB-INF/lib

the context makes the webapplication available in tomcat. Context is not 
a directive to expose directories in Tomcat. I doubt its very logical to 
mount a directory in an webapplication as another webapplication.

> <Context path="/servlet" docBase="WEB-INF/classes" debug="0" 
> reloadable="true" crossContex="true" />
> 
> But then I get 404 errors on the the URL - 
> http://ymusic.homedomain.com/servlet/ as well as URLs to servlets. Any 
> other suggestions? The settings of my config files are listed below. 
> Thanks.

Are the 404's delivered by Tomcat or Apache? This will help determine 
where the mis-configuration is, if delivered by Apache its in your 
httpd.conf if by tomcat its possibly in tomcat, but could also possibly 
be in httpd.conf.

-Mark

> 
> -Musomi
> 
> Musomi Motilewa wrote:
> 
>> Hi All-
>>
>> I'm running Apache 1.3.27, Tomcat 4.1.24 and mod_jk on Gentoo 1.4 RC3. 
>> I'm using IP based virtual hosting on the server to mirror five live 
>> sites that I work on. The apache-based sites are functioning fine but 
>> I'm running into trouble getting Tomcat to work. So far I've only 
>> tried to set up one of the sites; here is my situation.
>>
>> I'm able to run *.jsp pages from anywhere in the site, but when I try 
>> to access *.class files in the /servlet directory I get a 404 error. 
>> The strange thing is if I type http://ymusic.homedomain.com/servlet, I 
>> get the directory list of the /WEB-INF/classes directory for the site. 
>> Clicking on the class file in the directory list renders the class 
>> code (http://ymusic.homedomain.com/servlet/HelloWorld.class). Trying 
>> to access http://ymusic.homedomain.com/servlet/HelloWorld, gives a 404 
>> error (HTTP Status 404 - /servlet/HelloWorld).
>>
>> Another strange thing I've noticed is that the title of the directory 
>> list for http://ymusic.homedomain.com/servlet/ is, Directory Listing 
>> For /. I would have thought I would be, Directory Listing For /servlet.
>>
>> Any help would be appreciated. Thanks.
>>
>> -Musomi
>>
>>
>> Here are the specifics of my installation.
>>
>> Location:
>>
>>    /home/ymusic/public_html
>>    /home/ymusic/public_html/WEB-INF/classes
>>    /home/ymusic/public_html/WEB-INF/lib
>>    /home/ymusic/public_html/WEB-INF/web.xml
>>
>> Apache.conf:
>>
>>    <VirtualHost 10.1.10.101>
>>        DocumentRoot /home/ymusic/public_html
>>        ServerName ymusic.homedomain.com
>>        AccessFileName .htaccess
>>           JkMount /*.jsp ajp13
>>        JkMount /servlet/* ajp13
>>               <Location "/WEB-INF/">
>>            AllowOverride None
>>            deny from all
>>        </Location>
>>    </VirtualHost>
>>
>> Server.xml:
>>
>>    <!-- Define an Apache-Connector Service -->
>>    <Service name="Tomcat-Apache">
>>      <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
>>                 port="8013" minProcessors="5" maxProcessors="75"
>>                 acceptCount="10" debug="0"/>
>>         <Engine name="Apache" debug="0">
>>        <Logger className="org.apache.catalina.logger.FileLogger"
>>                prefix="apache_log." suffix=".txt"
>>                timestamp="true"/>
>>                       <Realm 
>> className="org.apache.catalina.realm.MemoryRealm" />
>>               <Host name="ymusic.homedomain.com" debug="0" 
>> appBase="/home/ymusic/public_html" unpackWARs="true">
>>            <Context path="" docBase="" debug="0" reloadable="true" 
>> crossContext="true" />
>>            <Context path="/servlet" docBase="WEB-INF/classes" 
>> debug="0" reloadable="true" crossContex="true" />
>>        </Host>
>>               <Host name="localhost" debug="0" appBase="webapps" 
>> unpackWARs="true" />
>>      </Engine>     </Service>
>>
>> web.xml (invoker is defined in the default web.xml):
>>
>>    <?xml version="1.0" encoding="ISO-8859-1"?>
>>    <!DOCTYPE web-app
>>         PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>>        "http://java.sun.com/dtd/web-app_2_3.dtd">
>>    <web-app>
>>           <servlet-mapping>
>>            <servlet-name>invoker</servlet-name>
>>            <url-pattern>/servlet/*</url-pattern>
>>        </servlet-mapping>
>>       </web-app>
>>
>> Worker.properties:
>>
>>    # workers.apache_log=/etc/apache/log/
>>    workers.tomcat_home=/opt/tomcat
>>    workers.java_home=/opt/blackdown-jdk-1.3.1
>>    ps=/
>>       worker.list=ajp13
>>       worker.ajp13.port=8013
>>    worker.ajp13.host=localhost
>>    worker.ajp13.type=ajp13
>>    worker.ajp13.cachesize=10
>>    worker.ajp13.cache_timeout=600
>>    worker.ajp13.socket_keepalive=1
>>    worker.ajp13.socket_timeout=300
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Servlet Execution with Virtual Hosts and Invoker Problems

Posted by Musomi Motilewa <mo...@islandcafe.net>.
Hi-

Let me clarify my initial email below. My main problem is that the 
servlets are not being executed when I load them using 
http://ymusic.homedomain.com/servlet/servletName. I don't mind having 
the /servlet directory listed when it is accessed using 
http://ymusic.homedomain.com/servlet/ or the code of the servlet 
displayed when its accessed using 
http://ymusic.homedomain.com/servlet/servletName.class.

At this point any URL that contains /servlet/* is processed by tomcat, 
which is what I want it to do. However I noticed the directory listing 
of the /servlet directory via Tomcat is coming up as "Directory listing 
for /" instead of "Directory listing for /servlet". I think this is one 
idication of why I'm getting 404 errors when I try to load the servlets. 
I've tried removing the following context from the server.xml file:

<Context path="/servlet" docBase="WEB-INF/classes" debug="0" 
reloadable="true" crossContex="true" />

But then I get 404 errors on the the URL - 
http://ymusic.homedomain.com/servlet/ as well as URLs to servlets. Any 
other suggestions? The settings of my config files are listed below. Thanks.

-Musomi

Musomi Motilewa wrote:

> Hi All-
>
> I'm running Apache 1.3.27, Tomcat 4.1.24 and mod_jk on Gentoo 1.4 RC3. 
> I'm using IP based virtual hosting on the server to mirror five live 
> sites that I work on. The apache-based sites are functioning fine but 
> I'm running into trouble getting Tomcat to work. So far I've only 
> tried to set up one of the sites; here is my situation.
>
> I'm able to run *.jsp pages from anywhere in the site, but when I try 
> to access *.class files in the /servlet directory I get a 404 error. 
> The strange thing is if I type http://ymusic.homedomain.com/servlet, I 
> get the directory list of the /WEB-INF/classes directory for the site. 
> Clicking on the class file in the directory list renders the class 
> code (http://ymusic.homedomain.com/servlet/HelloWorld.class). Trying 
> to access http://ymusic.homedomain.com/servlet/HelloWorld, gives a 404 
> error (HTTP Status 404 - /servlet/HelloWorld).
>
> Another strange thing I've noticed is that the title of the directory 
> list for http://ymusic.homedomain.com/servlet/ is, Directory Listing 
> For /. I would have thought I would be, Directory Listing For /servlet.
>
> Any help would be appreciated. Thanks.
>
> -Musomi
>
>
> Here are the specifics of my installation.
>
> Location:
>
>    /home/ymusic/public_html
>    /home/ymusic/public_html/WEB-INF/classes
>    /home/ymusic/public_html/WEB-INF/lib
>    /home/ymusic/public_html/WEB-INF/web.xml
>
> Apache.conf:
>
>    <VirtualHost 10.1.10.101>
>        DocumentRoot /home/ymusic/public_html
>        ServerName ymusic.homedomain.com
>        AccessFileName .htaccess
>           JkMount /*.jsp ajp13
>        JkMount /servlet/* ajp13
>               <Location "/WEB-INF/">
>            AllowOverride None
>            deny from all
>        </Location>
>    </VirtualHost>
>
> Server.xml:
>
>    <!-- Define an Apache-Connector Service -->
>    <Service name="Tomcat-Apache">
>      <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
>                 port="8013" minProcessors="5" maxProcessors="75"
>                 acceptCount="10" debug="0"/>
>         <Engine name="Apache" debug="0">
>        <Logger className="org.apache.catalina.logger.FileLogger"
>                prefix="apache_log." suffix=".txt"
>                timestamp="true"/>
>                       <Realm 
> className="org.apache.catalina.realm.MemoryRealm" />
>               <Host name="ymusic.homedomain.com" debug="0" 
> appBase="/home/ymusic/public_html" unpackWARs="true">
>            <Context path="" docBase="" debug="0" reloadable="true" 
> crossContext="true" />
>            <Context path="/servlet" docBase="WEB-INF/classes" 
> debug="0" reloadable="true" crossContex="true" />
>        </Host>
>               <Host name="localhost" debug="0" appBase="webapps" 
> unpackWARs="true" />
>      </Engine>     </Service>
>
> web.xml (invoker is defined in the default web.xml):
>
>    <?xml version="1.0" encoding="ISO-8859-1"?>
>    <!DOCTYPE web-app
>         PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>        "http://java.sun.com/dtd/web-app_2_3.dtd">
>    <web-app>
>           <servlet-mapping>
>            <servlet-name>invoker</servlet-name>
>            <url-pattern>/servlet/*</url-pattern>
>        </servlet-mapping>
>       </web-app>
>
> Worker.properties:
>
>    # workers.apache_log=/etc/apache/log/
>    workers.tomcat_home=/opt/tomcat
>    workers.java_home=/opt/blackdown-jdk-1.3.1
>    ps=/
>       worker.list=ajp13
>       worker.ajp13.port=8013
>    worker.ajp13.host=localhost
>    worker.ajp13.type=ajp13
>    worker.ajp13.cachesize=10
>    worker.ajp13.cache_timeout=600
>    worker.ajp13.socket_keepalive=1
>    worker.ajp13.socket_timeout=300
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org