Supporting Open Source Software for Education
OverviewI saw on the rice mailinglist recently someone posted a question where essentially, the application dies before a logger can be initialized. Here is the result: INFO: Deploying web application archive kr-dev.warlog4j:WARN No appenders could be found for logger (org.kuali.rice.core.web.listener.KualiInitializeListener).log4j:WARN Please initialize the log4j system properly.log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.Dec 1, 2011 1:35:19 PM org.apache.catalina.core.StandardContext startSEVERE: Error listenerStartDec 1, 2011 1:35:19 PM org.apache.catalina.core.StandardContext startSEVERE: Context [/kr-dev] startup failed due to previous errorsWhat has happened here is the listener failed to start. The listener is what starts up the application (in this case, Rice). If Rice does not start, there is no logger to tell you what is wrong. Thus, you get no error. Usually, what causes this is a dependency is not included in tomcat. So far, I have not seen a case where the problem is caused by anything but a missing library. It is usually the database driver, because that is the only thing not included in the rice war by default. It can possibly be something else though. I have seen KFS not start because of a missing log4j file. Since KFS actually requires the application to deploy additional libraries to the application server before startup, it is the only exceptional case.SolutionOf course, the solution is to make sure your database driver is in the tomcat/lib folder, right? What if that doesn't do the job? What if it's another library? Read on.AlternateSometimes you need to figure out what library is missing. This is almost never the case. Nearly always it is the database driver that is missing. Almost, right? If this happens and the database driver is loading correctly, then you need to figure out what the problem is. This means consulting the tomcat logger. I am going to assume that you have installed the rice war file in your tomcat installation. The war file is now unpacked and there's a webapp directory somewhere. Within the WEB-INF/classes path of that webapp directory, you can create a logging.properties with the following contents.org.apache.catalina.core.ContainerBase.[Catalina].level = INFOorg.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandlerWhy? The reason is that rice uses commons-logging and log4j while tomcat uses java.util.logging. Essentially, separate things. Also, since Kuali did not start, it did not start the logging configuration. What we can do is add a logging configuration that tomcat will pick up and use when it tries to start Rice. That is essentially what we are doing here. Now try to restart the server. You should see some kind of NoClassDefFoundError somewhere explaining what library you are missing.