You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@archiva.apache.org by Brett Porter <br...@gmail.com> on 2008/02/27 21:51:14 UTC

Re: Derby database relative to `cwd` ?

url="jdbc:derby:archiva/derbydb;create=true" is a relative path - you
should provide the full path in here after the jdbc:derby: part.

- Brett

On 28/02/2008, Brown, Carlton <Ca...@compucredit.com> wrote:
> In my latest Archiva installation, I noticed that Archiva resolves the
>  path to the derby database relative to whatever was the current working
>  directory at the time Tomcat was started.
>  For example, if I'm in $CATALINA_HOME/bin and I run ./catalina.sh start,
>  then the derby database gets created under
>  $CATALINA_HOME/bin/archiva/derbydb.    If I restart Tomcat later from a
>  different directory, it gets created from scratch in that different
>  directory.
>
>  To work around this issue and make sure the derby db dir is always
>  resolved to the same place, before Tomcat starts in catalina.sh, I must
>  explicitly call:   cd $CATALINA_HOME
>
>  Here's part of my archiva.xml, where the path to the derby db gets set:
>
>   <Resource name="jdbc/users" auth="Container"
>  type="javax.sql.DataSource"
>            username="sa"
>            password=""
>            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
>            url="jdbc:derby:archiva/derbydb;create=true" />
>
>  And in catalina.properties I have this:
>  appserver.home=${catalina.home}
>  appserver.base=${catalina.home}/archiva
>
>  This is Archiva 1.0.1 on Tomcat 6.0.16 with JDK 1.6.0_04, RHEL 5
>
>  Thanks in advance,
>  Carlton
>
>
>
>  -----------------------------------------
>  ====================================================
>  This message contains PRIVILEGED and CONFIDENTIAL
>  information that is intended only for use by the
>  named recipient. If you are not the named recipient,
>  any disclosure, dissemination, or action based on
>  the contents of this message is prohibited. In such
>  case please notify us and destroy and delete all
>  copies of this transmission.  Thank you.
>  ====================================================


-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

Re: Derby database relative to `cwd` ?

Posted by Brett Porter <br...@gmail.com>.
That's completely out of the control of the application - you are  
configuring Tomcat and Derby there.

On 28/02/2008, at 8:29 AM, Brown, Carlton wrote:

> Thanks, will try it.  But doesn't that behavior seem kind of weird?   
> The
> database is a kind of important resource to risk it getting resolved  
> to
> some random different place whenever you restart Tomcat.  One would
> expect it to resolve relative to some deterministic location like
> ${appserver.home} like Archiva logging does.
>
>> -----Original Message-----
>> From: Brett Porter [mailto:brett.porter@gmail.com]
>> Sent: Wednesday, February 27, 2008 3:51 PM
>> To: archiva-users@maven.apache.org
>> Subject: Re: Derby database relative to `cwd` ?
>>
>> url="jdbc:derby:archiva/derbydb;create=true" is a relative path - you
>> should provide the full path in here after the jdbc:derby: part.
>>
>> - Brett
>>
>> On 28/02/2008, Brown, Carlton <Ca...@compucredit.com> wrote:
>>> In my latest Archiva installation, I noticed that Archiva resolves
> the
>>> path to the derby database relative to whatever was the current
> working
>>> directory at the time Tomcat was started.
>>> For example, if I'm in $CATALINA_HOME/bin and I run ./catalina.sh
>> start,
>>> then the derby database gets created under
>>> $CATALINA_HOME/bin/archiva/derbydb.    If I restart Tomcat later
> from a
>>> different directory, it gets created from scratch in that different
>>> directory.
>>>
>>> To work around this issue and make sure the derby db dir is always
>>> resolved to the same place, before Tomcat starts in catalina.sh, I
> must
>>> explicitly call:   cd $CATALINA_HOME
>>>
>>> Here's part of my archiva.xml, where the path to the derby db gets
> set:
>>>
>>>  <Resource name="jdbc/users" auth="Container"
>>> type="javax.sql.DataSource"
>>>           username="sa"
>>>           password=""
>>>           driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
>>>           url="jdbc:derby:archiva/derbydb;create=true" />
>>>
>>> And in catalina.properties I have this:
>>> appserver.home=${catalina.home}
>>> appserver.base=${catalina.home}/archiva
>>>
>>> This is Archiva 1.0.1 on Tomcat 6.0.16 with JDK 1.6.0_04, RHEL 5
>>>
>>> Thanks in advance,
>>> Carlton
>>>
>>>
>>>
>>> -----------------------------------------
>>> ====================================================
>>> This message contains PRIVILEGED and CONFIDENTIAL
>>> information that is intended only for use by the
>>> named recipient. If you are not the named recipient,
>>> any disclosure, dissemination, or action based on
>>> the contents of this message is prohibited. In such
>>> case please notify us and destroy and delete all
>>> copies of this transmission.  Thank you.
>>> ====================================================
>>
>>
>> --
>> Brett Porter
>> Blog: http://blogs.exist.com/bporter/


RE: Derby database relative to `cwd` ?

Posted by "Brown, Carlton" <Ca...@compucredit.com>.
Thanks, will try it.  But doesn't that behavior seem kind of weird?  The
database is a kind of important resource to risk it getting resolved to
some random different place whenever you restart Tomcat.  One would
expect it to resolve relative to some deterministic location like
${appserver.home} like Archiva logging does.

> -----Original Message-----
> From: Brett Porter [mailto:brett.porter@gmail.com]
> Sent: Wednesday, February 27, 2008 3:51 PM
> To: archiva-users@maven.apache.org
> Subject: Re: Derby database relative to `cwd` ?
> 
> url="jdbc:derby:archiva/derbydb;create=true" is a relative path - you
> should provide the full path in here after the jdbc:derby: part.
> 
> - Brett
> 
> On 28/02/2008, Brown, Carlton <Ca...@compucredit.com> wrote:
> > In my latest Archiva installation, I noticed that Archiva resolves
the
> >  path to the derby database relative to whatever was the current
working
> >  directory at the time Tomcat was started.
> >  For example, if I'm in $CATALINA_HOME/bin and I run ./catalina.sh
> start,
> >  then the derby database gets created under
> >  $CATALINA_HOME/bin/archiva/derbydb.    If I restart Tomcat later
from a
> >  different directory, it gets created from scratch in that different
> >  directory.
> >
> >  To work around this issue and make sure the derby db dir is always
> >  resolved to the same place, before Tomcat starts in catalina.sh, I
must
> >  explicitly call:   cd $CATALINA_HOME
> >
> >  Here's part of my archiva.xml, where the path to the derby db gets
set:
> >
> >   <Resource name="jdbc/users" auth="Container"
> >  type="javax.sql.DataSource"
> >            username="sa"
> >            password=""
> >            driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
> >            url="jdbc:derby:archiva/derbydb;create=true" />
> >
> >  And in catalina.properties I have this:
> >  appserver.home=${catalina.home}
> >  appserver.base=${catalina.home}/archiva
> >
> >  This is Archiva 1.0.1 on Tomcat 6.0.16 with JDK 1.6.0_04, RHEL 5
> >
> >  Thanks in advance,
> >  Carlton
> >
> >
> >
> >  -----------------------------------------
> >  ====================================================
> >  This message contains PRIVILEGED and CONFIDENTIAL
> >  information that is intended only for use by the
> >  named recipient. If you are not the named recipient,
> >  any disclosure, dissemination, or action based on
> >  the contents of this message is prohibited. In such
> >  case please notify us and destroy and delete all
> >  copies of this transmission.  Thank you.
> >  ====================================================
> 
> 
> --
> Brett Porter
> Blog: http://blogs.exist.com/bporter/