Log4jConfigListener cannot be found -- context fails to start

The org.springframework.web.util.Log4jConfigListener class is definitely not in your classpath.

The first thing I would suggest is that you turn up the logging level in Tomcat -- in the conf folder -- to "ALL" or "DEBUG" so that you can see exactly what is going on in the container that is preventing this class from being found.

Second, I'd recommend you check your JAR files for the missing class file by running grep, if on linux/mac:

  # run at the root of your lib folders:
  grep -ri "org.springframework.web.util.Log4jConfigListener" *

The above command will return all JAR files that contain that package. Once the JAR file is isolated, then you can further troubleshoot.

Third, make sure you don't have any conflicts. Multiple versions of Log4j being in your classpath will wreak havoc. How is the system supposed to know which org.springframework.web.util.Log4jConfigListener package to load if there are 2 of them? Tomcat has 3 different classpath folders:

 shared/lib
 lib
 webapps/yourapp/WEB-INF/lib

Make sure you have only one log4j JAR file in only one of these folders.


Reticulogic's second suggestion is correct. However, in Eclipse Helios, the "Java EE Module Dependencies" option has been removed. The fix for Helios is as follows:

  1. Right click on your project in Eclipse and go to Properties-->Deployment Assembly
  2. Click "Add..."
  3. Select "Java Build Path Entries" and click "Next"
  4. select "Maven Dependencies" and click "Finish"