You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Dave Pawson <da...@gmail.com> on 2009/02/08 13:45:01 UTC

Simple Tomcat 6, servlet tutorial. First draft for comment

http://www.dpawson.co.uk/tomcat

Any feedback/improvements appreciated. Particularly any errors.

Meant as a simple example of getting a first servlet working, based on
help I received from this list.


regards

-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

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


Re: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by Dave Pawson <da...@gmail.com>.
2009/2/8 Caldarale, Charles R <Ch...@unisys.com>:

> Looks pretty good.  Some nits to pick:
np

>
> Under "Compile the restlet example code", you include catalina.jar and tomcat-juli.jar; neither of these should be necessary to compile a servlet.  If they are necessary, there's something wrong with the servlet, since it's making use of Tomcat internals.

It's an outstanding question with restlets author. Compile errors without it?
TBC.  Remember it's a restlet... rather than a servlet?

>
> The directory structure created in "Tell Tomcat about our servlet" appears in the section above; looks like something's out of order or at least misplaced here.

Done. Tks



>
> I would not include the comment about valves within the <Context> element; it will only provoke questions and confusion from the uninitiated.

<grin/> Yep.

>
> Under "Add the jars", you use the phrase "unpack the following jars"; that could be construed as taking those jars apart to get the individual class files.  Perhaps something like "extract the following jars from the zip file:"

Clearer. Thanks.


regards




-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

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


RE: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Dave Pawson [mailto:dave.pawson@gmail.com]
> Subject: Simple Tomcat 6, servlet tutorial. First draft for comment
>
> http://www.dpawson.co.uk/tomcat

Looks pretty good.  Some nits to pick:

Under "Compile the restlet example code", you include catalina.jar and tomcat-juli.jar; neither of these should be necessary to compile a servlet.  If they are necessary, there's something wrong with the servlet, since it's making use of Tomcat internals.

The directory structure created in "Tell Tomcat about our servlet" appears in the section above; looks like something's out of order or at least misplaced here.

I would not include the comment about valves within the <Context> element; it will only provoke questions and confusion from the uninitiated.

Under "Add the jars", you use the phrase "unpack the following jars"; that could be construed as taking those jars apart to get the individual class files.  Perhaps something like "extract the following jars from the zip file:" would be clearer.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by Dave Pawson <da...@gmail.com>.
Done. Thanks Michel

2009/2/8 michel <co...@videotron.ca>:
> Dave,
>
> I would suggest that section headings can be a bit clearer, as in the
> following:

...

-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

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


Re: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by michel <co...@videotron.ca>.
Dave,

I would suggest that section headings can be a bit clearer, as in the 
following:


Install location. For this I'm going to use /tc since it is short to write. 
See for more, I found that quite clear. I installed as root to keep it all 
straightforward. As with the Tomcat documentation, I shall use 
$CATALINA_HOME/ instead of this actual location. See docs for the notes.



"Install Location" would be easier if it was in heading format.





----- Original Message ----- 
From: "Dave Pawson" <da...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Sunday, February 08, 2009 7:45 AM
Subject: Simple Tomcat 6, servlet tutorial. First draft for comment


> http://www.dpawson.co.uk/tomcat
>
> Any feedback/improvements appreciated. Particularly any errors.
>
> Meant as a simple example of getting a first servlet working, based on
> help I received from this list.
>
>
> regards
>
> -- 
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
>
> ---------------------------------------------------------------------
> 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: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by Dave Pawson <da...@gmail.com>.
2009/2/10 Mark Thomas <ma...@apache.org>:

> The main use of jsvc is to bind to port <1025 (usually 80 and 443) but run as a
> non-privileged user. If you aren't listening on a port <1025 then you probably
> don't need it.

It didn't work for me Mark!
I run jsvc as root. But yes, I'm listening on 8080.
the other problem was writing out the PID for use
in killing tc.

regards



-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

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


Re: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by Mark Thomas <ma...@apache.org>.
Dave Pawson wrote:
> 2009/2/10 Filip Hanik - Dev Lists <de...@hanik.com>:
>> What benefit do you get from running it with JSVC, vs just writing a simple
>> script into /etc/init.d/ to manage it yourself?
> 
> It was offered. I went to the trouble of amending it to make it work.
> I do manage it myself? How would another script in init.d help?

The main use of jsvc is to bind to port <1025 (usually 80 and 443) but run as a
non-privileged user. If you aren't listening on a port <1025 then you probably
don't need it.

Mark

> 
> regards
> 
> 
>> Filip
>>
>> Dave Pawson wrote:
>>> http://www.dpawson.co.uk/tomcat
>>>
>>> Any feedback/improvements appreciated. Particularly any errors.
>>>
>>> Meant as a simple example of getting a first servlet working, based on
>>> help I received from this list.
>>>
>>>
>>> regards
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> 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: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by michel <co...@videotron.ca>.
One idea might be to have specific "case studies". By that I mean way to 
opften when some things are explained  some details are assumed and not 
really explained, such as what directory to put things in; it leave people 
trying to figure out what is implied by "put in class directory" or such, 
which can be confusing for a new person. How about showing specific cases 
and giving the full path of things and even having a URL where people can 
look at and with an interface that can navigate the directories?

It's just an idea to avoid a lot of "stupid" questions.



----- Original Message ----- 
From: "Dave Pawson" <da...@gmail.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Tuesday, February 10, 2009 6:39 AM
Subject: Re: Simple Tomcat 6, servlet tutorial. First draft for comment


> 2009/2/10 Filip Hanik - Dev Lists <de...@hanik.com>:
>> What benefit do you get from running it with JSVC, vs just writing a 
>> simple
>> script into /etc/init.d/ to manage it yourself?
>
> It was offered. I went to the trouble of amending it to make it work.
> I do manage it myself? How would another script in init.d help?
>
> regards
>
>
>>
>> Filip
>>
>> Dave Pawson wrote:
>>>
>>> http://www.dpawson.co.uk/tomcat
>>>
>>> Any feedback/improvements appreciated. Particularly any errors.
>>>
>>> Meant as a simple example of getting a first servlet working, based on
>>> help I received from this list.
>>>
>>>
>>> regards
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
>
> -- 
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
>
> ---------------------------------------------------------------------
> 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: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
you'd write it yourself

for example, configure CATALINA_HOME, CATALINA_BASE, TOMCAT_USER and 
CATALINA_PID and to start you would do


start() {
    isrunning
    if [ $? -eq 0 ];
    then
        echo "Tomcat is already running: PID=$PID"
        return 1
    fi
           
    if [ -f $CATALINA_BASE/bin/startup.sh ];
    then
        echo "Starting Tomcat"
        /bin/su $TOMCAT_USER $CATALINA_HOME/bin/startup.sh
        PID=`cat $CATALINA_PID`
        echo "Tomcat started: PID=$PID"
    fi
}


the is running function would check to see if the PID exists
the stop function would issue a kill, then sleep X seconds and then 
issue a kill -9 if the process is still running

Filip

Dave Pawson wrote:
> 2009/2/10 Filip Hanik - Dev Lists <de...@hanik.com>:
>   
>> What benefit do you get from running it with JSVC, vs just writing a simple
>> script into /etc/init.d/ to manage it yourself?
>>     
>
> It was offered. I went to the trouble of amending it to make it work.
> I do manage it myself? How would another script in init.d help?
>
> regards
>
>
>   
>> Filip
>>
>> Dave Pawson wrote:
>>     
>>> http://www.dpawson.co.uk/tomcat
>>>
>>> Any feedback/improvements appreciated. Particularly any errors.
>>>
>>> Meant as a simple example of getting a first servlet working, based on
>>> help I received from this list.
>>>
>>>
>>> regards
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> 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: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by Dave Pawson <da...@gmail.com>.
2009/2/10 Filip Hanik - Dev Lists <de...@hanik.com>:
> What benefit do you get from running it with JSVC, vs just writing a simple
> script into /etc/init.d/ to manage it yourself?

It was offered. I went to the trouble of amending it to make it work.
I do manage it myself? How would another script in init.d help?

regards


>
> Filip
>
> Dave Pawson wrote:
>>
>> http://www.dpawson.co.uk/tomcat
>>
>> Any feedback/improvements appreciated. Particularly any errors.
>>
>> Meant as a simple example of getting a first servlet working, based on
>> help I received from this list.
>>
>>
>> regards
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>



-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

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


Re: Simple Tomcat 6, servlet tutorial. First draft for comment

Posted by Filip Hanik - Dev Lists <de...@hanik.com>.
What benefit do you get from running it with JSVC, vs just writing a 
simple script into /etc/init.d/ to manage it yourself?

Filip

Dave Pawson wrote:
> http://www.dpawson.co.uk/tomcat
>
> Any feedback/improvements appreciated. Particularly any errors.
>
> Meant as a simple example of getting a first servlet working, based on
> help I received from this list.
>
>
> regards
>
>   


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