Folder problems with Tomcat 7 on Ubuntu
I have installed Tomcat 7 on Ubuntu 14.04. The main problem lies in two different folders that are sometimes redundant:
/ Usr / share / tomcat7
drwxrwxrwx 2 root root 4096 dic 15 2013 backup
drwxrwxrwx 2 root root 4096 set 3 13:28 bin
lrwxrwxrwx 1 root root 21 nov 17 2013 conf -> /var/lib/tomcat7/conf
-rwxrwxrwx 1 root root 39 feb 21 2014 defaults.md5sum
-rwxrwxrwx 1 root root 2030 feb 21 2014 defaults.template
drwxrwxrwx 2 root root 4096 set 3 13:28 lib
lrwxrwxrwx 1 root root 16 nov 17 2013 log -> /var/log/tomcat7
-rwxrwxrwx 1 root root 53 feb 21 2014 logrotate.md5sum
-rwxrwxrwx 1 root root 118 feb 21 2014 logrotate.template
drwxrwxrwx 2 root root 4096 dic 2 13:00 logs
drwxrwxrwx 3 root root 4096 dic 6 17:33 webapps
drwxrwxrwx 3 root root 4096 dic 15 2013 work
drwxrwxrwx 5 root root 4096 dic 2 13:16 wtpwebapps
/ var / Library / tomcat7
drwxr-xr-x 3 tomcat7 tomcat7 4096 nov 16 2013 common
lrwxrwxrwx 1 root root 12 mag 24 2013 conf -> /etc/tomcat7
lrwxrwxrwx 1 root root 17 mag 24 2013 logs -> ../../log/tomcat7
drwxr-xr-x 3 tomcat7 tomcat7 4096 nov 16 2013 server
drwxr-xr-x 3 tomcat7 tomcat7 4096 nov 16 2013 shared
drwxrwxr-x 4 tomcat7 tomcat7 4096 dic 6 23:51 webapps
lrwxrwxrwx 1 root root 19 mag 24 2013 work -> ../../cache/tomcat7
When I installed packages like tomcat7-docs
, tomcat7-examples
and tomcat7-admins
, they were automatically deployed under /usr/share/tomcat7/webapps
. Eclipse also automatically expands the files under the /usr/share/tomcat7/wtpwebapps
.
However, if I need to deploy a web application, I have to put it under /var/lib/tomcat7/webapps
; I don't know if this is correct, maybe yes, but why? Also, when I look at the log files generated when my web applications start, tomcat complains about some folders that don't exist; indeed, they exist only under /var/lib/tomcat7
, and not under /usr/share/tomcat7
.
Dec 06, 2014 11:50:23 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Dec 06, 2014 11:50:23 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Dec 06, 2014 11:50:23 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Dec 06, 2014 11:50:23 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Dec 06, 2014 11:50:23 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Dec 06, 2014 11:50:23 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
So what should I change to make this work? Is this folder structure accessible?
source to share
These 2 directories are used by tomcat to allow configuration of multiple tomcat instances using one installation directory, but each has its own directories for deployment, logs, conf, etc.
Tomcat uses the following environment variables (or system properties) to specify two directory locations:
CATALINA_HOME (catalina.home), tomcat installation directory and
CATALINA_BASE (catalina.base), base directory for tomcat instance
Some tomcat installations use the same directory for catalina .base and catalina.home and that's the default behavior if CATALINA_BASE
not set.
Given the Tomcat7 Ubuntu 14.04 configuration:
catalina.home = / usr / share / tomcat7
catalina.base = / var / Library / tomcat7
You should deploy applications to /var/lib/tomcat7/webapps
. The only time apps need to be deployed to $CATALINA_HOME/webapps
is if catalina.base=catalina.home.
installing tomcat7 on my Ubuntu 14.04 didn't even create / usr / share / tocmat 7 / webapps.
The reason I found your post is because I recently installed tomcat7 and ran into the same "Directory problem" warnings you receive:
WARNING : problem with directory [/ usr / share / tomcat7 / common / classes] exists: [false], isDirectory: [false], canRead: [false]
The warning is the result common.loader
, server.loader
and shared.loader
c $CATALINA_BASE/conf/catalina.properties.
. As it should be, shared, server and shared directories are under $CATALINA_BASE
.
I have eliminated the warnings by changing each one *.loader= entry
to use catalina.base
and not catalina.home
for these directories (6 locations).
source to share
I think there is a better answer.
As stated here: https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1308284 and here: https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1232258 . here is the best way to solve this problem (works in more scenarios, especially when you are using tomcat7-user package)
cd /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
and maybe not needed:
sudo ln -s /var/lib/tomcat7/conf/ conf
sudo ln -s /var/lib/tomcat7/logs/ logs
sudo mkdir /usr/share/tomcat7/temp
source to share