Re: Where Tomcat webapp contexts live on Debian (NOT off-topic; A LEGITIMATE TECHNICAL QUESTION)

2017-08-17 Thread tomcat

On 17.08.2017 02:29, James H. H. Lampert wrote:

On 8/16/17, 11:43 AM, André Warnier (tomcat) wrote:
, , ,

So as a start, look at /etc/init.d/tomcat7 on your system, and check
what other files this calls/references. One important thing here, is
what the environment variable CATALINA_BASE ends up containing.


Ok. This is starting to look interesting. CATALINA_BASE seems to be set to 
/var/lib/tomcat7.

And when I do an "ls -l" on /var/lib/tomcat7, I find that "conf" is a symbolic 
link to
/etc/tomcat7, and "logs" and "work" are also symbolic links.

Now THIS is interesting: in /etc/tomcat7/Catalina/localhost, I find a couple of 
files,
"manager.xml" and "host-manager.xml," and both of them contain a "Context" tag 
with a
docBase pointing to where the corresponding contexts live.

Am I getting any closer to understanding how this works?



Yes, but don't go too fast, or you'll get confused.

Forget for now the "manager" and "host manager", and follow the track to your 
own webapps.
CATALINA_BASE points to the "root directory" of this Tomcat running instance. (There could 
be more, each with its own CATALINA_BASE).


In CATALINA_BASE/conf, is where Tomcat is expecting to find its main 
configuration files.
The file "server.xml" there is the main configuration file for this Tomcat 
running instance.
Inside that file, is a  tag, which specifies the (relative to CATALINA_BASE) 
location of the place where the normal webapps (of this instance) should be found.
(There can also be several  tags, one per "virtual host", but that's for another 
day. Let's assume for now that there is just one there, and that's the default Host).


Unlike Apache httpd e.g., the (relative) top of the webapps directory (which may be called 
the "default webapp") is not "/".

For Tomcat, it is the (webapps_dir)/ROOT/ (in capitals).
And other web applications live in parallel directories there, like
(webapps_dir)/app1/
(webapps_dir)/app2/
(webapps_dir)/app3/
 etc..
Each of these "applications" has its own expected structure, with sub-directories such as 
"WEB-INF", "META-INF" etc.


And at this point, you should go back to the pointers given by Konstantion earlier, and 
read these pages to understand what this all means.


The thing to understand is : Tomcat has its own "expectations" as to how this is all 
laid-out on disk (many of these expectations being due to the Java Servlet Specification).

But Linux Debian has a different schema, across all software packages, where it 
expects e.g.
- configuration files to be under "/etc"
- logfiles to be under "/var/log"
- shared executable code to be under "/usr/share"
etc.
All that these Debian/apt directory links do, is to try to "coerce" Tomcat into fitting 
into the Debian classic disk layout, so that system administrators would find things where 
they generally expect them to be. (And not like where the Tomcat developers, or the Apache 
httpd developers, or the logrotate developers each expect their own personal little 
package to be)(apologies for this to the respective developer's teams ;-) ).
That just makes it much easier for sysadmins e.g., because they know for example that if 
they backup the "/etc" directory, they have in one go *all* the configuration files of 
*all* the installed packages. And they now that they have to watch the filesystem 
"/var/log" for space, because that is where *all* the installed packages write their 
logfiles. And they know that for example "/usr/share" contains only code, and should not 
grow uncontrollably because of some rogue application writing its data files there.


Another way of looking at this, is not to say that "Debian packagers put Tomcat files all 
over the place", but rather that
- individual software packages normally put their files all over the place (if you 
consider a set of packages, not just one)
- the Debian packagers try to restore some order in this chaos, and to put things where 
they are supposed to be, from a global, whole system point of view


(And similarly - but of course a bit differently - for other Linux distributions. Where 
would be the fun if they all did it the same way ?).






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



Re: Where Tomcat webapp contexts live on Debian (NOT off-topic; A LEGITIMATE TECHNICAL QUESTION)

2017-08-16 Thread Peter Kreuser
That's what I tried to say... sorry I was maybe not specific enough...

Peter

> Am 17.08.2017 um 02:29 schrieb James H. H. Lampert :
> 
>> On 8/16/17, 11:43 AM, André Warnier (tomcat) wrote:
>> , , ,
>> So as a start, look at /etc/init.d/tomcat7 on your system, and check
>> what other files this calls/references. One important thing here, is
>> what the environment variable CATALINA_BASE ends up containing.
> 
> Ok. This is starting to look interesting. CATALINA_BASE seems to be set to 
> /var/lib/tomcat7.
> 
> And when I do an "ls -l" on /var/lib/tomcat7, I find that "conf" is a 
> symbolic link to /etc/tomcat7, and "logs" and "work" are also symbolic links.
> 
> Now THIS is interesting: in /etc/tomcat7/Catalina/localhost, I find a couple 
> of files, "manager.xml" and "host-manager.xml," and both of them contain a 
> "Context" tag with a docBase pointing to where the corresponding contexts 
> live.
> 
> Am I getting any closer to understanding how this works?
> 
> --
> JHHL
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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



Re: Where Tomcat webapp contexts live on Debian (NOT off-topic; A LEGITIMATE TECHNICAL QUESTION)

2017-08-16 Thread James H. H. Lampert

On 8/16/17, 11:43 AM, André Warnier (tomcat) wrote:
, , ,

So as a start, look at /etc/init.d/tomcat7 on your system, and check
what other files this calls/references. One important thing here, is
what the environment variable CATALINA_BASE ends up containing.


Ok. This is starting to look interesting. CATALINA_BASE seems to be set 
to /var/lib/tomcat7.


And when I do an "ls -l" on /var/lib/tomcat7, I find that "conf" is a 
symbolic link to /etc/tomcat7, and "logs" and "work" are also symbolic 
links.


Now THIS is interesting: in /etc/tomcat7/Catalina/localhost, I find a 
couple of files, "manager.xml" and "host-manager.xml," and both of them 
contain a "Context" tag with a docBase pointing to where the 
corresponding contexts live.


Am I getting any closer to understanding how this works?

--
JHHL

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



Re: Where Tomcat webapp contexts live on Debian (NOT off-topic; A LEGITIMATE TECHNICAL QUESTION)

2017-08-16 Thread tomcat

On 16.08.2017 17:22, James H. H. Lampert wrote:

Uh, EXCUSE ME, my post was NOT a "ranting."

It was A REQUEST FOR TECHNICAL INFORMATION.

The unusual way Tomcat is organized if installed via an "apt-get" from Debian's 
repository
is a given. I made OBSERVATIONS about it, by way of framing my question. While 
I could not
manage to keep my opinions on that organization completely to myself, I DID 
endeavor to
restrain those opinions.

The question is, *HOW* does Tomcat know where to find webapp contexts in all 
those
different places? Obviously, SOMETHING, presumably something in a configuration 
file, has
to tell it to look for them in a bunch of different places, but WHAT, and WHERE?



Hi.
I did not mean to suggest that /your/ post was a ranting, and I understood perfectly that 
you just wanted to know. My purpose was to address some other posts, in response to yours 
but also many previous similar ones, which repeatedly go in the direction of "install a 
standard Tomcat" as a response to questions like yours. (That's also why I prefixed my 
intervention with [OT]).

My apologies if this was not clear.
(But no need to SHOUT either)

Kontantin started to answer your question.
See also the last (non-PS) paragraph of my previous post, to understand why we cannot 
always answer questions quickly and in a simple way.
The problem in this case is : your question looks simple in appearance; but the full 
answer /is/ really complex, and involves many variations, some of which have to do with 
the platform, some with the scripts which on that platform start Tomcat, some with the 
Tomcat configuration files, some with the Tomcat version, some with the applications 
themselves etc.
So the "SOMETHING" that you want to find out, is not /one/ thing, but /many/ things which 
cooperate (or not) to provide the full answer.


I could tell you exactly how it works on /my/ Debian systems, with /my/ version of Debian, 
with /my/ version of Java, /my/ version of Tomcat and /my/ applications. But unless you 
happened to have the same as mine for everything, that would not be entirely applicable to 
your situation.
We all had to go through the same exercise, to find out how Tomcat and its applications 
were started on our particular platform of choice, and we all have to redo that same 
exercise from time to time, as things keep changing.


So as a start, look at /etc/init.d/tomcat7 on your system, and check what other files this 
calls/references. One important thing here, is what the environment variable CATALINA_BASE 
ends up containing.



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



Re: Where Tomcat webapp contexts live on Debian (NOT off-topic; A LEGITIMATE TECHNICAL QUESTION)

2017-08-16 Thread James H. H. Lampert

On 8/16/17, 10:13 AM, Konstantin Kolinko wrote:


I see that you mentioned that you are using Tomcat 7.

See [1] for how contexts are defined and [2] for attributes "appBase"
and "xmlBase" of a Host.

. . .

Thanks. I'll be looking into the links you sent me later today, and if I 
have any further questions, they'll probably be more specific, and less 
likely to be misread as an off-topic rant.


--
JHHL

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



Re: Where Tomcat webapp contexts live on Debian (NOT off-topic; A LEGITIMATE TECHNICAL QUESTION)

2017-08-16 Thread Konstantin Kolinko
2017-08-16 18:22 GMT+03:00 James H. H. Lampert :
> Uh, EXCUSE ME, my post was NOT a "ranting."
>
> It was A REQUEST FOR TECHNICAL INFORMATION.
>
> The unusual way Tomcat is organized if installed via an "apt-get" from
> Debian's repository is a given. I made OBSERVATIONS about it, by way of
> framing my question. While I could not manage to keep my opinions on that
> organization completely to myself, I DID endeavor to restrain those
> opinions.
>
> The question is, *HOW* does Tomcat know where to find webapp contexts in all
> those different places? Obviously, SOMETHING, presumably something in a
> configuration file, has to tell it to look for them in a bunch of different
> places, but WHAT, and WHERE?

I see that you mentioned that you are using Tomcat 7.

See [1] for how contexts are defined and [2] for attributes "appBase"
and "xmlBase" of a Host.


[1] 
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Defining_a_context
[2] http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Common_Attributes

Generally, context are created in three ways:
1) when Tomcat starts and server.xml is parsed

If there are any explicit "Context" elements in a Host, a Context is
created for each.

2) by auto-deployment logic that runs when Tomcat starts (aka
deployOnStartup) or runs periodically (aka autoDeploy)

It looks for files in Host's xmlBase (I see somewhere it is called
"configBase") and directories in Host's appBase directory. See [3]

3) programmatically via API, JMX calls
- via Tomcat Manager web application,
by org.apache.catalina.startup.UserConfig listener [4],
etc.

[3] 
http://tomcat.apache.org/tomcat-7.0-doc/config/host.html#Automatic_Application_Deployment
[4] 
http://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#UserConfig_-_org.apache.catalina.startup.UserConfig

Best regards,
Konstantin Kolinko

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



Re: Where Tomcat webapp contexts live on Debian (NOT off-topic; A LEGITIMATE TECHNICAL QUESTION)

2017-08-16 Thread James H. H. Lampert

Uh, EXCUSE ME, my post was NOT a "ranting."

It was A REQUEST FOR TECHNICAL INFORMATION.

The unusual way Tomcat is organized if installed via an "apt-get" from 
Debian's repository is a given. I made OBSERVATIONS about it, by way of 
framing my question. While I could not manage to keep my opinions on 
that organization completely to myself, I DID endeavor to restrain those 
opinions.


The question is, *HOW* does Tomcat know where to find webapp contexts in 
all those different places? Obviously, SOMETHING, presumably something 
in a configuration file, has to tell it to look for them in a bunch of 
different places, but WHAT, and WHERE?


--
JHHL

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