tomcat7 installer fails to create symbolic links

Bug #1232258 reported by Mark Hansen on 2013-09-27
116
This bug affects 23 people
Affects Status Importance Assigned to Milestone
tomcat7 (Ubuntu)
Medium
Unassigned

Bug Description

On Ubuntu 13.04 I did "sudo apt-get install tomcat7". Starting tomcat7 with "sudo service tomcat7 start" shows these warning messages in the catalina.out log:

Sep 27, 2013 8:28:30 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Sep 27, 2013 8:28:30 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Sep 27, 2013 8:28:31 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Sep 27, 2013 8:28:31 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Sep 27, 2013 8:28:31 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Sep 27, 2013 8:28:31 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]

The warnings go away when the following symbolic links are added to /usr/share/tomcat7:

sudo ln -s /var/lib/tomcat7/common/ common
sudo ln -s /var/lib/tomcat7/server/ server
sudo ln -s /var/lib/tomcat7/shared/ shared

I believe the installer should create these links.

Changed in tomcat7 (Ubuntu):
status: New → Confirmed

I suppose the links to conf and logs should be created as well:
cd /usr/share/tomcat7
sudo ln -s /var/lib/tomcat7/conf/ conf
sudo ln -s /var/lib/tomcat7/logs/ logs

The folder temp was missing too :(
sudo mkdir /usr/share/tomcat7/temp

Martin (ub71-martin) wrote :

I can confirm the problem still exists. Please, is someone can review this bug please ?

quent57 (quent57) wrote :

This bug also happen on Ubuntu Server 14.04 using package tomcat7-user .

References to those folders are in this file : conf/catalina.properties (in the tomcat instance) :

common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/common/classes,${catalina.home}/common/*.jar
server.loader=${catalina.home}/server/classes,${catalina.home}/server/*.jar
shared.loader=${catalina.home}/shared/classes,${catalina.home}/shared/*.jar

Content of those folders appear to be optional

$catalina.home is defined in : bin/setenv.sh (in the tomcat instance)

So I created those folders :
sudo mkdir -p /usr/share/tomcat7/common/classes
sudo mkdir -p /usr/share/tomcat7/server/classes
sudo mkdir -p /usr/share/tomcat7/shared/classes

Robie Basak (racb) on 2015-02-23
Changed in tomcat7 (Ubuntu):
importance: Undecided → Medium
Tim Donohue (tdonohue) wrote :

I ran into this bug today on Ubuntu Server 14.04.

I could be wrong, but I'm not sure this is an issue of missing symbolic links, but rather a minor misconfiguration of catalina.properties on Ubuntu 14.04. Specifically, the "server.loader" and "shared.loader" settings are referencing CATALINA_HOME instead of CATALINA_BASE.

So, for example, on Ubuntu 12.04, the default /var/lib/tomcat7/conf/catalina.properties sets these properties as the following:

server.loader=/var/lib/tomcat7/server/classes,/var/lib/tomcat7/server/*.jar
shared.loader=/var/lib/tomcat7/shared/classes,/var/lib/tomcat7/shared/*.jar

However, on Ubuntu 14.04, the hardcoded "/var/lib/tomcat7/" paths have been replaced with "${catalina.home}", so it looks like this:

server.loader=${catalina.home}/server/classes,${catalina.home}/server/*.jar
shared.loader=${catalina.home}/shared/classes,${catalina.home}/shared/*.jar

Unfortunately, "${catalina.home}" translates to "/usr/share/tomcat7"... which is not the proper setting. As we know, these directories don't exist under "/usr/share/tomcat7" (CATALINA_HOME)

The correct setting should be replacing those with ${catalina.base}, as all the referenced directories do exist under "/var/lib/tomcat7" (CATALINA_BASE). So, the correct settings seem to be:

server.loader=${catalina.base}/server/classes,${catalina.base}/server/*.jar
shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/*.jar

This same misconfiguration existing in both of these catalina.properties files:
 * /var/lib/tomcat7/conf/catalina.properties
 * /usr/share/tomcat7/skel/conf/catalina.properties (installed by the tomcat7-user package)

Obviously, creating the symbolic links from these directories in /var/lib/tomcat7/ to /usr/share/tomcat7/ would also be a possible solution. But, it's different than how things were setup in Ubuntu 12.04, when the configurations in catalina.properties were just using CATALINA_BASE directly.

Tim Donohue (tdonohue) wrote :

Per my previous comment, this issue seems to be a possible duplicate of
https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1308284

Peter Matulis (petermatulis) wrote :

Removed Ubuntu Server Guide as affected. This is a software problem.

no longer affects: serverguide
Tim Donohue (tdonohue) wrote :

After further analysis today, I realized my suggestion to correct the configurations in catalina.properties to point at ${catalina.base} instead of ${catalina.home} was WRONG.

The original suggestion of symlinks is a better solution, since the location of ${catalina.base} may not always resolve to /var/lib/tomcat7/.

A good example is when you use the "tomcat7-user" package to install multiple instances of Tomcat under different user accounts. In this scenario, ${catalina.base} would point at the Tomcat user account installation (which would NOT include these various common directories), while ${catalina.home} would still point at /usr/share/tomcat7/

So, all in all, the correct solution here seems to be what was initially recommended. The tomcat7 package should automatically add these three symlinks to /usr/share/tomcat7/:

sudo ln -s /var/lib/tomcat7/common/ common
sudo ln -s /var/lib/tomcat7/server/ server
sudo ln -s /var/lib/tomcat7/shared/ shared

As far as I'm aware those are the only symlinks that should be necessary to resolve this issue.

hardingt (hardingt) wrote :

Confirmed this is still an issue with 14.04 and tomcat7-user

After installing tomcat7-user, those 3 folders are both not in Catalina_home, nor catalina_base.
/usr/share/tomcat7/
/var/lib/tomcat7/

Nor do these three folders exist inside a tomcat user instance folder. So the solutions suggested here of making symlinks wouldn't fix it in that case, as they don't exist.

Eduard von Feek (feek) wrote :

Regarding
sudo ln -s /var/lib/tomcat7/common/ /usr/share/tomcat7/common
etc...

So the currently proposed solution is to create links in the CATALINA_HOME directory (i.e. the "singleton installation directory") pointing to some example CATALINA_BASE instance directory (i.e. the instance directory with the ROOT default hello-world servlet).

This feels like a workaround. When this issue is resolved, having the symbolic linking go in the opposite direction (i.e. CATALINA_HOME has all required directories) feels more sensible to me.

Tom Harrison (tomharrisonjr) wrote :

Re @tdonohue post #7, I followed the path of adding symlinks to /usr/share/tomcat7

In addition to creating these symlinks in /usr/share/tomcat7

sudo ln -s /var/lib/tomcat7/common/ common
sudo ln -s /var/lib/tomcat7/server/ server
sudo ln -s /var/lib/tomcat7/shared/ shared

I also needed to create

sudo ln -s /var/lib/tomcat7/common/ conf

and

mkdir temp

Both of these config issues were reported by the utility

/usr/share/tomcat7/bin/configtest.sh

Tux (cokaricmarin8) wrote :

Thank you for all of your comments. This bug drive me crazy. I was unable to figure out what was it and why it happened. Most people said wrong permission but when I would check folders they didn't even exist...

/usr/share/tomcat7/conf# lsb_release -da
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

I deployed this VPS on DigitalOcean. I installed tomcat by typing apt-get install tomcat7 after issuing a apt-get update and apt-get upgrade

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers