Where is this at in the codebase? Without knowing much of the context, that's 
not the best way to determine the 'context path', as it is possible for null be 
returned, though according to the javadoc, that generally only happens when the 
WAR isn't unpacked [1]. If you want the 'context path', generally you use 
'getContextPath' [2], but I don't know exactly what this code is attempting to 
do. As I understand 'getRealPath', the intent is to get a 
OS-specific/filesystem-specific path to a resource, which is why the code below 
uses 'File.separator'. For example, you might pass "WEB-INF/web.xml" and it 
would return "/opt/tomcat/webapps/myapp/WEB-INF/web.xml" on a linux deploy.

-Nathan

[1] 
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String)
[2] 
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getContextPath()


-----Original Message-----
From: mclovis [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 04, 2008 10:40 AM
To: [email protected]
Subject: Re: Roller as unPacked war


Dave,
  RollerContext without being modified looks like the following


        
        // get the *real* path to <context>/resources
        String ctxPath= servletContext.getRealPath("/");
        //log.info(ctxPath);
        if(!ctxPath.endsWith(File.separator))
            ctxPath += File.separator + "resources";
        else
            ctxPath += "resources";

And ctxPath in an unPacked War returns null and the String test .endsWith
results in an NullPointerException. This can be found in catalina.out when
ran with Tomcat. It will not run properly for me then. Am I missing
something?





Dave Johnson-8 wrote:
> 
> On Mon, Aug 4, 2008 at 9:51 AM, mclovis <[EMAIL PROTECTED]> wrote:
>>
>> Does anyone know has any thought been given to running roller as an
>> unPacked
>> war. If you changed the code in RollerContext as follows:
>>
>>  String ctxPath ="";
>>
>>        // get the *real* path to <context>/resources
>>        ctxPath= servletContext.getRealPath("/");
>>
>> It will allow it to run until other issues arise.
>>
>> I need to see if this option has been explored before.
> 
> I'm able to run Roller as a WAR or as an unpacked WAR without any code
> changes.
> 
> Perhaps you are running into some other problem?
> 
> - Dave
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Roller-as-unPacked-war-tp18811688s12275p18813719.html
Sent from the Roller - User mailing list archive at Nabble.com.

----------------------------------------------------------------------
CONFIDENTIALITY NOTICE This message and any included attachments are from 
Cerner Corporation and are intended only for the addressee. The information 
contained in this message is confidential and may constitute inside or 
non-public information under international, federal, or state securities laws. 
Unauthorized forwarding, printing, copying, distribution, or use of such 
information is strictly prohibited and may be unlawful. If you are not the 
addressee, please promptly delete this message and notify the sender of the 
delivery error by e-mail or you may call Cerner's corporate offices in Kansas 
City, Missouri, U.S.A at (+1) (816)221-1024.

Reply via email to