Wednesday, May 8, 2013

Weblogic and Spring Log4jConfigListener [java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded]

If you are using Weblogic and Spring's Log4JConfigListener you might encounter a problem when in your testing envrionment when you deploy from your IDE to your Weblogic instance it seems ok.

But when you package it into a war file and deploy it. You get an
[java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded].

This is due to the Log4JConfigListener  requiring to look up the log4j.properties file and from a war file it can't do that.

You can either always deploy it in a exploded war file or simply adding the following to your weblogic.xml file.


         true



This should solve the problem.