You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lyallex <ly...@gmail.com> on 2007/10/24 13:39:51 UTC

Confused about startup

Hello

Windows XP SP2
Java 1.5.0_10
Tomcat 5.5.25

After many years using Tomcat to host various web sites I thought it
was about time I started looking at some of the code. I downloaded the
source for 5.5.25 and thought I'd start at the beginning and figure
out what happens when I start the server from the command line..
After deciphering the batch files (catalina.bat, startup.bat and
setclasspath.bat) I figured out that the class being invoked was
org.apache.catalina.startup.Bootstrap with the command line param
start ... Well that's about as far as I get because I just can't
figure out the entry point. I know that an instance of
org.apache.catalina.startup.Catalina is being instantiated and invoked
eventually but the main method in Bootstrap is apparently only used
for testing.
At least that what he comments state ... but main must be being called
mustn't it ...  If main is not being called in Bootstrap how do things
kick off... I'm a bit distressed that I can't figure this out. I
haven't got around to building the distribution yet.

I've read http://tomcat.apache.org/tomcat-5.5-doc/architecture/startup/serverStartup.txt
but I'm still at a loss, maybe I'm getting too old for all this or
maybe I'm just tired ...

Thanks

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


Re: Confused about startup

Posted by Lyallex <ly...@gmail.com>.
Hi

Thanks for this and thanks to those that replied about this off list.
Sometmes I struggle to make myself understood, this is one such time I think.

All I really wanted to know was why Bootstrap.main() had the line

"Main method, used for testing only"

In it's comment block. As far as I can see this is just one of those
things, maybe it should be removed, maybe it should stay if there is a
good reason.

I does go to show that something as simple as a one line comment can
cause much confusion to those of us that rely on a combination of code
and comment to understand what's going on in code we have not seen
before.

I once knew a PhD who was always saying that he did not need comments
as he could read code, well possibly, but for us mere mortals comments
can make the difference between success and failure.

Keep up the good work

Cheers
Duncan

On 10/24/07, Konstantin Kolinko <kn...@gmail.com> wrote:
> Hi,
>
> I can say you a few words about this bootstrap class. I remember how I
> was proud, when I managed to decypher what it actually does. It was a
> year ago, but it is still a good memory. ;)  It's an excellent piece.
> I hope that in a while you will be able to share these feelings of
> joy.
>
> In essence, it parses catalina.properties (either the default copy of
> it, or the one available in the conf folder), sets up a chain of
> classloaders (see
> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html), and
> starts the server.
>
> Most of the work is done through reflection calls.
>
> JMX test at the begin of Bootstrap.main() (in tomcat 5.5 only) is
> required, because JMX is used to manage tomcat instance. Thus there is
> a quick test, and a message if the test fails.
>
> Please note, that catalina.properties specifies patterns, e.g.
> ${catalina.home}/common/lib/*.jar, but ClassLoader instance requires
> references to actual jar files, thus some lookup is performed to get
> the actual names from the pattern.
>
> The startup sequence description in
> http://tomcat.apache.org/tomcat-5.5-doc/architecture/startup/serverStartup.txt
> is correct. It is not a simple matter though.
>
> The comment for Bootstrap.main( ) is, well, misleading.
> Both in 5.5.25 and 6.0.14 sources.
> Should someone provide a patch for this?
>
> Actually, the Bootstrap class is not so important. The more important
> class is org.apache.catalina.startup.Catalina, and its main(args)
> method is commented as being the entry point.
>
>
> 2007/10/24, Lyallex <ly...@gmail.com>:
> > Hmm, obviously this was "not an acceptable question" ... shame.
> >
> > Still, I have now managed to get 5.5.25 to build and run and when I
> > put some simple debug in Bootstrap.main() it does indeed appear that
> > this method is being called.
> >
> > Still slightly confused as to why this method is commented as
> >
> > /**
> >      * Main method, used for testing only.
> >      *
> >      * @param args Command line arguments to be processed
> >      */
> >
> > Ah well, it's all character building stuff I suppose.
> >
> > On 10/24/07, Lyallex <ly...@gmail.com> wrote:
> > > Hello
> > >
> > > Windows XP SP2
> > > Java 1.5.0_10
> > > Tomcat 5.5.25
> > >
> > > After many years using Tomcat to host various web sites I thought it
> > > was about time I started looking at some of the code. I downloaded the
> > > source for 5.5.25 and thought I'd start at the beginning and figure
> > > out what happens when I start the server from the command line..
> > > After deciphering the batch files (catalina.bat, startup.bat and
> > > setclasspath.bat) I figured out that the class being invoked was
> > > org.apache.catalina.startup.Bootstrap with the command line param
> > > start ... Well that's about as far as I get because I just can't
> > > figure out the entry point. I know that an instance of
> > > org.apache.catalina.startup.Catalina is being instantiated and invoked
> > > eventually but the main method in Bootstrap is apparently only used
> > > for testing.
> > > At least that what he comments state ... but main must be being called
> > > mustn't it ...  If main is not being called in Bootstrap how do things
> > > kick off... I'm a bit distressed that I can't figure this out. I
> > > haven't got around to building the distribution yet.
> > >
> > > I've read http://tomcat.apache.org/tomcat-5.5-doc/architecture/startup/serverStartup.txt
> > > but I'm still at a loss, maybe I'm getting too old for all this or
> > > maybe I'm just tired ...
> > >
> > > Thanks
> > >
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: Confused about startup

Posted by Konstantin Kolinko <kn...@gmail.com>.
Hi,

I can say you a few words about this bootstrap class. I remember how I
was proud, when I managed to decypher what it actually does. It was a
year ago, but it is still a good memory. ;)  It's an excellent piece.
I hope that in a while you will be able to share these feelings of
joy.

In essence, it parses catalina.properties (either the default copy of
it, or the one available in the conf folder), sets up a chain of
classloaders (see
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html), and
starts the server.

Most of the work is done through reflection calls.

JMX test at the begin of Bootstrap.main() (in tomcat 5.5 only) is
required, because JMX is used to manage tomcat instance. Thus there is
a quick test, and a message if the test fails.

Please note, that catalina.properties specifies patterns, e.g.
${catalina.home}/common/lib/*.jar, but ClassLoader instance requires
references to actual jar files, thus some lookup is performed to get
the actual names from the pattern.

The startup sequence description in
http://tomcat.apache.org/tomcat-5.5-doc/architecture/startup/serverStartup.txt
is correct. It is not a simple matter though.

The comment for Bootstrap.main( ) is, well, misleading.
Both in 5.5.25 and 6.0.14 sources.
Should someone provide a patch for this?

Actually, the Bootstrap class is not so important. The more important
class is org.apache.catalina.startup.Catalina, and its main(args)
method is commented as being the entry point.


2007/10/24, Lyallex <ly...@gmail.com>:
> Hmm, obviously this was "not an acceptable question" ... shame.
>
> Still, I have now managed to get 5.5.25 to build and run and when I
> put some simple debug in Bootstrap.main() it does indeed appear that
> this method is being called.
>
> Still slightly confused as to why this method is commented as
>
> /**
>      * Main method, used for testing only.
>      *
>      * @param args Command line arguments to be processed
>      */
>
> Ah well, it's all character building stuff I suppose.
>
> On 10/24/07, Lyallex <ly...@gmail.com> wrote:
> > Hello
> >
> > Windows XP SP2
> > Java 1.5.0_10
> > Tomcat 5.5.25
> >
> > After many years using Tomcat to host various web sites I thought it
> > was about time I started looking at some of the code. I downloaded the
> > source for 5.5.25 and thought I'd start at the beginning and figure
> > out what happens when I start the server from the command line..
> > After deciphering the batch files (catalina.bat, startup.bat and
> > setclasspath.bat) I figured out that the class being invoked was
> > org.apache.catalina.startup.Bootstrap with the command line param
> > start ... Well that's about as far as I get because I just can't
> > figure out the entry point. I know that an instance of
> > org.apache.catalina.startup.Catalina is being instantiated and invoked
> > eventually but the main method in Bootstrap is apparently only used
> > for testing.
> > At least that what he comments state ... but main must be being called
> > mustn't it ...  If main is not being called in Bootstrap how do things
> > kick off... I'm a bit distressed that I can't figure this out. I
> > haven't got around to building the distribution yet.
> >
> > I've read http://tomcat.apache.org/tomcat-5.5-doc/architecture/startup/serverStartup.txt
> > but I'm still at a loss, maybe I'm getting too old for all this or
> > maybe I'm just tired ...
> >
> > Thanks
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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


Re: Confused about startup

Posted by Lyallex <ly...@gmail.com>.
Hmm, obviously this was "not an acceptable question" ... shame.

Still, I have now managed to get 5.5.25 to build and run and when I
put some simple debug in Bootstrap.main() it does indeed appear that
this method is being called.

Still slightly confused as to why this method is commented as

/**
     * Main method, used for testing only.
     *
     * @param args Command line arguments to be processed
     */

Ah well, it's all character building stuff I suppose.

On 10/24/07, Lyallex <ly...@gmail.com> wrote:
> Hello
>
> Windows XP SP2
> Java 1.5.0_10
> Tomcat 5.5.25
>
> After many years using Tomcat to host various web sites I thought it
> was about time I started looking at some of the code. I downloaded the
> source for 5.5.25 and thought I'd start at the beginning and figure
> out what happens when I start the server from the command line..
> After deciphering the batch files (catalina.bat, startup.bat and
> setclasspath.bat) I figured out that the class being invoked was
> org.apache.catalina.startup.Bootstrap with the command line param
> start ... Well that's about as far as I get because I just can't
> figure out the entry point. I know that an instance of
> org.apache.catalina.startup.Catalina is being instantiated and invoked
> eventually but the main method in Bootstrap is apparently only used
> for testing.
> At least that what he comments state ... but main must be being called
> mustn't it ...  If main is not being called in Bootstrap how do things
> kick off... I'm a bit distressed that I can't figure this out. I
> haven't got around to building the distribution yet.
>
> I've read http://tomcat.apache.org/tomcat-5.5-doc/architecture/startup/serverStartup.txt
> but I'm still at a loss, maybe I'm getting too old for all this or
> maybe I'm just tired ...
>
> Thanks
>

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