6

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

rmuller
  • 175
  • 1
  • 8
  • Just eyeballing it, my `ps` line looks the same, except for the JVM; and the `-Xmx`/`-XX`, which also come later; and I've enabled security. What are your package versions, BTW? – Mike Jan 11 '15 at 20:51
  • Debian 3.2.63-2+deb7u2 x86_64; Tomcat: 8.0.14-1~bpo70+1, Oracle jdk (manual install) 1.8.0_25-b17 – rmuller Jan 12 '15 at 09:03

3 Answers3

4

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.

  • Thanks! We are using Debian (5, 6 and 7) + Tomcat (5.5, 6) for a long time, never had problems. That is why we upgraded to Debian 7 + Tomcat 8. However, this time the experience is completely different :( I do not see how this issue relates to the "that the java community and the linux community created a lot ...". I know that I can create the directories by hand, but I want to resolve the **real problem** :) Also note the (strange) logging problem. – rmuller Jan 11 '15 at 13:43
  • I created the directories manually as you suggested and the warnings disappeared. However, there MUST be something wrong here because adding those directories after installation is a bit weird. – rmuller Jan 13 '15 at 19:49
  • @rmuller This time I consider this is a debian bug. The debian standards are uncommonly rigorous linux customs, thus they are especially hard to integrate with java. On my opinion, debian was never good in java, despite they put big efforts into them. It is a clash of worlds. –  Jan 14 '15 at 08:57
1

I have tomcat8 running onopenjdk-8-jdk in a Jessie LXC, and I get the same WARNINGs to no ill effect. I don't get the SEVERE. But my ps line reads ...-Dcatalina.base=/var/lib/tomcat8 -Dcatalina.home=/usr/share/tomcat8 -Djava.io.tmpdir=/tmp/tomcat8-tomcat8-tmp....

Mike
  • 247
  • 1
  • 7
  • And, BTW, I don't set `JAVA_HOME` in `/etc/default/tomcat8`. But I only have the one version installed. – Mike Jan 11 '15 at 01:04
  • Thanks Mike. See my updated question. Have the same `ps` output! Which makes the behaviour even stranger. In my case, despite all warnings and severe message, the webapp just works!? – rmuller Jan 11 '15 at 13:19
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.

Mike
  • 247
  • 1
  • 7
  • You are right, running `configtest` only makes it more unclear. But the "Problem with directory" and logging problem remains. I just checked. So upvoted your answer, but is not "the" answer. – rmuller Jan 13 '15 at 19:46
  • Added to my answer. What's up with the logging? You never really said. (What are you changing? What are you expecting?) – Mike Jan 14 '15 at 02:13
  • see third bullet under "Clearly some issues" for problem with logging (which still remains) – rmuller Jan 15 '15 at 08:31
  • Yeah, I saw that before my last comment. My questions were in the context of having read that. – Mike Jan 15 '15 at 18:19