Search code examples
eclipsetomcatloggingtomcat8tomcat-juli

Tomcat 8 won't start


I've been searching quite a bit, but can't find the answer. I just upgraded STS (from 3.2) so I could try out Tomcat 8 (from 7.0.53). I've got STS 3.6.2 and Tomcat 8.0.15. After adding the TC8 server and configuring it it refuses to start, with this root error:

java.lang.ClassNotFoundException: org.apache.juli.WebappProperties

So I read up quite a bit and found this guide to switching from hard-coded commons-logging via Juli to Log4J and followed it to the letter without any luck. A relevant excerpt:

The internal logging for Apache Tomcat uses JULI, a packaged renamed fork of Apache Commons Logging that, by default, is hard-coded to use the java.util.logging framework. This ensures that Tomcat's internal logging and any web application logging will remain independent, even if a web application uses Apache Commons Logging.

To configure Tomcat to use an alternative logging framework for its internal logging, one has to replace the JULI impementation that is hard-coded to use java.util.logging with a JULI implementation that retains the full Commons Logging discovery mechanism. Such an implementation is provided as an extras component. Instructions on how to configure Tomcat to use Log4j framework for its internal logging may be found below.

I also found this answer (to a different question) and this question from here, where the latter appears to have a nearly identical problem without any solution.

I've searched all JARs in my Tomcat's bin/lib folders and found no such class (including various versions of tomcat-juli.jar and tomcat-juli-adapters.jar). I find barely any reference on the internet to this class/interface except on the Tomcat 8 Logging guide linked earlier. So, the question is: Why is Tomcat looking for this class?

Again from the linked guide, here's what it says:

If using a class loader that implements the org.apache.juli.WebappProperties interface (Tomcat's web application class loader does) then property replacement is also performed for ${classloader.webappName}, ${classloader.hostName} and ${classloader.serviceName} which are replaced with the web application name, the host name and the service name respectively.

Why is my Tomcat class loader not actually implementing that then, or why isn't it finding it?


Solution

  • Our Ant Tomcat configuration process copied Tomcat 7's tomcat-juli.jar over to Tomcat 8, causing the issue.

    Getting the correct tomcat-juli.jar for Tomcat 8 from Apache's Tomcat Extras section fixed the issue.