You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Frank <ro...@unibas.ch> on 2006/05/04 15:53:11 UTC

User WEb Applications

Hi, once again, I'm out of luck with my network quieries,
I'll never get it right, when it comes to asking the right
questions (in Google) ...
I wanted to search the mail lists, but how? The search
goes to google ...

I'm running tomcat5.0 on FC4 (linux) with java 1.5 (from SUN).

I'm trying to set up the standalone server such that users can
install and deply webapplications in their home directory (this
is for a lab).
Following the instructions of the documentation (for 5.0),
I found the topic 'User Web Applications' in the host container
documentation. The doc states:

'If a user home directory has been set up for a user named
  craigmcc, then its contents will be visible from a client browser
  by making a request to a URL like:'

which is the behaviour I get. I.e., it will only list the contents of
the directories and return files if selected. The doc then goes on:

'Successful use of this feature requires recognition of the
  following considerations:
    Each user web application will be deployed with characteristics
    established by any DefaultContext element you have configured
    for this Host.'

Which tells me that user applications are *deployed* - but how?
No matter what applictaion I put into the user's webapp directory
(given as attribute to the Listener tag), it is never deployed, but if I
put it into the webapp of the tomcat home, then it will be deployed.

The logs state:

catalina.out:

4-May-06 11:50:37 AM org.apache.catalina.startup.ContextConfig  
applicationConfig()
INFO: Missing application web.xml, using defaults only StandardEngine 
[Catalina].StandardHost[localhost].StandardContext[/~unilogon]

Okay, so where should this web.xml be put? Into the same directory  
given in the directoryName attribute of the Listener tag?


and localhost_log.2006-05-04.txt:

2006-05-04 11:50:34 UserConfig[localhost]: UserConfig: Processing START
2006-05-04 11:50:34 UserConfig[localhost]: Deploying user web  
applications
2006-05-04 11:50:36 UserConfig[localhost]: Deploying web application  
for user unilogon

which make me think all's ok, but it isn't.

What am I missing?

many thanks in advance, Robert


Departement Informatik   FGB   tel   +41 (0)61 267 14 66
Universität Basel                          fax. +41 (0)61 267 14 61
Robert Frank
Klingelbergstrasse 50                 Robert.Frank@unibas.ch
CH-4056 Basel
Switzerland                                   http:// 
www.informatik.unibas.ch/personen/frank_r.html




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


RE: User WEb Applications

Posted by Chris Berthold <cb...@styleline.com>.
If on mod_jk in his case:

JkMount /* <worker name>

would cover all applications regardless of how many apps he had on there.
And in the case of virtual host names you could do a set of wild card hosts
to simplify the process in apache.

In DNS you would have *.tomcat.mydomain.com point to the address of the
server.

In apache you would set the config up like so:

<VirtualHost <IP Address>:80>
	ServerName www.tomcat.mydomain.com
	ServerAlias *.tomcat.mydomain.com
	DocumentRoot /www/tomcat.mydomain.com/html
	DirectoryIndex index.html
	JkMount /* <worker name>	

</VirtualHost>

That would forward all the names from apache to tomcat and then you only
have to deal with tomcat from that point forward.  So in tomcat you would
set up a different host for each lab student, instead of machine, if you
have multiple classes.  For instance:

jdoe.tomcat.mydomain.com

your server.xml would look something along the lines of what was shown below
for lab01host001.tomcat.mydomain.com but instead lab01host001 would be each
name or whatever scheme you would want to go with.




Chris Berthold
IT Systems Analyst
Commercial Refrigerator Door Company
941 . 371 . 8110 x 205

-----Original Message-----
From: Mike Sabroff [mailto:mike.sabroff@cygnusb2b.com] 
Sent: Thursday, May 04, 2006 12:47 PM
To: Tomcat Users List
Subject: Re: User WEb Applications

You might try writing some script they can use that will create a 
symlink in the webapps directory to their home directory:

#!/bin/csh
# do whatever needed to write to directory and read or prompt for user 
directory
# maybe some other logging or setup ???
cd /usr/local/tomcat/webapps
#create symlink to userdir
ln -s /home/user/dirname dirname
#wait for tomcat to load
sleep 10
exit

Then tomcat will load this as a webapp providing ofcourse that the 
directory structure the link is pointing to is a true webapp (containing 
WEB-INF, WEB-INF/lib, WEB-INF/classes) directories

Ofcourse, if you are using apache on port 80, and using jk, you will 
have to write a script to add the jk-mount  as well

Mike Sabroff
Web Services
Developer
mike.sabroff@cygnusb2b.com
920-568-8379



Darryl Miles wrote:
> Robert Frank wrote:
>> I'm trying to set up the standalone server such that users can
>> install and deply webapplications in their home directory (this
>> is for a lab).
>
> Heh...  Container stability during development for a single user is 
> hard enough than to have to worry about what your other lab students 
> are doing at the same time.
>
> The general get-out when you first find a problem that isn't an 
> obvious programming error is to restart the container and re-test the 
> situation.
>
> Maybe you'd be better off teaching students how to use Eclipse and 
> manage their own Tomcat instance from within it.  But to use Eclipse 
> you'd need PCs of half decent spec with a little more RAM on board.
>
>
>
> Sorry I don't have an answer to your request, and whatever I do say 
> has more bearing on TC 5.5.x than 5.0.x.  But my understanding is that 
> there is a single deployment directory folder per virtual hostname.
>
> So if you wanted to give each student/computer their own workspace 
> maybe you could setup DNS to point lab01host001.tomcat.mydomain.com to 
> the same IP address.
>
> Then setup <Host> directives in conf/server.xml like:
>
> <Host name="lab01host001.tomcat.mydomain.com" 
> appBase="/opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps"
>         
> workDir="/opt/website/lab01host001.tomcat.mydomain.com/tomcat/work"
>         unpackWARs="true" autoDeploy="true"
>                 xmlValidation="false" xmlNamespaceAware="false">
> </Host>
>
>
>
> To setup each lab users workspace use:
>
> mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat
> mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
> mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps
>
> # chown the "work" folder to the same user the TC JVM instance runs as:
> chown jakarta.jakarta 
> /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
> chmod 775 /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
>
> # chown the "webapps" folder to the same user as the student that is 
> allowed to deploy, but also give the TB JVM instalce group permission 
> to write too.
> chown student0123.jakarta 
> /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps
> chmod 775 /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps
>
>
>
> # deploy your webapp and access as: 
> http://lab01host001.tomcat.mydomain.com/
> cp ROOT.war 
> /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps/ROOT.war
>
> # or under a context and access as: 
> http://lab01host001.tomcat.mydomain.com/student0123/
> cp student0123.war 
>
/opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps/student0123.war

>
>
> # You may wish to create inside your WAR the file META-INF/context.xml 
> for any context specific parameters.  See TC documentation.
>
>
> You'd still need to give the students the ability to shutdown and 
> restart the container themselves, it really is a necessary requirement 
> to successfully develop with TC.  More so if you are a student and 
> don't understand anything to begin with and need to learn from making 
> as many mistakes as possible.
>
>
>
> HTH
>
> Darryl
>
>
>> Following the instructions of the documentation (for 5.0),
>> I found the topic 'User Web Applications' in the host container
>> documentation. The doc states:
>>
>> 'If a user home directory has been set up for a user named
>>  craigmcc, then its contents will be visible from a client browser
>>  by making a request to a URL like:'
>>
>> which is the behaviour I get. I.e., it will only list the contents of
>> the directories and return files if selected. The doc then goes on:
>>
>> 'Successful use of this feature requires recognition of the
>>  following considerations:
>>    Each user web application will be deployed with characteristics
>>    established by any DefaultContext element you have configured
>>    for this Host.'
>>
>> Which tells me that user applications are *deployed* - but how?
>> No matter what applictaion I put into the user's webapp directory
>> (given as attribute to the Listener tag), it is never deployed, but if I
>> put it into the webapp of the tomcat home, then it will be deployed.
>>
>> The logs state:
>>
>> catalina.out:
>>
>> 4-May-06 11:50:37 AM org.apache.catalina.startup.ContextConfig 
>> applicationConfig()
>> INFO: Missing application web.xml, using defaults only 
>>
StandardEngine[Catalina].StandardHost[localhost].StandardContext[/~unilogon]

>>
>>
>> Okay, so where should this web.xml be put? Into the same directory 
>> given in the directoryName attribute of the Listener tag?
>>
>>
>> and localhost_log.2006-05-04.txt:
>>
>> 2006-05-04 11:50:34 UserConfig[localhost]: UserConfig: Processing START
>> 2006-05-04 11:50:34 UserConfig[localhost]: Deploying user web 
>> applications
>> 2006-05-04 11:50:36 UserConfig[localhost]: Deploying web application 
>> for user unilogon
>>
>> which make me think all's ok, but it isn't.
>>
>> What am I missing?
>>
>> many thanks in advance, Robert
>>
>>
>> Departement Informatik   FGB   tel   +41 (0)61 267 14 66
>> Universit?t Basel                          fax. +41 (0)61 267 14 61
>> Robert Frank
>> Klingelbergstrasse 50                 Robert.Frank@unibas.ch
>> CH-4056 Basel
>> Switzerland                                   
>> http://www.informatik.unibas.ch/personen/frank_r.html
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>> .
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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



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


Re: User WEb Applications

Posted by Mike Sabroff <mi...@cygnusb2b.com>.
You might try writing some script they can use that will create a 
symlink in the webapps directory to their home directory:

#!/bin/csh
# do whatever needed to write to directory and read or prompt for user 
directory
# maybe some other logging or setup ???
cd /usr/local/tomcat/webapps
#create symlink to userdir
ln -s /home/user/dirname dirname
#wait for tomcat to load
sleep 10
exit

Then tomcat will load this as a webapp providing ofcourse that the 
directory structure the link is pointing to is a true webapp (containing 
WEB-INF, WEB-INF/lib, WEB-INF/classes) directories

Ofcourse, if you are using apache on port 80, and using jk, you will 
have to write a script to add the jk-mount  as well

Mike Sabroff
Web Services
Developer
mike.sabroff@cygnusb2b.com
920-568-8379



Darryl Miles wrote:
> Robert Frank wrote:
>> I'm trying to set up the standalone server such that users can
>> install and deply webapplications in their home directory (this
>> is for a lab).
>
> Heh...  Container stability during development for a single user is 
> hard enough than to have to worry about what your other lab students 
> are doing at the same time.
>
> The general get-out when you first find a problem that isn't an 
> obvious programming error is to restart the container and re-test the 
> situation.
>
> Maybe you'd be better off teaching students how to use Eclipse and 
> manage their own Tomcat instance from within it.  But to use Eclipse 
> you'd need PCs of half decent spec with a little more RAM on board.
>
>
>
> Sorry I don't have an answer to your request, and whatever I do say 
> has more bearing on TC 5.5.x than 5.0.x.  But my understanding is that 
> there is a single deployment directory folder per virtual hostname.
>
> So if you wanted to give each student/computer their own workspace 
> maybe you could setup DNS to point lab01host001.tomcat.mydomain.com to 
> the same IP address.
>
> Then setup <Host> directives in conf/server.xml like:
>
> <Host name="lab01host001.tomcat.mydomain.com" 
> appBase="/opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps"
>         
> workDir="/opt/website/lab01host001.tomcat.mydomain.com/tomcat/work"
>         unpackWARs="true" autoDeploy="true"
>                 xmlValidation="false" xmlNamespaceAware="false">
> </Host>
>
>
>
> To setup each lab users workspace use:
>
> mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat
> mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
> mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps
>
> # chown the "work" folder to the same user the TC JVM instance runs as:
> chown jakarta.jakarta 
> /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
> chmod 775 /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
>
> # chown the "webapps" folder to the same user as the student that is 
> allowed to deploy, but also give the TB JVM instalce group permission 
> to write too.
> chown student0123.jakarta 
> /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps
> chmod 775 /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps
>
>
>
> # deploy your webapp and access as: 
> http://lab01host001.tomcat.mydomain.com/
> cp ROOT.war 
> /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps/ROOT.war
>
> # or under a context and access as: 
> http://lab01host001.tomcat.mydomain.com/student0123/
> cp student0123.war 
> /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps/student0123.war 
>
>
> # You may wish to create inside your WAR the file META-INF/context.xml 
> for any context specific parameters.  See TC documentation.
>
>
> You'd still need to give the students the ability to shutdown and 
> restart the container themselves, it really is a necessary requirement 
> to successfully develop with TC.  More so if you are a student and 
> don't understand anything to begin with and need to learn from making 
> as many mistakes as possible.
>
>
>
> HTH
>
> Darryl
>
>
>> Following the instructions of the documentation (for 5.0),
>> I found the topic 'User Web Applications' in the host container
>> documentation. The doc states:
>>
>> 'If a user home directory has been set up for a user named
>>  craigmcc, then its contents will be visible from a client browser
>>  by making a request to a URL like:'
>>
>> which is the behaviour I get. I.e., it will only list the contents of
>> the directories and return files if selected. The doc then goes on:
>>
>> 'Successful use of this feature requires recognition of the
>>  following considerations:
>>    Each user web application will be deployed with characteristics
>>    established by any DefaultContext element you have configured
>>    for this Host.'
>>
>> Which tells me that user applications are *deployed* - but how?
>> No matter what applictaion I put into the user's webapp directory
>> (given as attribute to the Listener tag), it is never deployed, but if I
>> put it into the webapp of the tomcat home, then it will be deployed.
>>
>> The logs state:
>>
>> catalina.out:
>>
>> 4-May-06 11:50:37 AM org.apache.catalina.startup.ContextConfig 
>> applicationConfig()
>> INFO: Missing application web.xml, using defaults only 
>> StandardEngine[Catalina].StandardHost[localhost].StandardContext[/~unilogon] 
>>
>>
>> Okay, so where should this web.xml be put? Into the same directory 
>> given in the directoryName attribute of the Listener tag?
>>
>>
>> and localhost_log.2006-05-04.txt:
>>
>> 2006-05-04 11:50:34 UserConfig[localhost]: UserConfig: Processing START
>> 2006-05-04 11:50:34 UserConfig[localhost]: Deploying user web 
>> applications
>> 2006-05-04 11:50:36 UserConfig[localhost]: Deploying web application 
>> for user unilogon
>>
>> which make me think all's ok, but it isn't.
>>
>> What am I missing?
>>
>> many thanks in advance, Robert
>>
>>
>> Departement Informatik   FGB   tel   +41 (0)61 267 14 66
>> Universit�t Basel                          fax. +41 (0)61 267 14 61
>> Robert Frank
>> Klingelbergstrasse 50                 Robert.Frank@unibas.ch
>> CH-4056 Basel
>> Switzerland                                   
>> http://www.informatik.unibas.ch/personen/frank_r.html
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>> .
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Re: User WEb Applications

Posted by Darryl Miles <da...@netbauds.net>.
Robert Frank wrote:
> I'm trying to set up the standalone server such that users can
> install and deply webapplications in their home directory (this
> is for a lab).

Heh...  Container stability during development for a single user is hard 
enough than to have to worry about what your other lab students are 
doing at the same time.

The general get-out when you first find a problem that isn't an obvious 
programming error is to restart the container and re-test the situation.

Maybe you'd be better off teaching students how to use Eclipse and 
manage their own Tomcat instance from within it.  But to use Eclipse 
you'd need PCs of half decent spec with a little more RAM on board.



Sorry I don't have an answer to your request, and whatever I do say has 
more bearing on TC 5.5.x than 5.0.x.  But my understanding is that there 
is a single deployment directory folder per virtual hostname.

So if you wanted to give each student/computer their own workspace maybe 
you could setup DNS to point lab01host001.tomcat.mydomain.com to the 
same IP address.

Then setup <Host> directives in conf/server.xml like:

<Host name="lab01host001.tomcat.mydomain.com" 
appBase="/opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps"
         workDir="/opt/website/lab01host001.tomcat.mydomain.com/tomcat/work"
         unpackWARs="true" autoDeploy="true"
                 xmlValidation="false" xmlNamespaceAware="false">
</Host>



To setup each lab users workspace use:

mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat
mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
mkdir /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps

# chown the "work" folder to the same user the TC JVM instance runs as:
chown jakarta.jakarta 
/opt/website/lab01host001.tomcat.mydomain.com/tomcat/work
chmod 775 /opt/website/lab01host001.tomcat.mydomain.com/tomcat/work

# chown the "webapps" folder to the same user as the student that is 
allowed to deploy, but also give the TB JVM instalce group permission to 
write too.
chown student0123.jakarta 
/opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps
chmod 775 /opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps



# deploy your webapp and access as: http://lab01host001.tomcat.mydomain.com/
cp ROOT.war 
/opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps/ROOT.war

# or under a context and access as: 
http://lab01host001.tomcat.mydomain.com/student0123/
cp student0123.war 
/opt/website/lab01host001.tomcat.mydomain.com/tomcat/webapps/student0123.war

# You may wish to create inside your WAR the file META-INF/context.xml 
for any context specific parameters.  See TC documentation.


You'd still need to give the students the ability to shutdown and 
restart the container themselves, it really is a necessary requirement 
to successfully develop with TC.  More so if you are a student and don't 
understand anything to begin with and need to learn from making as many 
mistakes as possible.



HTH

Darryl


> Following the instructions of the documentation (for 5.0),
> I found the topic 'User Web Applications' in the host container
> documentation. The doc states:
> 
> 'If a user home directory has been set up for a user named
>  craigmcc, then its contents will be visible from a client browser
>  by making a request to a URL like:'
> 
> which is the behaviour I get. I.e., it will only list the contents of
> the directories and return files if selected. The doc then goes on:
> 
> 'Successful use of this feature requires recognition of the
>  following considerations:
>    Each user web application will be deployed with characteristics
>    established by any DefaultContext element you have configured
>    for this Host.'
> 
> Which tells me that user applications are *deployed* - but how?
> No matter what applictaion I put into the user's webapp directory
> (given as attribute to the Listener tag), it is never deployed, but if I
> put it into the webapp of the tomcat home, then it will be deployed.
> 
> The logs state:
> 
> catalina.out:
> 
> 4-May-06 11:50:37 AM org.apache.catalina.startup.ContextConfig 
> applicationConfig()
> INFO: Missing application web.xml, using defaults only 
> StandardEngine[Catalina].StandardHost[localhost].StandardContext[/~unilogon] 
> 
> 
> Okay, so where should this web.xml be put? Into the same directory given 
> in the directoryName attribute of the Listener tag?
> 
> 
> and localhost_log.2006-05-04.txt:
> 
> 2006-05-04 11:50:34 UserConfig[localhost]: UserConfig: Processing START
> 2006-05-04 11:50:34 UserConfig[localhost]: Deploying user web applications
> 2006-05-04 11:50:36 UserConfig[localhost]: Deploying web application for 
> user unilogon
> 
> which make me think all's ok, but it isn't.
> 
> What am I missing?
> 
> many thanks in advance, Robert
> 
> 
> Departement Informatik   FGB   tel   +41 (0)61 267 14 66
> Universität Basel                          fax. +41 (0)61 267 14 61
> Robert Frank
> Klingelbergstrasse 50                 Robert.Frank@unibas.ch
> CH-4056 Basel
> Switzerland                                   
> http://www.informatik.unibas.ch/personen/frank_r.html
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> .
> 


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