Return-Path: <_www@dev.magnolia.info> Received: from dev.magnolia.info ([213.173.174.20] verified) by mail.obinary.com (CommuniGate Pro SMTP 5.1.10) with ESMTP id 14524683 for svn-list@magnolia.info; Wed, 16 Jul 2008 15:58:55 +0200 Received: by dev.magnolia.info (Postfix, from userid 70) id E694268B102; Wed, 16 Jul 2008 15:58:54 +0200 (CEST) MIME-Version: 1.0 X-Mailer: SVN::Notify 2.70: http://search.cpan.org/dist/SVN-Notify/ From: svn@magnolia.info Errors-To: svn@magnolia.info To: svn-list@magnolia.info Subject: [16847] an helpful log (better than a NPE) that will show up if somebody will try to run magnolia from an unexpanded webapp Reply-To: dev-list@magnolia.info Content-Type: text/html; charset=UTF-8 Message-Id: <20080716135854.E694268B102@dev.magnolia.info> Date: Wed, 16 Jul 2008 15:58:54 +0200 (CEST) Content-Transfer-Encoding: quoted-printable
an helpful log (better than a NPE) that will show up if somebody wil= l try to run magnolia from an unexpanded webapp
--- magnolia/trunk/magnolia-core/src/main/java/info/=
magnolia/cms/servlets/MgnlServletContextListener.java 2008-07-16 10:15:25=
UTC (rev 16846)
+++ magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/servlets=
/MgnlServletContextListener.java 2008-07-16 13:58:54 UTC (rev 16847)
@@ -208,8 +208,14 @@
String realPath =3D StringUtils.replac=
e(context.getRealPath(StringUtils.EMPTY), "\\", "/");=
//$NON-NLS-1$ //$NON-NLS-2$
realPath =3D StringUtils.removeEnd(rea=
lPath, "/");
if (realPath =3D=3D null) {
+
+ // don't use new java.io.File("x").getParentFile()=
.getAbsolutePath(), will throw a NPE for unexpanded war
+
// not great but better then npe th=
at would come out otherwise
- throw new RuntimeException("Failed to initi=
alize magnolia configuration. Error details: [ctx real path:" + cont=
ext.getRealPath(StringUtils.EMPTY) + ", real dir:" + new java.i=
o.File("x").getParentFile().getAbsolutePath() + " ]")=
;
+ throw new RuntimeException(
+ "Failed to initialize magnolia configuration. Error=
details: [ctx real path:"
+ + context.getRealPath(StringUtils.EMPTY)
+ + "]. Magnolia needs to be run from an expanded=
webapp, please check your server configuration (maybe unpackWARs is set =
to false?).");
}
SystemProperty.setProperty(SystemPrope=
rty.MAGNOLIA_APP_ROOTDIR, realPath);
return realPath;