You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by mclovis <mc...@elucidar.com> on 2008/08/04 15:51:29 UTC

Roller as unPacked war

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. 

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


RE: Roller as unPacked war

Posted by mclovis <mc...@elucidar.com>.
Nathan,
  Yes sorry I should have been clearer. That is why I changed the code to
check for a null instance. I also changed the roller-custom.properties to
have a base.dir property outside of the war for uploads, themes, etc and the
log4j.properties file to
log4j.appender.roller-startup.File=${catalina.base}/logs/roller-startup.log.
This is an inelegant solution. Perhaps an interface that is looking for the
startup properties as either jndi ,context , jvm, or system properties with
WHERE they are found. The original intent of my post was to find if any
other users had ran into the same issue.

Mike

Nathan Beyer (Cerner) wrote:
> 
> Oh, you mean that you have a PACKED WAR, such that it is not extracted.
> Yep, that would probably blow up because 'getRealPath' is almost
> guaranteed to return null in such a case.
> 
> -Nathan
> 
> -----Original Message-----
> From: mclovis [mailto:mclovis@elucidar.com] 
> Sent: Monday, August 04, 2008 12:50 PM
> To: user@roller.apache.org
> Subject: RE: Roller as unPacked war
> 
> 
> Dave and Nathan,
>   I think I am not making myself clear. Under Tomcat's Host container the
> attribute unPackWars is equal to false. This is the manner my ISP mandates
> wars be deployed. 
> At this point roller will not deploy properly or so it seems. Does this
> now
> make sense?
> 
> 
> 
> Nathan Beyer (Cerner) wrote:
>> 
>> I run roller unpacked via an Eclipse project using WST and deployed to
>> Tomcat all the time.
>> 
>> -----Original Message-----
>> From: mclovis [mailto:mclovis@elucidar.com] 
>> Sent: Monday, August 04, 2008 11:17 AM
>> To: user@roller.apache.org
>> Subject: RE: Roller as unPacked war
>> 
>> 
>> Nathan,
>>   This is in org.apache.roller.weblogger.ui.core 
>>  RollerContext
>> 
>> That was my original point. 
>> if you change the code to check for a null reference (because this class
>> is
>> seemingly trying to anticipate roller properties), it then does not bomb
>> and
>> you can use the roller-custom.properties to set values OUTSIDE of the
>> war.
>> However Dave has noted that he has ran roller as an UNPACKED war with no
>> code changes and no difficulties. So I am a little baffled. I am not a
>> developer on roller and therefore am not familiar with all the code base. 
>> 
>> 
>> 
>> Nathan Beyer (Cerner) wrote:
>>> 
>>> 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:mclovis@elucidar.com] 
>>> Sent: Monday, August 04, 2008 10:40 AM
>>> To: user@roller.apache.org
>>> 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 <mc...@elucidar.com> 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.
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Roller-as-unPacked-war-tp18811688s12275p18814476.html
>> Sent from the Roller - User mailing list archive at Nabble.com.
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Roller-as-unPacked-war-tp18811688s12275p18816214.html
> Sent from the Roller - User mailing list archive at Nabble.com.
> 
> 
> 

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


RE: Roller as unPacked war

Posted by "Beyer,Nathan" <NB...@CERNER.COM>.
Oh, you mean that you have a PACKED WAR, such that it is not extracted. Yep, that would probably blow up because 'getRealPath' is almost guaranteed to return null in such a case.

-Nathan

-----Original Message-----
From: mclovis [mailto:mclovis@elucidar.com] 
Sent: Monday, August 04, 2008 12:50 PM
To: user@roller.apache.org
Subject: RE: Roller as unPacked war


Dave and Nathan,
  I think I am not making myself clear. Under Tomcat's Host container the
attribute unPackWars is equal to false. This is the manner my ISP mandates
wars be deployed. 
At this point roller will not deploy properly or so it seems. Does this now
make sense?



Nathan Beyer (Cerner) wrote:
> 
> I run roller unpacked via an Eclipse project using WST and deployed to
> Tomcat all the time.
> 
> -----Original Message-----
> From: mclovis [mailto:mclovis@elucidar.com] 
> Sent: Monday, August 04, 2008 11:17 AM
> To: user@roller.apache.org
> Subject: RE: Roller as unPacked war
> 
> 
> Nathan,
>   This is in org.apache.roller.weblogger.ui.core 
>  RollerContext
> 
> That was my original point. 
> if you change the code to check for a null reference (because this class
> is
> seemingly trying to anticipate roller properties), it then does not bomb
> and
> you can use the roller-custom.properties to set values OUTSIDE of the war.
> However Dave has noted that he has ran roller as an UNPACKED war with no
> code changes and no difficulties. So I am a little baffled. I am not a
> developer on roller and therefore am not familiar with all the code base. 
> 
> 
> 
> Nathan Beyer (Cerner) wrote:
>> 
>> 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:mclovis@elucidar.com] 
>> Sent: Monday, August 04, 2008 10:40 AM
>> To: user@roller.apache.org
>> 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 <mc...@elucidar.com> 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.
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Roller-as-unPacked-war-tp18811688s12275p18814476.html
> Sent from the Roller - User mailing list archive at Nabble.com.
> 
> 
> 

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


RE: Roller as unPacked war

Posted by mclovis <mc...@elucidar.com>.
Dave and Nathan,
  I think I am not making myself clear. Under Tomcat's Host container the
attribute unPackWars is equal to false. This is the manner my ISP mandates
wars be deployed. 
At this point roller will not deploy properly or so it seems. Does this now
make sense?



Nathan Beyer (Cerner) wrote:
> 
> I run roller unpacked via an Eclipse project using WST and deployed to
> Tomcat all the time.
> 
> -----Original Message-----
> From: mclovis [mailto:mclovis@elucidar.com] 
> Sent: Monday, August 04, 2008 11:17 AM
> To: user@roller.apache.org
> Subject: RE: Roller as unPacked war
> 
> 
> Nathan,
>   This is in org.apache.roller.weblogger.ui.core 
>  RollerContext
> 
> That was my original point. 
> if you change the code to check for a null reference (because this class
> is
> seemingly trying to anticipate roller properties), it then does not bomb
> and
> you can use the roller-custom.properties to set values OUTSIDE of the war.
> However Dave has noted that he has ran roller as an UNPACKED war with no
> code changes and no difficulties. So I am a little baffled. I am not a
> developer on roller and therefore am not familiar with all the code base. 
> 
> 
> 
> Nathan Beyer (Cerner) wrote:
>> 
>> 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:mclovis@elucidar.com] 
>> Sent: Monday, August 04, 2008 10:40 AM
>> To: user@roller.apache.org
>> 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 <mc...@elucidar.com> 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.
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Roller-as-unPacked-war-tp18811688s12275p18814476.html
> Sent from the Roller - User mailing list archive at Nabble.com.
> 
> 
> 

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


RE: Roller as unPacked war

Posted by "Beyer,Nathan" <NB...@CERNER.COM>.
I run roller unpacked via an Eclipse project using WST and deployed to Tomcat all the time.

-----Original Message-----
From: mclovis [mailto:mclovis@elucidar.com] 
Sent: Monday, August 04, 2008 11:17 AM
To: user@roller.apache.org
Subject: RE: Roller as unPacked war


Nathan,
  This is in org.apache.roller.weblogger.ui.core 
 RollerContext

That was my original point. 
if you change the code to check for a null reference (because this class is
seemingly trying to anticipate roller properties), it then does not bomb and
you can use the roller-custom.properties to set values OUTSIDE of the war.
However Dave has noted that he has ran roller as an UNPACKED war with no
code changes and no difficulties. So I am a little baffled. I am not a
developer on roller and therefore am not familiar with all the code base. 



Nathan Beyer (Cerner) wrote:
> 
> 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:mclovis@elucidar.com] 
> Sent: Monday, August 04, 2008 10:40 AM
> To: user@roller.apache.org
> 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 <mc...@elucidar.com> 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.
> 
> 

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


RE: Roller as unPacked war

Posted by mclovis <mc...@elucidar.com>.
Nathan,
  This is in org.apache.roller.weblogger.ui.core 
 RollerContext

That was my original point. 
if you change the code to check for a null reference (because this class is
seemingly trying to anticipate roller properties), it then does not bomb and
you can use the roller-custom.properties to set values OUTSIDE of the war.
However Dave has noted that he has ran roller as an UNPACKED war with no
code changes and no difficulties. So I am a little baffled. I am not a
developer on roller and therefore am not familiar with all the code base. 



Nathan Beyer (Cerner) wrote:
> 
> 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:mclovis@elucidar.com] 
> Sent: Monday, August 04, 2008 10:40 AM
> To: user@roller.apache.org
> 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 <mc...@elucidar.com> 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.
> 
> 

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


RE: Roller as unPacked war

Posted by "Beyer,Nathan" <NB...@CERNER.COM>.
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:mclovis@elucidar.com] 
Sent: Monday, August 04, 2008 10:40 AM
To: user@roller.apache.org
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 <mc...@elucidar.com> 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.

Re: Roller as unPacked war

Posted by mclovis <mc...@elucidar.com>.
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 <mc...@elucidar.com> 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.


Re: Roller as unPacked war

Posted by Dave <sn...@gmail.com>.
On Mon, Aug 4, 2008 at 9:51 AM, mclovis <mc...@elucidar.com> 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