tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Musomi Motilewa <mob...@islandcafe.net>
Subject Re: Servlet Execution with Virtual Hosts and Invoker Problems
Date Wed, 23 Apr 2003 13:49:10 GMT
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


Mime
View raw message