linda1890 / jforum2

Automatically exported from code.google.com/p/jforum2
Other
0 stars 0 forks source link

ContextListener doesn't find log4j.xml when deployed as WAR file #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the product are you using? On what operating system?
2.3.3 on Tomcat 6, Java 6.

Please provide any additional information below.

Lines 73-74 of ContextListener.java use ServletContext.getRealPath() to get the 
location of log4j.xml:

final String appPath = application.getRealPath("");
DOMConfigurator.configure(appPath + "/WEB-INF/log4j.xml");

But this doesn't work if JForum is being served from a WAR file -- in this 
case, getRealPath() returns null (see its javadoc), and deployment dies with a 
FileNotFoundException. 

It starts fine if I deploy from the unpacked WAR file.

Original issue reported on code.google.com by max.b...@gmail.com on 23 Jan 2012 at 5:26

GoogleCodeExporter commented 9 years ago
This also causes problems for loading the config files, and now that I think of 
it, perhaps serving from a packed WAR file is not meant to be a supported 
deployment. If so, it would be nice to mention this more prominently 
(especially since the binary distribution is a packed WAR).

Original comment by max.b...@gmail.com on 23 Jan 2012 at 5:50

GoogleCodeExporter commented 9 years ago
JForum should be deployed to Tomcat with this setting in server.xml:
unpackWARs="true"

Original comment by andow...@gmail.com on 7 Jun 2012 at 2:38