tomcat8 from wheezy-backports fails with configtest.sh

I have installed tomcat8 package from wheezy-backports. I use the default / unmodified installation with the following expections:

  • I use Oracle Java 8 JDK
  • in /etc/default/tomcat8 is added: JAVA_HOME=/usr/lib/jvm/java-8-oracle

I can start/stop tomcat. However a lot of warnings are displayed. Checked with /usr/share/tomcat8/bin/configtest.sh, the output is:

  Using CATALINA_BASE:   /usr/share/tomcat8
  Using CATALINA_HOME:   /usr/share/tomcat8
  Using CATALINA_TMPDIR: /usr/share/tomcat8/temp
  Using JRE_HOME:        /usr
  Using CLASSPATH:       /usr/share/tomcat8/bin/bootstrap.jar:/usr/share/tomcat8/bin/tomcat-juli.jar
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat8/common/classes], exists: [false], isDirectory: [false], canRead: [false]
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat8/common], exists: [false], isDirectory: [false], canRead: [false]
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat8/server/classes], exists: [false], isDirectory: [false], canRead: [false]
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat8/server], exists: [false], isDirectory: [false], canRead: [false]
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat8/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
  WARNING: Problem with directory [/usr/share/tomcat8/shared], exists: [false], isDirectory: [false], canRead: [false]
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.Catalina initDirs
  SEVERE: Cannot find specified temporary folder at /usr/share/tomcat8/temp
  Jan 10, 2015 4:55:40 PM org.apache.catalina.startup.Catalina load

Clearly some issues :)

  • JRE_HOME should be set to JAVA_HOME, but is not
  • missing directories
  • (not clear from this example) logging is not working correctly (changes in /etc/tomcat8/logging.properties have no effect. But the settings are correct (see ps output) and /var/lib/tomcat8/conf -> /etc/tomcat8

What is wrong here?

UPDATE

Output of ps (edited for readability), which looks good imo:

  $ ps aux | grep java
  tomcat8  15654  0.1  3.6 2643416 147024 ?      Sl   Jan10   1:42 /usr/lib/jvm/java-8-oracle/bin/java \
  -Xmx1024m -XX:+UseConcMarkSweepGC \
  -Djava.util.logging.config.file=/var/lib/tomcat8/conf/logging.properties \
  -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
  -Djava.awt.headless=true \
  -Djava.endorsed.dirs=/usr/share/tomcat8/endorsed \
  -classpath /usr/share/tomcat8/bin/bootstrap.jar:/usr/share/tomcat8/bin/tomcat-juli.jar \
  -Dcatalina.base=/var/lib/tomcat8 \
  -Dcatalina.home=/usr/share/tomcat8 \
  -Djava.io.tmpdir=/tmp/tomcat8-tomcat8-tmp 
  org.apache.catalina.startup.Bootstrap start

UPDATE 2

Tomcat 8 on Ubuntu has similar problems, see http://java.dzone.com/articles/vaadin-docker-a-novices-journey


Solution 1:

It occurred to me that you see this only when you run configtest.sh, and there's an obvious reason: CATALINA_BASE et al. only get set in /etc/init.d/tomcat8. When I run configtest.sh as you did, I get the same output.

If you want to run configtest the same way as the daemon, you'd probably want to hack /etc/init.d/tomcat8 to accept that argument. For some reason the package maintainers haven't gone to that trouble. It also looks like you may be able to set the environment variables manually before running configtest.sh; I think catalina.sh will pick them up.


The WARNING: Problem with directory lines come from the classloader paths set in /etc/tomcat8/catalina.properties. This is probably just some old cruft left by the Debian maintainer...so as not to disrupt old configurations? It's not all present in the current upstream, and it has been discussed before.

Solution 2:

This a long saga. The main problem, that the java community and the linux community created a lot of quasi-standards, practices and conventions, and these are somehow contradicting eachother in every viewpoint.

You can integrate java and linux easily, but you must learn both of them, and you will have to break many of them on both sides. If you know only one (either the java or the linux world) you will find yourself in a clear world where you must make yourself always dirty.

Your current problem is this time not an environment variable problem, but a simple "directory not existing" trouble. The simplest way to avoid this warning if you simply create the missing /usr/share/tomcat8/shared/classes directory by hand (despite it contradicts a little bit to the linux customs).

This directory is a needed path to the standard tomcat jvm classloader, and very probably it won't hurt anything if it remains empty.

Maybe you could check in a Contents-amd64.gz is this directory isn't created by another package. If yes, install that package.