Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 450986 - New Tomcat init script does not respect catalina.properties
Summary: New Tomcat init script does not respect catalina.properties
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-09 08:39 UTC by Jérôme Revillard
Modified: 2016-02-19 20:43 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jérôme Revillard 2013-01-09 08:39:19 UTC
Hi,

According to http://wiki.gentoo.org/wiki/Apache_Tomcat , a lot of work has been done in the Tomcat installation. Providing a way to have many instances is really good but the new init script does not respect anymore the catalina.properties file variables. In the later, by default, for tomcat-6 we have:

[code]#
#
# List of comma-separated paths defining the contents of the "common" 
# classloader. Prefixes should be used to define what is the repository type.
# Path may be relative to the CATALINA_HOME or CATALINA_BASE path or absolute.
# If left as blank,the JVM system loader will be used as Catalina's "common" 
# loader.
# Examples:
#     "foo": Add this folder as a class repository
#     "foo/*.jar": Add all the JARs of the specified folder as class 
#                  repositories
#     "foo/bar.jar": Add bar.jar as a class repository
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar[/code]

But in fact, with the new init script, the common classpath is generated from the output of:

[code]CLASSPATH=`java-config --classpath tomcat-6${TOMCAT_EXTRA_JARS:+,${TOMCAT_EXTRA_JARS}}`[/code]

I think this is not good. We need to add many jars and configuration files in the '${catalina.base}/lib' in order to make our application working and the only way I found to do that is to add the following line in the  /etc/conf.d/tomat-6 file:

[code]TOMCAT_EXTRA_CLASSPATH="$(ls -d -1 /usr/share/tomcat-6/lib/*.jar |tr '\n' ':')/usr/share/tomcat-6/lib"[/code]

Wouldn't it be good to respect the Tomcat configuration files ?

Best

Reproducible: Always
Comment 1 Ralph Sennhauser (RETIRED) gentoo-dev 2013-01-12 08:27:13 UTC
(In reply to comment #0)
[snip]
> But in fact, with the new init script, the common classpath is generated
> from the output of:
> 
> [code]CLASSPATH=`java-config --classpath
> tomcat-6${TOMCAT_EXTRA_JARS:+,${TOMCAT_EXTRA_JARS}}`[/code]

The the global classpath consists of:
- the jars absolutely required
- the system packages listed in TOMCAT_EXTRA_JARS
- an arbitrary path in TOMCAT_EXTRA_CLASSPATH

TOMCAT_EXTRA_JARS isn't required but is more convenient than TOMCAT_EXTRA_CLASSPATH and may avoid an additional call to java-config.

> I think this is not good. We need to add many jars and configuration files
> in the '${catalina.base}/lib' in order to make our application working and
> the only way I found to do that is to add the following line in the 
> /etc/conf.d/tomat-6 file:
> 
> [code]TOMCAT_EXTRA_CLASSPATH="$(ls -d -1 /usr/share/tomcat-6/lib/*.jar |tr
> '\n' ':')/usr/share/tomcat-6/lib"[/code]
> 

The package manager wont install any jar or class files there without recording them properly. So your value of TOMCAT_EXTRA_CLASSPATH should be meaningless unless you put stuff there manually, which I wouldn't recommend.

Just let the jars and classes in their natural place and construct TOMCAT_EXTRA_CLASSPATH accordingly. Java 6 and later also support wildcards.
So TOMCAT_EXTRA_CLASSPATH="/home/sera/random_jars/*:/home/sera/random_classes" would be admittedly an extreme but valid example.

If you want to put them all in one place '${catalina.base}/lib' sounds about right.

> Wouldn't it be good to respect the Tomcat configuration files ?

We do, supposedly. Did you edit the one in CATALINA_HOME/conf instead of the one in CATALINA_BASE/conf? CATALINA_BASE/conf is a symlink to /etc/<qualified instance name>/
Comment 2 James Le Cuirot gentoo-dev 2016-02-19 20:43:35 UTC
I believe sera was right and we've reworked the init scripts to respect Tomcat's class loader now instead of relying on the system classpath. Closing.