Re: CATALINA_BASE vs CATALINA_HOME: What must be where?

2020-09-28 Thread Konstantin Kolinko
пн, 28 сент. 2020 г. в 23:04, Christopher Schultz
:
>
> Konstantin,
>
> On 9/27/20 14:33, Konstantin Kolinko wrote:
> > сб, 26 сент. 2020 г. в 18:12, Christopher Schultz
> > :
> >>
> >> All,
> >>
> >> I'm writing about the above topic for ApacheCon @ Home and I wanted to
> >> get some confirmation about a few statements. The code is ... large and
> >> complex and it will be easier to just ask for help from those who Know.
> >>
> >> "
> >> Many files in CATALINA_BASE are optional
> >> * Override those in CATALINA_HOME
> >>  - conf/context.xml
> >
> > I think you are wrong with the above one. By design it has to be in
> > CATALINA_BASE, it cannot be in CATALINA_HOME.
> > E.g.
> > - org.a.c.startup.HostConfig.addGlobalRedeployResources() assumes that
> > the file is in CATALINA_BASE.
> > - org.a.c.startup.CatalinaBaseConfigurationSource#getResources() loads
> > a file from catalinaBase.
>
> My CATALINA_BASE deployments never include a conf/context.xml file. So
> either it's never required or it's only required if the application
> doesn't supply one.

I think that it just is not required. The default file is essentially empty.
It contains just a number of WatchedResource elements. I have not
checked whether there are defaults for them, but as I always run with
 they just do not matter. Maybe that happens
in your use case as well.

(Note that it does not override the file of CATALINA_HOME. The file in
CATALINA_HOME is not read and does not matter.)


By the way, one more thing to mention:
The behaviour of the "lib" directories: According to the value of
property "common.loader" as configured in catalina.properties file,
the libraries and classes are loaded from both base and home. The base
does not overwide home here, but they are combined (in a certain order
- see the value of that property).

Best regards,
Konstantin Kolinko

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



Re: CATALINA_BASE vs CATALINA_HOME: What must be where?

2020-09-28 Thread Christopher Schultz
Konstantin,

On 9/27/20 14:33, Konstantin Kolinko wrote:
> сб, 26 сент. 2020 г. в 18:12, Christopher Schultz
> :
>>
>> All,
>>
>> I'm writing about the above topic for ApacheCon @ Home and I wanted to
>> get some confirmation about a few statements. The code is ... large and
>> complex and it will be easier to just ask for help from those who Know.
>>
>> "
>> Many files in CATALINA_BASE are optional
>> * Override those in CATALINA_HOME
>>  - conf/context.xml
> 
> I think you are wrong with the above one. By design it has to be in
> CATALINA_BASE, it cannot be in CATALINA_HOME.
> E.g.
> - org.a.c.startup.HostConfig.addGlobalRedeployResources() assumes that
> the file is in CATALINA_BASE.
> - org.a.c.startup.CatalinaBaseConfigurationSource#getResources() loads
> a file from catalinaBase.

My CATALINA_BASE deployments never include a conf/context.xml file. So
either it's never required or it's only required if the application
doesn't supply one.

>> * Some files are required in CATALINA_BASE
>>  - conf/server.xml
>>  - conf/catalina.policy
>>  - conf/web.xml
> 
> catalina.policy is not needed if you are not running with a
> SecurotyManager enabled.

Ack.

>> Some Exceptions may be Surprising
>> * Only in CATALINA_HOME
>>  - bin/setclasspath.sh
> .
> That is some helper script that should not be customized.
> 
> When people modify that file it usually means that they have not read
> the documentation and do not know about setenv.sh.

I agree, but it's worth pointing out (a) it must be in HOME and (b) you
shouldn't be changing it.

>>  - endorsed/ (special Java libraries)
> 
> The path to endorsed directory is settable in setenv.sh. The directory
> can be anywhere. I have experience of running several Tomcat 7
> instances where only some of them had an endorsed directory. And I am
> sure that you know that it is a technology that does not work with
> modern versions of Java.

Agreed. I'm talking about a "stock" Tomcat: where will tomcat look for
things unless you override them. Assuming you already know how to
override them, then you don't need to know where their defaults are :)

>>  - bin/bootstrap.jar
>> "
>>
>> Is this all correct?
>>
>> Am I missing anything?
> 
> There may be some "last resort" defaults, e.g. I see that a copy of
> catalina.properties is present in catalina.jar. I also see that
> CatalinaBaseConfigurationSource#getResources() tries to load a
> resource from a ClassLoader, but it would be odd to put configuration
> there.
> 
> From the docs I know that a system property "catalina.config" may be
> used to override the path to the "catalina.properties" file, but I
> personally have not used that feature and do not know whether it is
> useful. As documentation for that property is improved in Tomcat 10 vs
> Tomcat 7, I think there was some discussion.
> 
> http://tomcat.apache.org/tomcat-10.0-doc/config/systemprops.html#Other
> http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html#Other
> 
> I know that path to server.xml may be specified at the command line.
> See o.a.startup.Catalina#arguments() for "-config".
> I have not tested whether it works, and I do not see "-config" being
> documented in RUNNING.txt or elsewhere in the docs.

Ack.

Thanks for the review.

-chris

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



Re: CATALINA_BASE vs CATALINA_HOME: What must be where?

2020-09-27 Thread Konstantin Kolinko
сб, 26 сент. 2020 г. в 18:12, Christopher Schultz
:
>
> All,
>
> I'm writing about the above topic for ApacheCon @ Home and I wanted to
> get some confirmation about a few statements. The code is ... large and
> complex and it will be easier to just ask for help from those who Know.
>
> "
> Many files in CATALINA_BASE are optional
> * Override those in CATALINA_HOME
>  - conf/context.xml

I think you are wrong with the above one. By design it has to be in
CATALINA_BASE, it cannot be in CATALINA_HOME.
E.g.
- org.a.c.startup.HostConfig.addGlobalRedeployResources() assumes that
the file is in CATALINA_BASE.
- org.a.c.startup.CatalinaBaseConfigurationSource#getResources() loads
a file from catalinaBase.

> * Some files are required in CATALINA_BASE
>  - conf/server.xml
>  - conf/catalina.policy
>  - conf/web.xml

catalina.policy is not needed if you are not running with a
SecurotyManager enabled.

> Some Exceptions may be Surprising
> * Only in CATALINA_HOME
>  - bin/setclasspath.sh
.
That is some helper script that should not be customized.

When people modify that file it usually means that they have not read
the documentation and do not know about setenv.sh.

>  - endorsed/ (special Java libraries)

The path to endorsed directory is settable in setenv.sh. The directory
can be anywhere. I have experience of running several Tomcat 7
instances where only some of them had an endorsed directory. And I am
sure that you know that it is a technology that does not work with
modern versions of Java.

>  - bin/bootstrap.jar
> "
>
> Is this all correct?
>
> Am I missing anything?

There may be some "last resort" defaults, e.g. I see that a copy of
catalina.properties is present in catalina.jar. I also see that
CatalinaBaseConfigurationSource#getResources() tries to load a
resource from a ClassLoader, but it would be odd to put configuration
there.

>From the docs I know that a system property "catalina.config" may be
used to override the path to the "catalina.properties" file, but I
personally have not used that feature and do not know whether it is
useful. As documentation for that property is improved in Tomcat 10 vs
Tomcat 7, I think there was some discussion.

http://tomcat.apache.org/tomcat-10.0-doc/config/systemprops.html#Other
http://tomcat.apache.org/tomcat-7.0-doc/config/systemprops.html#Other

I know that path to server.xml may be specified at the command line.
See o.a.startup.Catalina#arguments() for "-config".
I have not tested whether it works, and I do not see "-config" being
documented in RUNNING.txt or elsewhere in the docs.

Best regards,
Konstantin Kolinko

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