Mailing List svn-list@magnolia.info Message #6956
From: svn@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
Date: Wed, 16 Jul 2008 15:58:54 +0200 (CEST)
To: svn-list@magnolia.info

[16847] an helpful log (better than a NPE) that will show up if somebody will try to run magnolia from an unexpanded webapp ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; } #logmsg pre { background: #eee; padding: 1em; } #logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;} #logmsg dl { margin: 0; } #logmsg dt { font-weight: bold; } #logmsg dd { margin: 0; padding: 0 0 0.5em 0; } #logmsg dd:before { content:'\00bb';} #logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; } #logmsg table th.Corner { text-align: left; } #logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} -->
Revision
16847
Author
fgiust
Date
2008-07-16 15:58:54 +0200 (Wed, 16 Jul 2008)

Log Message

an helpful log (better than a NPE) that will show up if somebody will try to run magnolia from an unexpanded webapp

Modified Paths

Diff

Modified: magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/servlets/MgnlServletContextListener.java (16846 => 16847)


--- 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 = StringUtils.replace(context.getRealPath(StringUtils.EMPTY), "\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
         realPath = StringUtils.removeEnd(realPath, "/");
         if (realPath == null) {
+
+            // don't use new java.io.File("x").getParentFile().getAbsolutePath(), will throw a NPE for unexpanded war
+
             // not great but better then npe that would come out otherwise
-            throw new RuntimeException("Failed to initialize magnolia configuration. Error details: [ctx real path:" + context.getRealPath(StringUtils.EMPTY) + ", real dir:" + new java.io.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(SystemProperty.MAGNOLIA_APP_ROOTDIR, realPath);
         return realPath;
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster