You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Neil Zanella <nz...@cs.mun.ca> on 2003/06/26 13:47:33 UTC

multiuser setup: please help

Hello,

I have successfully setup Tomcat but now I want the following:

Suppose some Linux based system has a dynamic and constantly changing
number of users ranging in the thousands. I would like to set up
tomcat so that:

   Each user gets a context root in a directory such as:
   http://localhost:8080/~johndoe/contextroot/

   This happens in such a way that when a request to a subdirectory
   that looks like the one above is issued, Tomcat automatically
   knows how to handle it. Is this possible?

This would be ideal. I don't see why it shouldn't be possible.

If this is impossible, then consider it to be a missing feature
from tomcat. I almost feel it should be documented somewhere if
available, otherwise, if not available, it should be implemented.

I guess I could define a path mapping of the form:

http://localhost:8080/~+/contextroot/

I actually tried this but it did not work: I used the path mapping
inside the webapps/ROOT/WEB-INF/web.xml file:

<?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>

  <display-name>welcome</display-name>
  <description>These examples are from the created contextroot 
subdirectory of webapps.</description>
  <servlet>
    <servlet-name>welcome</servlet-name>
    <description>This web application welcomes you.</description>
    <servlet-class>WelcomeServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>welcome</servlet-name>
    <url-pattern>http://localhost:8080/~*/contextroot/*</url-pattern>
  </servlet-mapping>

</web-app>

I thought I could have the URL execute a servlet, that would execute
then execute a servlet from the users' directory. Sound complicated?
Perhaps there is an easier way???


Suggestions very welcome!!!

Neil


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


Re: multiuser setup: please help

Posted by Neil Zanella <nz...@cs.mun.ca>.
On Fri, 27 Jun 2003, John Turner wrote:

> 
> I don't use this feature, but a couple of things come to mind:
> 
> - does the user account that Tomcat uses have read permissions to those 
> directories?

I am not sure what user accound Tomcat uses, probably the root account 
since I installed it as root (it came with Sun One Studio JDK), but in
any case the answer is YES because:

$ ls -ld ~joedoe
drwx--x--x   57 joedoe  joedoe      16384 Jun 28 20:14 /home/joedoe
$ ls -ld ~joedoe/public_html
drwxrwxr-x    5 joedoe  joedoe      4096 Jun 28 20:13 /home/joedoe/public_html
$ ls -ld ~joedoe/public_html/index.html
-rw-rw-r--    1 joedoe  joedoe      218 Jun 28 20:12 
/home/joedoe/public_html/index.html

and I can view the file with mozilla while connecting to plain Apache on
the standard HTTP port 80, however...

> - NOTHING under WEB-INF is ever directly accessible, both WEB-INF and META- 
> INF are protected resources as far as tomcat is concerned.  I'm not sure 
> what you're expecting with the URLs you posted.

Yes, this is correct, things unsed WEB-INF JSP 2.2 standard directory 
should not be directly accessible according to the documentation, but
the directory it rests in should be...

> The test to see if it is working is to put index.html in 
> ~johndoe/public_html and then try to access it by 
> http://localhost:8080/~johndoe or http://localhost:8080/~johndoe/index.html 

THIS IS THE PROBLEM. I cannot see anything when I access:

http://localhost:8080/~johndoe/index.html

but I can access:

http://localhost/~johndoe/index.html

and have restarted tomcat successfully after editing
the $CATALINA_HOME/conf/server.xml file so that it
has the following lines:

     <Host>

<!-- snip -->

<Listener className="org.apache.catalina.startup.UserConfig"
          directoryName="public_html"
          userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
    
      </Host>

Any ideas of why it is not working. I have followed the directions
haven't I. Could it be I need a newer version of Tomcat than the
one distributed with Sun One Studio (which is 4.0.1)? But Tomcat
does not complain about the XML, so it should be recognizing it?

Thank you for your help,

Neil

> 
> After that, anything else you have to do would have to follow the standard 
> app deployment rules, such as having servlets defined in web.xml or using 
> the invoker, defining welcome pages in web.xml, etc.
> 
> HTH
> 
> John
>  On Fri, 27 Jun 2003 00:24:40 -0230 (NDT), Neil Zanella 
> <nz...@cs.mun.ca> wrote:
> 
> >
> > Thank you for your suggestion. I am using Tomcat 4.0.1 and I realize
> > that the same applies to Tomcat 4.0:
> >
> > http://jakarta.apache.org/tomcat/tomcat-4.0- 
> > doc/config/defaultcontext.html
> >
> > I have read the "User Web Applications" section and done as described:
> >
> > I added the XML entity and attributes given by:
> >
> > <Listener className="org.apache.catalina.startup.UserConfig"
> > directoryName="public_html"
> > userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
> >
> > inside the Host entity in the server.xml file. I added these at the very
> > end of the entity. I also created user readable files:
> >
> > ~johndoe/public_html/contextroot/WEB-INF/web.xml
> > ~johndoe/public_html/contextroot/WEB-INF/classes
> > ~johndoe/public_html/contextroot/WEB-INF/classes/JohnDoe.class
> >
> > and also tried
> >
> > ~johndoe/public_html/webapps/contextroot/WEB-INF/web.xml
> > ~johndoe/public_html/webapps/contextroot/WEB-INF/classes
> > ~johndoe/public_html/webapps/contextroot/WEB-INF/classes/JohnDoe.class
> >
> > as well as:
> >
> > ~johndoe/public_html/WEB-INF/web.xml
> > ~johndoe/public_html/WEB-INF/classes
> > ~johndoe/public_html/WEB-INF/classes/JohnDoe.class
> >
> > but I get a 404 HTTP response (file not found) each
> > time I point my browser to:
> >
> > http://localhost:8080/~johndoe/contextroot/webappjohndoe
> > http://localhost:8080/~johndoe/webappjohndoe
> >
> > Furthermore, each time I have a directory called 
> > ~johndoe/public_html/WEB-INF and restart the server,
> > I get a 404 when I access:
> >
> > http://localhost:8080/~johndoe
> >
> > whereas in the other cases I get a directory listing.
> >
> > The documentation states:
> >
> > Each user web application will be deployed with characteristics 
> > established by any DefaultContext element you have configured
> > for this Host.
> >
> > Does this have anything to do with it? I am puzzled by why
> > my servlet is not displaying.
> >
> > Once again, thank you for your help!!!
> >
> > Neil
> >
> > On Thu, 26 Jun 2003, John Turner wrote:
> >
> >>
> >> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html
> >>
> >> The section marked "User Web Applications" should be what you want.
> >>
> >> John
> >>
> >> On Thu, 26 Jun 2003 09:17:33 -0230 (NDT), Neil Zanella 
> >> <nz...@cs.mun.ca> wrote:
> >>
> >> >
> >> > Hello,
> >> >
> >> > I have successfully setup Tomcat but now I want the following:
> >> >
> >> > Suppose some Linux based system has a dynamic and constantly changing
> >> > number of users ranging in the thousands. I would like to set up
> >> > tomcat so that:
> >> >
> >> > Each user gets a context root in a directory such as:
> >> > http://localhost:8080/~johndoe/contextroot/
> >> >
> >> > This happens in such a way that when a request to a subdirectory
> >> > that looks like the one above is issued, Tomcat automatically
> >> > knows how to handle it. Is this possible?
> >> >
> >> > This would be ideal. I don't see why it shouldn't be possible.
> >> >
> >> > If this is impossible, then consider it to be a missing feature
> >> > from tomcat. I almost feel it should be documented somewhere if
> >> > available, otherwise, if not available, it should be implemented.
> >> >
> >> > I guess I could define a path mapping of the form:
> >> >
> >> > http://localhost:8080/~+/contextroot/
> >> >
> >> > I actually tried this but it did not work: I used the path mapping
> >> > inside the webapps/ROOT/WEB-INF/web.xml file:
> >> >
> >> > <?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>
> >> >
> >> > <display-name>welcome</display-name>
> >> > <description>These examples are from the created contextroot 
> >> subdirectory > of webapps.</description>
> >> > <servlet>
> >> > <servlet-name>welcome</servlet-name>
> >> > <description>This web application welcomes you.</description>
> >> > <servlet-class>WelcomeServlet</servlet-class>
> >> > </servlet>
> >> > <servlet-mapping>
> >> > <servlet-name>welcome</servlet-name>
> >> > <url-pattern>http://localhost:8080/~*/contextroot/*</url-pattern>
> >> > </servlet-mapping>
> >> >
> >> > </web-app>
> >> >
> >> > I thought I could have the URL execute a servlet, that would execute
> >> > then execute a servlet from the users' directory. Sound complicated?
> >> > Perhaps there is an easier way???
> >> >
> >> >
> >> > Suggestions very welcome!!!
> >> >
> >> > Neil
> >> >
> >> >
> >> > ---------------------------------------------------------------------
> >> > 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: multiuser setup: please help

Posted by John Turner <to...@johnturner.com>.
I don't use this feature, but a couple of things come to mind:

- does the user account that Tomcat uses have read permissions to those 
directories?

- NOTHING under WEB-INF is ever directly accessible, both WEB-INF and META- 
INF are protected resources as far as tomcat is concerned.  I'm not sure 
what you're expecting with the URLs you posted.

The test to see if it is working is to put index.html in 
~johndoe/public_html and then try to access it by 
http://localhost:8080/~johndoe or http://localhost:8080/~johndoe/index.html 
(or even index.jsp).

After that, anything else you have to do would have to follow the standard 
app deployment rules, such as having servlets defined in web.xml or using 
the invoker, defining welcome pages in web.xml, etc.

HTH

John
 On Fri, 27 Jun 2003 00:24:40 -0230 (NDT), Neil Zanella 
<nz...@cs.mun.ca> wrote:

>
> Thank you for your suggestion. I am using Tomcat 4.0.1 and I realize
> that the same applies to Tomcat 4.0:
>
> http://jakarta.apache.org/tomcat/tomcat-4.0- 
> doc/config/defaultcontext.html
>
> I have read the "User Web Applications" section and done as described:
>
> I added the XML entity and attributes given by:
>
> <Listener className="org.apache.catalina.startup.UserConfig"
> directoryName="public_html"
> userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
>
> inside the Host entity in the server.xml file. I added these at the very
> end of the entity. I also created user readable files:
>
> ~johndoe/public_html/contextroot/WEB-INF/web.xml
> ~johndoe/public_html/contextroot/WEB-INF/classes
> ~johndoe/public_html/contextroot/WEB-INF/classes/JohnDoe.class
>
> and also tried
>
> ~johndoe/public_html/webapps/contextroot/WEB-INF/web.xml
> ~johndoe/public_html/webapps/contextroot/WEB-INF/classes
> ~johndoe/public_html/webapps/contextroot/WEB-INF/classes/JohnDoe.class
>
> as well as:
>
> ~johndoe/public_html/WEB-INF/web.xml
> ~johndoe/public_html/WEB-INF/classes
> ~johndoe/public_html/WEB-INF/classes/JohnDoe.class
>
> but I get a 404 HTTP response (file not found) each
> time I point my browser to:
>
> http://localhost:8080/~johndoe/contextroot/webappjohndoe
> http://localhost:8080/~johndoe/webappjohndoe
>
> Furthermore, each time I have a directory called 
> ~johndoe/public_html/WEB-INF and restart the server,
> I get a 404 when I access:
>
> http://localhost:8080/~johndoe
>
> whereas in the other cases I get a directory listing.
>
> The documentation states:
>
> Each user web application will be deployed with characteristics 
> established by any DefaultContext element you have configured
> for this Host.
>
> Does this have anything to do with it? I am puzzled by why
> my servlet is not displaying.
>
> Once again, thank you for your help!!!
>
> Neil
>
> On Thu, 26 Jun 2003, John Turner wrote:
>
>>
>> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html
>>
>> The section marked "User Web Applications" should be what you want.
>>
>> John
>>
>> On Thu, 26 Jun 2003 09:17:33 -0230 (NDT), Neil Zanella 
>> <nz...@cs.mun.ca> wrote:
>>
>> >
>> > Hello,
>> >
>> > I have successfully setup Tomcat but now I want the following:
>> >
>> > Suppose some Linux based system has a dynamic and constantly changing
>> > number of users ranging in the thousands. I would like to set up
>> > tomcat so that:
>> >
>> > Each user gets a context root in a directory such as:
>> > http://localhost:8080/~johndoe/contextroot/
>> >
>> > This happens in such a way that when a request to a subdirectory
>> > that looks like the one above is issued, Tomcat automatically
>> > knows how to handle it. Is this possible?
>> >
>> > This would be ideal. I don't see why it shouldn't be possible.
>> >
>> > If this is impossible, then consider it to be a missing feature
>> > from tomcat. I almost feel it should be documented somewhere if
>> > available, otherwise, if not available, it should be implemented.
>> >
>> > I guess I could define a path mapping of the form:
>> >
>> > http://localhost:8080/~+/contextroot/
>> >
>> > I actually tried this but it did not work: I used the path mapping
>> > inside the webapps/ROOT/WEB-INF/web.xml file:
>> >
>> > <?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>
>> >
>> > <display-name>welcome</display-name>
>> > <description>These examples are from the created contextroot 
>> subdirectory > of webapps.</description>
>> > <servlet>
>> > <servlet-name>welcome</servlet-name>
>> > <description>This web application welcomes you.</description>
>> > <servlet-class>WelcomeServlet</servlet-class>
>> > </servlet>
>> > <servlet-mapping>
>> > <servlet-name>welcome</servlet-name>
>> > <url-pattern>http://localhost:8080/~*/contextroot/*</url-pattern>
>> > </servlet-mapping>
>> >
>> > </web-app>
>> >
>> > I thought I could have the URL execute a servlet, that would execute
>> > then execute a servlet from the users' directory. Sound complicated?
>> > Perhaps there is an easier way???
>> >
>> >
>> > Suggestions very welcome!!!
>> >
>> > Neil
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

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


Re: multiuser setup: please help

Posted by Neil Zanella <nz...@cs.mun.ca>.
Thank you for your suggestion. I am using Tomcat 4.0.1 and I realize
that the same applies to Tomcat 4.0:

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/defaultcontext.html

I have read the "User Web Applications" section and done as described:

I added the XML entity and attributes given by:

  <Listener className="org.apache.catalina.startup.UserConfig"
            directoryName="public_html"
            userClass="org.apache.catalina.startup.PasswdUserDatabase"/>

inside the Host entity in the server.xml file. I added these at the very
end of the entity. I also created user readable files:

~johndoe/public_html/contextroot/WEB-INF/web.xml
~johndoe/public_html/contextroot/WEB-INF/classes
~johndoe/public_html/contextroot/WEB-INF/classes/JohnDoe.class

and also tried

~johndoe/public_html/webapps/contextroot/WEB-INF/web.xml
~johndoe/public_html/webapps/contextroot/WEB-INF/classes
~johndoe/public_html/webapps/contextroot/WEB-INF/classes/JohnDoe.class

as well as:

~johndoe/public_html/WEB-INF/web.xml
~johndoe/public_html/WEB-INF/classes
~johndoe/public_html/WEB-INF/classes/JohnDoe.class

but I get a 404 HTTP response (file not found) each
time I point my browser to:

http://localhost:8080/~johndoe/contextroot/webappjohndoe
http://localhost:8080/~johndoe/webappjohndoe

Furthermore, each time I have a directory called 
~johndoe/public_html/WEB-INF and restart the server,
I get a 404 when I access:

http://localhost:8080/~johndoe

whereas in the other cases I get a directory listing.

The documentation states:

Each user web application will be deployed with characteristics 
established by any DefaultContext element you have configured
for this Host.

Does this have anything to do with it? I am puzzled by why
my servlet is not displaying.

Once again, thank you for your help!!!

Neil

On Thu, 26 Jun 2003, John Turner wrote:

> 
> http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html
> 
> The section marked "User Web Applications" should be what you want.
> 
> John
> 
> On Thu, 26 Jun 2003 09:17:33 -0230 (NDT), Neil Zanella <nz...@cs.mun.ca> 
> wrote:
> 
> >
> > Hello,
> >
> > I have successfully setup Tomcat but now I want the following:
> >
> > Suppose some Linux based system has a dynamic and constantly changing
> > number of users ranging in the thousands. I would like to set up
> > tomcat so that:
> >
> > Each user gets a context root in a directory such as:
> > http://localhost:8080/~johndoe/contextroot/
> >
> > This happens in such a way that when a request to a subdirectory
> > that looks like the one above is issued, Tomcat automatically
> > knows how to handle it. Is this possible?
> >
> > This would be ideal. I don't see why it shouldn't be possible.
> >
> > If this is impossible, then consider it to be a missing feature
> > from tomcat. I almost feel it should be documented somewhere if
> > available, otherwise, if not available, it should be implemented.
> >
> > I guess I could define a path mapping of the form:
> >
> > http://localhost:8080/~+/contextroot/
> >
> > I actually tried this but it did not work: I used the path mapping
> > inside the webapps/ROOT/WEB-INF/web.xml file:
> >
> > <?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>
> >
> > <display-name>welcome</display-name>
> > <description>These examples are from the created contextroot subdirectory 
> > of webapps.</description>
> > <servlet>
> > <servlet-name>welcome</servlet-name>
> > <description>This web application welcomes you.</description>
> > <servlet-class>WelcomeServlet</servlet-class>
> > </servlet>
> > <servlet-mapping>
> > <servlet-name>welcome</servlet-name>
> > <url-pattern>http://localhost:8080/~*/contextroot/*</url-pattern>
> > </servlet-mapping>
> >
> > </web-app>
> >
> > I thought I could have the URL execute a servlet, that would execute
> > then execute a servlet from the users' directory. Sound complicated?
> > Perhaps there is an easier way???
> >
> >
> > Suggestions very welcome!!!
> >
> > Neil
> >
> >
> > ---------------------------------------------------------------------
> > 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: multiuser setup: please help

Posted by John Turner <to...@johnturner.com>.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/host.html

The section marked "User Web Applications" should be what you want.

John

On Thu, 26 Jun 2003 09:17:33 -0230 (NDT), Neil Zanella <nz...@cs.mun.ca> 
wrote:

>
> Hello,
>
> I have successfully setup Tomcat but now I want the following:
>
> Suppose some Linux based system has a dynamic and constantly changing
> number of users ranging in the thousands. I would like to set up
> tomcat so that:
>
> Each user gets a context root in a directory such as:
> http://localhost:8080/~johndoe/contextroot/
>
> This happens in such a way that when a request to a subdirectory
> that looks like the one above is issued, Tomcat automatically
> knows how to handle it. Is this possible?
>
> This would be ideal. I don't see why it shouldn't be possible.
>
> If this is impossible, then consider it to be a missing feature
> from tomcat. I almost feel it should be documented somewhere if
> available, otherwise, if not available, it should be implemented.
>
> I guess I could define a path mapping of the form:
>
> http://localhost:8080/~+/contextroot/
>
> I actually tried this but it did not work: I used the path mapping
> inside the webapps/ROOT/WEB-INF/web.xml file:
>
> <?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>
>
> <display-name>welcome</display-name>
> <description>These examples are from the created contextroot subdirectory 
> of webapps.</description>
> <servlet>
> <servlet-name>welcome</servlet-name>
> <description>This web application welcomes you.</description>
> <servlet-class>WelcomeServlet</servlet-class>
> </servlet>
> <servlet-mapping>
> <servlet-name>welcome</servlet-name>
> <url-pattern>http://localhost:8080/~*/contextroot/*</url-pattern>
> </servlet-mapping>
>
> </web-app>
>
> I thought I could have the URL execute a servlet, that would execute
> then execute a servlet from the users' directory. Sound complicated?
> Perhaps there is an easier way???
>
>
> Suggestions very welcome!!!
>
> Neil
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

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