You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Nicolai Willems <ni...@gmail.com> on 2011/02/12 21:44:07 UTC

Problems deploying to a servlet container

Hello

When deploying to tomcat 6 under Ubuntu, sling wont start up.
In the logs it tells me that it is unable to create the directory
"sling/_todoer" - inspecting the path, I found that sling is trying to
create a directory directly under my tomcat root "var/lib/tomcat6". This
seems like undesirable behavior.

Is there some configuration I missed, that could point sling to create such
things in f.ex. "/var/lib/sling/" or alike?

Thanks in advance
/Nicolai

Re: Problems deploying to a servlet container

Posted by Nicolai Willems <ni...@gmail.com>.
On Sat, Feb 12, 2011 at 10:22 PM, Justin Edelson
<ju...@gmail.com> wrote:
>
> On 2/12/11 4:16 PM, Nicolai Willems wrote:
> >
> >
> > On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson
> > <justinedelson@gmail.com <ma...@gmail.com>> wrote:
> >
> >     You have a few options:
> >     1) Set a system property sling.home.prefix to /var/lib/sling - this will
> >     make sling home /var/lib/sling/_<context path> (e.g.
> >     /var/lib/sling/_todoer)
> >
> >
> > For future reference - this would on a linux box be "export
> > sling.home=your/fancy/path" right?
> > I am on my way to editing to "installing to servlet container" wiki
> > entry - so this would be nice info.
> No. export is an environment variable. A system property is usually set
> by passing -D<name>=<value> to the JVM. How you do this on a particular
> servlet container is container-specific, but there usually is an
> environment variable you can set. Something like this:
>
> export JAVA_ARGS="-Dsling.home=/your/fancy/path"
>
> Google "set system property <container name>" for specific instructions.
>
> I know "your/fancy/path" isn't meant to be serious, but worth noting: if
> you put a relative path here, it will be relative from the container's
> home directory which is exactly what you are trying to avoid IIUC.

Ahh, my bad - I meant it to be absolute. But I'll note that when
updating the page.
Something like, "If setting this property should be effective you
should use an absolute path"

>
> >
> >
> >     2) Edit the WAR file and set either a servlet init param or a context
> >     param called sling.home. The value of this parameter will be used
> >     directly, i.e. not have the context path appended to it.
> >
> >
> > I used sort of this approach, I changed the init-param for the servlet
> > in web.xml. Now running nice and smooth.
> Just be sure if you happen to run multiple Sling webapps in the one
> container that you have a different parameter value for each webapp.
> This is an edge case, but is the point of having the context path part
> of the path when you use either the default or the system property
> technique (as system properties are obviously shared across all webapps
> in a single JVM).

Would using a path like /var/lib/sling/${context.path} resolve the above issue?
So in the tomcat example you would do "export
JAVA_OPTS=/var/lib/sling/${context.path}".

>
> >
> > Again - thanks for the quick reply. This mailing list is so good!
>
> We try :)
>
> Justin
> >
> >
> >     Regardless of the method, you should see a log message in the servlet
> >     container's log like this:
> >     Setting sling.home=<sling home> (<source>)
> >
> >     where <source> should tell you how <sling home> was set.
> >
> >     HTH,
> >     Justin
> >
> >     On 2/12/11 3:44 PM, Nicolai Willems wrote:
> >     > Hello
> >     >
> >     > When deploying to tomcat 6 under Ubuntu, sling wont start up.
> >     > In the logs it tells me that it is unable to create the directory
> >     > "sling/_todoer" - inspecting the path, I found that sling is trying to
> >     > create a directory directly under my tomcat root
> >     "var/lib/tomcat6". This
> >     > seems like undesirable behavior.
> >     >
> >     > Is there some configuration I missed, that could point sling to
> >     create such
> >     > things in f.ex. "/var/lib/sling/" or alike?
> >     >
> >     > Thanks in advance
> >     > /Nicolai
> >     >
> >
> >
>

Re: Problems deploying to a servlet container

Posted by Nicolai Willems <ni...@gmail.com>.
On Sun, Feb 13, 2011 at 12:11 AM, Justin Edelson
<ju...@justinedelson.com> wrote:
>
>
> On Feb 12, 2011, at 5:06 PM, Nicolai Willems <ni...@gmail.com> wrote:
>
>>
>>
>> On Sat, Feb 12, 2011 at 10:22 PM, Justin Edelson <ju...@gmail.com> wrote:
>> On 2/12/11 4:16 PM, Nicolai Willems wrote:
>> >
>> >
>> > On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson
>> > <justinedelson@gmail.com <ma...@gmail.com>> wrote:
>> >
>> >     You have a few options:
>> >     1) Set a system property sling.home.prefix to /var/lib/sling - this will
>> >     make sling home /var/lib/sling/_<context path> (e.g.
>> >     /var/lib/sling/_todoer)
>> >
>> >
>> > For future reference - this would on a linux box be "export
>> > sling.home=your/fancy/path" right?
>> > I am on my way to editing to "installing to servlet container" wiki
>> > entry - so this would be nice info.
>> No. export is an environment variable. A system property is usually set
>> by passing -D<name>=<value> to the JVM. How you do this on a particular
>> servlet container is container-specific, but there usually is an
>> environment variable you can set. Something like this:
>>
>> export JAVA_ARGS="-Dsling.home=/your/fancy/path"
>>
>> Google "set system property <container name>" for specific instructions.
>>
>> I know "your/fancy/path" isn't meant to be serious, but worth noting: if
>> you put a relative path here, it will be relative from the container's
>> home directory which is exactly what you are trying to avoid IIUC.
>>
>> Ahh, my bad - I meant it to be absolute. But I'll note that when updating the page.
>> Something like, "If setting this property should be effective you should use an absolute path"
>
> Well, a relative path would still be_effective_ :)
>
>>
>>
>> >
>> >
>> >     2) Edit the WAR file and set either a servlet init param or a context
>> >     param called sling.home. The value of this parameter will be used
>> >     directly, i.e. not have the context path appended to it.
>> >
>> >
>> > I used sort of this approach, I changed the init-param for the servlet
>> > in web.xml. Now running nice and smooth.
>> Just be sure if you happen to run multiple Sling webapps in the one
>> container that you have a different parameter value for each webapp.
>> This is an edge case, but is the point of having the context path part
>> of the path when you use either the default or the system property
>> technique (as system properties are obviously shared across all webapps
>> in a single JVM).
>>
>> Would using a path like /var/lib/sling/${context.path} resolve the above issue?
>> So in the tomcat example you would do "export JAVA_OPTS=/var/lib/sling/${context.path}".
>
> Sling does this for you. If you set the system property sling.home.prefix to /var/lib/sling, the actual sling.home directory will be that prefix _plus_ the context path.
>
> If you set sling.home in web.xml, the context path is not appended.
>
> Note the difference in names: sling.home.prefix vs. sling.home

I keep getting amazed by this piece of software!

>
> Justin
>>
>>
>> >
>> > Again - thanks for the quick reply. This mailing list is so good!
>>
>> We try :)
>>
>> Justin
>> >
>> >
>> >     Regardless of the method, you should see a log message in the servlet
>> >     container's log like this:
>> >     Setting sling.home=<sling home> (<source>)
>> >
>> >     where <source> should tell you how <sling home> was set.
>> >
>> >     HTH,
>> >     Justin
>> >
>> >     On 2/12/11 3:44 PM, Nicolai Willems wrote:
>> >     > Hello
>> >     >
>> >     > When deploying to tomcat 6 under Ubuntu, sling wont start up.
>> >     > In the logs it tells me that it is unable to create the directory
>> >     > "sling/_todoer" - inspecting the path, I found that sling is trying to
>> >     > create a directory directly under my tomcat root
>> >     "var/lib/tomcat6". This
>> >     > seems like undesirable behavior.
>> >     >
>> >     > Is there some configuration I missed, that could point sling to
>> >     create such
>> >     > things in f.ex. "/var/lib/sling/" or alike?
>> >     >
>> >     > Thanks in advance
>> >     > /Nicolai
>> >     >
>> >
>> >
>>
>>
>

Re: Problems deploying to a servlet container

Posted by Nicolai Willems <ni...@gmail.com>.
On Mon, Feb 14, 2011 at 2:45 AM, Justin Edelson
<ju...@justinedelson.com> wrote:
> On Sat, Feb 12, 2011 at 7:25 PM, Nicolai Willems <ni...@gmail.com> wrote:
>> On Sun, Feb 13, 2011 at 12:11 AM, Justin Edelson
>> <ju...@justinedelson.com> wrote:
>>>
>>>
>>> On Feb 12, 2011, at 5:06 PM, Nicolai Willems <ni...@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On Sat, Feb 12, 2011 at 10:22 PM, Justin Edelson <ju...@gmail.com> wrote:
>>>> On 2/12/11 4:16 PM, Nicolai Willems wrote:
>>>> >
>>>> >
>>>> > On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson
>>>> > <justinedelson@gmail.com <ma...@gmail.com>> wrote:
>>>> >
>>>> >     You have a few options:
>>>> >     1) Set a system property sling.home.prefix to /var/lib/sling - this will
>>>> >     make sling home /var/lib/sling/_<context path> (e.g.
>>>> >     /var/lib/sling/_todoer)
>>>> >
>>>> >
>>>> > For future reference - this would on a linux box be "export
>>>> > sling.home=your/fancy/path" right?
>>>> > I am on my way to editing to "installing to servlet container" wiki
>>>> > entry - so this would be nice info.
>>>> No. export is an environment variable. A system property is usually set
>>>> by passing -D<name>=<value> to the JVM. How you do this on a particular
>>>> servlet container is container-specific, but there usually is an
>>>> environment variable you can set. Something like this:
>>>>
>>>> export JAVA_ARGS="-Dsling.home=/your/fancy/path"
>>>>
>>>> Google "set system property <container name>" for specific instructions.
>>>>
>>>> I know "your/fancy/path" isn't meant to be serious, but worth noting: if
>>>> you put a relative path here, it will be relative from the container's
>>>> home directory which is exactly what you are trying to avoid IIUC.
>>>>
>>>> Ahh, my bad - I meant it to be absolute. But I'll note that when updating the page.
>>>> Something like, "If setting this property should be effective you should use an absolute path"
>>>
>>> Well, a relative path would still be_effective_ :)
>>>
>>>>
>>>>
>>>> >
>>>> >
>>>> >     2) Edit the WAR file and set either a servlet init param or a context
>>>> >     param called sling.home. The value of this parameter will be used
>>>> >     directly, i.e. not have the context path appended to it.
>>>> >
>>>> >
>>>> > I used sort of this approach, I changed the init-param for the servlet
>>>> > in web.xml. Now running nice and smooth.
>>>> Just be sure if you happen to run multiple Sling webapps in the one
>>>> container that you have a different parameter value for each webapp.
>>>> This is an edge case, but is the point of having the context path part
>>>> of the path when you use either the default or the system property
>>>> technique (as system properties are obviously shared across all webapps
>>>> in a single JVM).
>>>>
>>>> Would using a path like /var/lib/sling/${context.path} resolve the above issue?
>>>> So in the tomcat example you would do "export JAVA_OPTS=/var/lib/sling/${context.path}".
>>>
>>> Sling does this for you. If you set the system property sling.home.prefix to /var/lib/sling, the actual sling.home directory will be that prefix _plus_ the context path.
>>>
>>> If you set sling.home in web.xml, the context path is not appended.
>>>
>>> Note the difference in names: sling.home.prefix vs. sling.home
>>
>> I'm sorry to report this - but setting JAVA_OPTS as described here:
>> http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q5
>> adding -Dsling.home.prefix=/var/lib/sling/ dosen't do the trick for
>> me. Any suggestions?
>
> What *exactly* are you doing and what specifically is going wrong?

Sorry for not updating this issue.

But I found that it's tomcat/ubuntu that dosen't accept JAVA_OPTS,
I think they would like to have CATALINA_OPTS instead.

So looking at "ps aux | grep tomcat" showed that every time I changed JAVA_OPTS
nothing happened. So now I fiddled with the init-script, and it works
like a charm.

Thanks for your help all the way. Shortly I'll be writing a little
article about it.

>
> I tried this scenario and saw the expected result:
>
> * unpacked Tomcat 6.0.29 and did this:
> export JAVA_OPTS="-Dsling.home.prefix=/var/lib/sling"
> ran /usr/local/apache-tomcat-6.0.29/bin/startup.sh
>
> Then I deployed a recent build of the Sling WAR using context path /slingtomcat
>
> The Tomcat log then showed this:
> Feb 13, 2011 8:41:42 PM org.apache.catalina.core.ApplicationContext log
> INFO: sling: Setting sling.home=/var/lib/sling/_slingtomcat (servlet
> context path)
>
> Which is the expected result.
>
> Justin
>
>>
>>>
>>> Justin
>>>>
>>>>
>>>> >
>>>> > Again - thanks for the quick reply. This mailing list is so good!
>>>>
>>>> We try :)
>>>>
>>>> Justin
>>>> >
>>>> >
>>>> >     Regardless of the method, you should see a log message in the servlet
>>>> >     container's log like this:
>>>> >     Setting sling.home=<sling home> (<source>)
>>>> >
>>>> >     where <source> should tell you how <sling home> was set.
>>>> >
>>>> >     HTH,
>>>> >     Justin
>>>> >
>>>> >     On 2/12/11 3:44 PM, Nicolai Willems wrote:
>>>> >     > Hello
>>>> >     >
>>>> >     > When deploying to tomcat 6 under Ubuntu, sling wont start up.
>>>> >     > In the logs it tells me that it is unable to create the directory
>>>> >     > "sling/_todoer" - inspecting the path, I found that sling is trying to
>>>> >     > create a directory directly under my tomcat root
>>>> >     "var/lib/tomcat6". This
>>>> >     > seems like undesirable behavior.
>>>> >     >
>>>> >     > Is there some configuration I missed, that could point sling to
>>>> >     create such
>>>> >     > things in f.ex. "/var/lib/sling/" or alike?
>>>> >     >
>>>> >     > Thanks in advance
>>>> >     > /Nicolai
>>>> >     >
>>>> >
>>>> >
>>>>
>>>>
>>>
>>
>

Re: Problems deploying to a servlet container

Posted by Justin Edelson <ju...@justinedelson.com>.
On Sat, Feb 12, 2011 at 7:25 PM, Nicolai Willems <ni...@gmail.com> wrote:
> On Sun, Feb 13, 2011 at 12:11 AM, Justin Edelson
> <ju...@justinedelson.com> wrote:
>>
>>
>> On Feb 12, 2011, at 5:06 PM, Nicolai Willems <ni...@gmail.com> wrote:
>>
>>>
>>>
>>> On Sat, Feb 12, 2011 at 10:22 PM, Justin Edelson <ju...@gmail.com> wrote:
>>> On 2/12/11 4:16 PM, Nicolai Willems wrote:
>>> >
>>> >
>>> > On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson
>>> > <justinedelson@gmail.com <ma...@gmail.com>> wrote:
>>> >
>>> >     You have a few options:
>>> >     1) Set a system property sling.home.prefix to /var/lib/sling - this will
>>> >     make sling home /var/lib/sling/_<context path> (e.g.
>>> >     /var/lib/sling/_todoer)
>>> >
>>> >
>>> > For future reference - this would on a linux box be "export
>>> > sling.home=your/fancy/path" right?
>>> > I am on my way to editing to "installing to servlet container" wiki
>>> > entry - so this would be nice info.
>>> No. export is an environment variable. A system property is usually set
>>> by passing -D<name>=<value> to the JVM. How you do this on a particular
>>> servlet container is container-specific, but there usually is an
>>> environment variable you can set. Something like this:
>>>
>>> export JAVA_ARGS="-Dsling.home=/your/fancy/path"
>>>
>>> Google "set system property <container name>" for specific instructions.
>>>
>>> I know "your/fancy/path" isn't meant to be serious, but worth noting: if
>>> you put a relative path here, it will be relative from the container's
>>> home directory which is exactly what you are trying to avoid IIUC.
>>>
>>> Ahh, my bad - I meant it to be absolute. But I'll note that when updating the page.
>>> Something like, "If setting this property should be effective you should use an absolute path"
>>
>> Well, a relative path would still be_effective_ :)
>>
>>>
>>>
>>> >
>>> >
>>> >     2) Edit the WAR file and set either a servlet init param or a context
>>> >     param called sling.home. The value of this parameter will be used
>>> >     directly, i.e. not have the context path appended to it.
>>> >
>>> >
>>> > I used sort of this approach, I changed the init-param for the servlet
>>> > in web.xml. Now running nice and smooth.
>>> Just be sure if you happen to run multiple Sling webapps in the one
>>> container that you have a different parameter value for each webapp.
>>> This is an edge case, but is the point of having the context path part
>>> of the path when you use either the default or the system property
>>> technique (as system properties are obviously shared across all webapps
>>> in a single JVM).
>>>
>>> Would using a path like /var/lib/sling/${context.path} resolve the above issue?
>>> So in the tomcat example you would do "export JAVA_OPTS=/var/lib/sling/${context.path}".
>>
>> Sling does this for you. If you set the system property sling.home.prefix to /var/lib/sling, the actual sling.home directory will be that prefix _plus_ the context path.
>>
>> If you set sling.home in web.xml, the context path is not appended.
>>
>> Note the difference in names: sling.home.prefix vs. sling.home
>
> I'm sorry to report this - but setting JAVA_OPTS as described here:
> http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q5
> adding -Dsling.home.prefix=/var/lib/sling/ dosen't do the trick for
> me. Any suggestions?

What *exactly* are you doing and what specifically is going wrong?

I tried this scenario and saw the expected result:

* unpacked Tomcat 6.0.29 and did this:
export JAVA_OPTS="-Dsling.home.prefix=/var/lib/sling"
ran /usr/local/apache-tomcat-6.0.29/bin/startup.sh

Then I deployed a recent build of the Sling WAR using context path /slingtomcat

The Tomcat log then showed this:
Feb 13, 2011 8:41:42 PM org.apache.catalina.core.ApplicationContext log
INFO: sling: Setting sling.home=/var/lib/sling/_slingtomcat (servlet
context path)

Which is the expected result.

Justin

>
>>
>> Justin
>>>
>>>
>>> >
>>> > Again - thanks for the quick reply. This mailing list is so good!
>>>
>>> We try :)
>>>
>>> Justin
>>> >
>>> >
>>> >     Regardless of the method, you should see a log message in the servlet
>>> >     container's log like this:
>>> >     Setting sling.home=<sling home> (<source>)
>>> >
>>> >     where <source> should tell you how <sling home> was set.
>>> >
>>> >     HTH,
>>> >     Justin
>>> >
>>> >     On 2/12/11 3:44 PM, Nicolai Willems wrote:
>>> >     > Hello
>>> >     >
>>> >     > When deploying to tomcat 6 under Ubuntu, sling wont start up.
>>> >     > In the logs it tells me that it is unable to create the directory
>>> >     > "sling/_todoer" - inspecting the path, I found that sling is trying to
>>> >     > create a directory directly under my tomcat root
>>> >     "var/lib/tomcat6". This
>>> >     > seems like undesirable behavior.
>>> >     >
>>> >     > Is there some configuration I missed, that could point sling to
>>> >     create such
>>> >     > things in f.ex. "/var/lib/sling/" or alike?
>>> >     >
>>> >     > Thanks in advance
>>> >     > /Nicolai
>>> >     >
>>> >
>>> >
>>>
>>>
>>
>

Re: Problems deploying to a servlet container

Posted by Nicolai Willems <ni...@gmail.com>.
On Sun, Feb 13, 2011 at 12:11 AM, Justin Edelson
<ju...@justinedelson.com> wrote:
>
>
> On Feb 12, 2011, at 5:06 PM, Nicolai Willems <ni...@gmail.com> wrote:
>
>>
>>
>> On Sat, Feb 12, 2011 at 10:22 PM, Justin Edelson <ju...@gmail.com> wrote:
>> On 2/12/11 4:16 PM, Nicolai Willems wrote:
>> >
>> >
>> > On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson
>> > <justinedelson@gmail.com <ma...@gmail.com>> wrote:
>> >
>> >     You have a few options:
>> >     1) Set a system property sling.home.prefix to /var/lib/sling - this will
>> >     make sling home /var/lib/sling/_<context path> (e.g.
>> >     /var/lib/sling/_todoer)
>> >
>> >
>> > For future reference - this would on a linux box be "export
>> > sling.home=your/fancy/path" right?
>> > I am on my way to editing to "installing to servlet container" wiki
>> > entry - so this would be nice info.
>> No. export is an environment variable. A system property is usually set
>> by passing -D<name>=<value> to the JVM. How you do this on a particular
>> servlet container is container-specific, but there usually is an
>> environment variable you can set. Something like this:
>>
>> export JAVA_ARGS="-Dsling.home=/your/fancy/path"
>>
>> Google "set system property <container name>" for specific instructions.
>>
>> I know "your/fancy/path" isn't meant to be serious, but worth noting: if
>> you put a relative path here, it will be relative from the container's
>> home directory which is exactly what you are trying to avoid IIUC.
>>
>> Ahh, my bad - I meant it to be absolute. But I'll note that when updating the page.
>> Something like, "If setting this property should be effective you should use an absolute path"
>
> Well, a relative path would still be_effective_ :)
>
>>
>>
>> >
>> >
>> >     2) Edit the WAR file and set either a servlet init param or a context
>> >     param called sling.home. The value of this parameter will be used
>> >     directly, i.e. not have the context path appended to it.
>> >
>> >
>> > I used sort of this approach, I changed the init-param for the servlet
>> > in web.xml. Now running nice and smooth.
>> Just be sure if you happen to run multiple Sling webapps in the one
>> container that you have a different parameter value for each webapp.
>> This is an edge case, but is the point of having the context path part
>> of the path when you use either the default or the system property
>> technique (as system properties are obviously shared across all webapps
>> in a single JVM).
>>
>> Would using a path like /var/lib/sling/${context.path} resolve the above issue?
>> So in the tomcat example you would do "export JAVA_OPTS=/var/lib/sling/${context.path}".
>
> Sling does this for you. If you set the system property sling.home.prefix to /var/lib/sling, the actual sling.home directory will be that prefix _plus_ the context path.
>
> If you set sling.home in web.xml, the context path is not appended.
>
> Note the difference in names: sling.home.prefix vs. sling.home

I'm sorry to report this - but setting JAVA_OPTS as described here:
http://wiki.apache.org/tomcat/FAQ/Miscellaneous#Q5
adding -Dsling.home.prefix=/var/lib/sling/ dosen't do the trick for
me. Any suggestions?

>
> Justin
>>
>>
>> >
>> > Again - thanks for the quick reply. This mailing list is so good!
>>
>> We try :)
>>
>> Justin
>> >
>> >
>> >     Regardless of the method, you should see a log message in the servlet
>> >     container's log like this:
>> >     Setting sling.home=<sling home> (<source>)
>> >
>> >     where <source> should tell you how <sling home> was set.
>> >
>> >     HTH,
>> >     Justin
>> >
>> >     On 2/12/11 3:44 PM, Nicolai Willems wrote:
>> >     > Hello
>> >     >
>> >     > When deploying to tomcat 6 under Ubuntu, sling wont start up.
>> >     > In the logs it tells me that it is unable to create the directory
>> >     > "sling/_todoer" - inspecting the path, I found that sling is trying to
>> >     > create a directory directly under my tomcat root
>> >     "var/lib/tomcat6". This
>> >     > seems like undesirable behavior.
>> >     >
>> >     > Is there some configuration I missed, that could point sling to
>> >     create such
>> >     > things in f.ex. "/var/lib/sling/" or alike?
>> >     >
>> >     > Thanks in advance
>> >     > /Nicolai
>> >     >
>> >
>> >
>>
>>
>

Re: Problems deploying to a servlet container

Posted by Justin Edelson <ju...@justinedelson.com>.

On Feb 12, 2011, at 5:06 PM, Nicolai Willems <ni...@gmail.com> wrote:

> 
> 
> On Sat, Feb 12, 2011 at 10:22 PM, Justin Edelson <ju...@gmail.com> wrote:
> On 2/12/11 4:16 PM, Nicolai Willems wrote:
> >
> >
> > On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson
> > <justinedelson@gmail.com <ma...@gmail.com>> wrote:
> >
> >     You have a few options:
> >     1) Set a system property sling.home.prefix to /var/lib/sling - this will
> >     make sling home /var/lib/sling/_<context path> (e.g.
> >     /var/lib/sling/_todoer)
> >
> >
> > For future reference - this would on a linux box be "export
> > sling.home=your/fancy/path" right?
> > I am on my way to editing to "installing to servlet container" wiki
> > entry - so this would be nice info.
> No. export is an environment variable. A system property is usually set
> by passing -D<name>=<value> to the JVM. How you do this on a particular
> servlet container is container-specific, but there usually is an
> environment variable you can set. Something like this:
> 
> export JAVA_ARGS="-Dsling.home=/your/fancy/path"
> 
> Google "set system property <container name>" for specific instructions.
> 
> I know "your/fancy/path" isn't meant to be serious, but worth noting: if
> you put a relative path here, it will be relative from the container's
> home directory which is exactly what you are trying to avoid IIUC.
> 
> Ahh, my bad - I meant it to be absolute. But I'll note that when updating the page.
> Something like, "If setting this property should be effective you should use an absolute path"

Well, a relative path would still be_effective_ :)

>  
> 
> >
> >
> >     2) Edit the WAR file and set either a servlet init param or a context
> >     param called sling.home. The value of this parameter will be used
> >     directly, i.e. not have the context path appended to it.
> >
> >
> > I used sort of this approach, I changed the init-param for the servlet
> > in web.xml. Now running nice and smooth.
> Just be sure if you happen to run multiple Sling webapps in the one
> container that you have a different parameter value for each webapp.
> This is an edge case, but is the point of having the context path part
> of the path when you use either the default or the system property
> technique (as system properties are obviously shared across all webapps
> in a single JVM).
> 
> Would using a path like /var/lib/sling/${context.path} resolve the above issue?
> So in the tomcat example you would do "export JAVA_OPTS=/var/lib/sling/${context.path}".

Sling does this for you. If you set the system property sling.home.prefix to /var/lib/sling, the actual sling.home directory will be that prefix _plus_ the context path. 

If you set sling.home in web.xml, the context path is not appended.

Note the difference in names: sling.home.prefix vs. sling.home

Justin
>  
> 
> >
> > Again - thanks for the quick reply. This mailing list is so good!
> 
> We try :)
> 
> Justin
> >
> >
> >     Regardless of the method, you should see a log message in the servlet
> >     container's log like this:
> >     Setting sling.home=<sling home> (<source>)
> >
> >     where <source> should tell you how <sling home> was set.
> >
> >     HTH,
> >     Justin
> >
> >     On 2/12/11 3:44 PM, Nicolai Willems wrote:
> >     > Hello
> >     >
> >     > When deploying to tomcat 6 under Ubuntu, sling wont start up.
> >     > In the logs it tells me that it is unable to create the directory
> >     > "sling/_todoer" - inspecting the path, I found that sling is trying to
> >     > create a directory directly under my tomcat root
> >     "var/lib/tomcat6". This
> >     > seems like undesirable behavior.
> >     >
> >     > Is there some configuration I missed, that could point sling to
> >     create such
> >     > things in f.ex. "/var/lib/sling/" or alike?
> >     >
> >     > Thanks in advance
> >     > /Nicolai
> >     >
> >
> >
> 
> 

Re: Problems deploying to a servlet container

Posted by Justin Edelson <ju...@gmail.com>.
On 2/12/11 4:16 PM, Nicolai Willems wrote:
> 
> 
> On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson
> <justinedelson@gmail.com <ma...@gmail.com>> wrote:
> 
>     You have a few options:
>     1) Set a system property sling.home.prefix to /var/lib/sling - this will
>     make sling home /var/lib/sling/_<context path> (e.g.
>     /var/lib/sling/_todoer)
> 
> 
> For future reference - this would on a linux box be "export
> sling.home=your/fancy/path" right? 
> I am on my way to editing to "installing to servlet container" wiki
> entry - so this would be nice info.
No. export is an environment variable. A system property is usually set
by passing -D<name>=<value> to the JVM. How you do this on a particular
servlet container is container-specific, but there usually is an
environment variable you can set. Something like this:

export JAVA_ARGS="-Dsling.home=/your/fancy/path"

Google "set system property <container name>" for specific instructions.

I know "your/fancy/path" isn't meant to be serious, but worth noting: if
you put a relative path here, it will be relative from the container's
home directory which is exactly what you are trying to avoid IIUC.

> 
> 
>     2) Edit the WAR file and set either a servlet init param or a context
>     param called sling.home. The value of this parameter will be used
>     directly, i.e. not have the context path appended to it.
> 
> 
> I used sort of this approach, I changed the init-param for the servlet
> in web.xml. Now running nice and smooth.
Just be sure if you happen to run multiple Sling webapps in the one
container that you have a different parameter value for each webapp.
This is an edge case, but is the point of having the context path part
of the path when you use either the default or the system property
technique (as system properties are obviously shared across all webapps
in a single JVM).

> 
> Again - thanks for the quick reply. This mailing list is so good!

We try :)

Justin
> 
> 
>     Regardless of the method, you should see a log message in the servlet
>     container's log like this:
>     Setting sling.home=<sling home> (<source>)
> 
>     where <source> should tell you how <sling home> was set.
> 
>     HTH,
>     Justin
> 
>     On 2/12/11 3:44 PM, Nicolai Willems wrote:
>     > Hello
>     >
>     > When deploying to tomcat 6 under Ubuntu, sling wont start up.
>     > In the logs it tells me that it is unable to create the directory
>     > "sling/_todoer" - inspecting the path, I found that sling is trying to
>     > create a directory directly under my tomcat root
>     "var/lib/tomcat6". This
>     > seems like undesirable behavior.
>     >
>     > Is there some configuration I missed, that could point sling to
>     create such
>     > things in f.ex. "/var/lib/sling/" or alike?
>     >
>     > Thanks in advance
>     > /Nicolai
>     >
> 
> 


Re: Problems deploying to a servlet container

Posted by Nicolai Willems <ni...@gmail.com>.
On Sat, Feb 12, 2011 at 10:07 PM, Justin Edelson <ju...@gmail.com>wrote:

> You have a few options:
> 1) Set a system property sling.home.prefix to /var/lib/sling - this will
> make sling home /var/lib/sling/_<context path> (e.g.
> /var/lib/sling/_todoer)
>

For future reference - this would on a linux box be "export
sling.home=your/fancy/path" right?
I am on my way to editing to "installing to servlet container" wiki entry -
so this would be nice info.


> 2) Edit the WAR file and set either a servlet init param or a context
> param called sling.home. The value of this parameter will be used
> directly, i.e. not have the context path appended to it.
>

I used sort of this approach, I changed the init-param for the servlet in
web.xml. Now running nice and smooth.

Again - thanks for the quick reply. This mailing list is so good!


> Regardless of the method, you should see a log message in the servlet
> container's log like this:
> Setting sling.home=<sling home> (<source>)
>
> where <source> should tell you how <sling home> was set.
>
> HTH,
> Justin
>
> On 2/12/11 3:44 PM, Nicolai Willems wrote:
> > Hello
> >
> > When deploying to tomcat 6 under Ubuntu, sling wont start up.
> > In the logs it tells me that it is unable to create the directory
> > "sling/_todoer" - inspecting the path, I found that sling is trying to
> > create a directory directly under my tomcat root "var/lib/tomcat6". This
> > seems like undesirable behavior.
> >
> > Is there some configuration I missed, that could point sling to create
> such
> > things in f.ex. "/var/lib/sling/" or alike?
> >
> > Thanks in advance
> > /Nicolai
> >
>
>

Re: Problems deploying to a servlet container

Posted by Justin Edelson <ju...@gmail.com>.
You have a few options:
1) Set a system property sling.home.prefix to /var/lib/sling - this will
make sling home /var/lib/sling/_<context path> (e.g. /var/lib/sling/_todoer)

2) Edit the WAR file and set either a servlet init param or a context
param called sling.home. The value of this parameter will be used
directly, i.e. not have the context path appended to it.

Regardless of the method, you should see a log message in the servlet
container's log like this:
Setting sling.home=<sling home> (<source>)

where <source> should tell you how <sling home> was set.

HTH,
Justin

On 2/12/11 3:44 PM, Nicolai Willems wrote:
> Hello
> 
> When deploying to tomcat 6 under Ubuntu, sling wont start up.
> In the logs it tells me that it is unable to create the directory
> "sling/_todoer" - inspecting the path, I found that sling is trying to
> create a directory directly under my tomcat root "var/lib/tomcat6". This
> seems like undesirable behavior.
> 
> Is there some configuration I missed, that could point sling to create such
> things in f.ex. "/var/lib/sling/" or alike?
> 
> Thanks in advance
> /Nicolai
>