You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Nigel Sim <ni...@gmail.com> on 2009/08/14 07:08:25 UTC

Trouble redeploying Tomcat webapp using Jackrabbit

Hi have a Tomcat app which gets a Jackrabbit instance via JNDI. When I try
to hot-redeploy the app it failes with the following:

javax.jcr.RepositoryException: The repository home
/data/repository/repository-home appears to be in use since the file named
.lock is already locked by the current process.
        at
org.apache.jackrabbit.core.util.RepositoryLock.tryLock(RepositoryLock.java:159)
...

Then if I shutdown Tomcat I have to clean up the lock file to start things
up again.

The JNDI resource is:
    <Resource name="jcr/repository" auth="Container"
type="javax.jcr.Repository"
        factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
        configFilePath="/data/repository/repository.xml"
        repHomeDir="/data/repository/repository-home" />

Do I need to do anything else to help jackrabbit shutdown and start up
properly in a Tomcat container.

On a similar note, during development I use mvn tomcat:run to run my webapp.
When I kill it with ctrl-c Jackrabbit again fails to shutdown properly, this
time with:

Exception in thread "Thread-6" java.lang.NoClassDefFoundError:
org/apache/jackrabbit/core/lock/LockManagerImpl$2
    at
org.apache.jackrabbit.core.lock.LockManagerImpl.save(LockManagerImpl.java:245)
    at
org.apache.jackrabbit.core.lock.LockManagerImpl.close(LockManagerImpl.java:186)
    at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(RepositoryImpl.java:2133)
    at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(RepositoryImpl.java:2069)
    at
org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1131)
    at
org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1081)
    at
org.apache.jackrabbit.core.jndi.BindableRepository.shutdown(BindableRepository.java:242)
    at
org.apache.jackrabbit.core.jndi.BindableRepository$1.run(BindableRepository.java:120)


I will be very thankful for any pointers/assistance with this.

Thanks
Nigel

Re: Trouble redeploying Tomcat webapp using Jackrabbit

Posted by Nigel Sim <ni...@gmail.com>.
Just to follow up, this approach does overcome the problem. I might also try
the Spring wrappers for Jackrabbit [1], which will allow me to keep the
deployment a bit more atomic. But at least this is solved for now.

Thanks

[1] http://blogs.citytechinc.com/sjohnson/?p=33

2009/8/17 Alexander Klimetschek <ak...@day.com>

> On Mon, Aug 17, 2009 at 11:20 AM, Alexander Klimetschek<ak...@day.com>
> wrote:
> > BTW, why do you need to redeploy the repository anyway? If you
> > separate the webapp(s) using the repository
>
> I mean "if you separate the webapp(s) that access the repository from
> the repository webapp..." of course ;-)
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>

Re: Trouble redeploying Tomcat webapp using Jackrabbit

Posted by Alexander Klimetschek <ak...@day.com>.
On Mon, Aug 17, 2009 at 11:20 AM, Alexander Klimetschek<ak...@day.com> wrote:
> BTW, why do you need to redeploy the repository anyway? If you
> separate the webapp(s) using the repository

I mean "if you separate the webapp(s) that access the repository from
the repository webapp..." of course ;-)

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Trouble redeploying Tomcat webapp using Jackrabbit

Posted by Alexander Klimetschek <ak...@day.com>.
On Sat, Aug 15, 2009 at 6:27 AM, Nigel Sim<ni...@gmail.com> wrote:
> I was just hoping other doing hot-redeploys with Jackrabbit had hit this
> same issue.

BTW, why do you need to redeploy the repository anyway? If you
separate the webapp(s) using the repository (ie. a model 2 deployment
[1]), you only need to redeploy them, but the repository can keep
running.

[1] http://jackrabbit.apache.org/deployment-models.html

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Re: Trouble redeploying Tomcat webapp using Jackrabbit

Posted by Nigel Sim <ni...@gmail.com>.
Thank Alexander,

I think I agree with your analysis of the NoClassDefFound issue. However,
the locking issue seems to have no resolution. I am just using the example
from the Jackrabbit site,
http://jackrabbit.apache.org/application-bundle-howto.html , and I don't
think there is a way to explicitly shutdown a JNDI resource. I mean, I
though all JNDI resources were meant to clean themselves up, like
DataSources for JDBC.

For now I'm chalking this up to issues with the BindableRepositoryFactory,
but until I can do some deeper debugging I haven't really got much to file a
bug report on.

I was just hoping other doing hot-redeploys with Jackrabbit had hit this
same issue.

Thanks
Nigel

2009/8/15 Alexander Klimetschek <ak...@day.com>

> On Fri, Aug 14, 2009 at 7:08 AM, Nigel Sim<ni...@gmail.com> wrote:
> > Hi have a Tomcat app which gets a Jackrabbit instance via JNDI. When I
> try
> > to hot-redeploy the app it failes with the following:
> >
> > javax.jcr.RepositoryException: The repository home
> > /data/repository/repository-home appears to be in use since the file
> named
> > .lock is already locked by the current process.
> >        at
> >
> org.apache.jackrabbit.core.util.RepositoryLock.tryLock(RepositoryLock.java:159)
> > ...
> >
> > Then if I shutdown Tomcat I have to clean up the lock file to start
> things
> > up again.
> >
> > The JNDI resource is:
> >    <Resource name="jcr/repository" auth="Container"
> > type="javax.jcr.Repository"
> >
>  factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
> >        configFilePath="/data/repository/repository.xml"
> >        repHomeDir="/data/repository/repository-home" />
> >
> > Do I need to do anything else to help jackrabbit shutdown and start up
> > properly in a Tomcat container.
>
> You must shutdown the repository before you can redeploy/restart it,
> to properly stop all threads and remove the lock. See
> TransientRepository.shutdown(). Not sure if this is possible in case
> of a JNDI based resource - Tomcat would need to be able to tell the
> resource to shutdown before hot re-deployment, since it is the one who
> creates it. But I am not a JNDI expert ;-)
>
>
> > On a similar note, during development I use mvn tomcat:run to run my
> webapp.
> > When I kill it with ctrl-c Jackrabbit again fails to shutdown properly,
> this
> > time with:
> >
> > Exception in thread "Thread-6" java.lang.NoClassDefFoundError:
> > org/apache/jackrabbit/core/lock/LockManagerImpl$2
> >    at
> >
> org.apache.jackrabbit.core.lock.LockManagerImpl.save(LockManagerImpl.java:245)
> >    at
> >
> org.apache.jackrabbit.core.lock.LockManagerImpl.close(LockManagerImpl.java:186)
> >    at
> >
> org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(RepositoryImpl.java:2133)
> >    at
> >
> org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(RepositoryImpl.java:2069)
> >    at
> >
> org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1131)
> >    at
> >
> org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1081)
> >    at
> >
> org.apache.jackrabbit.core.jndi.BindableRepository.shutdown(BindableRepository.java:242)
> >    at
> >
> org.apache.jackrabbit.core.jndi.BindableRepository$1.run(BindableRepository.java:120)
>
> Hmm, either there is something broken in your jackrabbit jars or the
> classpath is already "closed down" while the shutdown is still in
> progress.
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>



-- 
JCU eResearch Centre
School Of Business (IT)
James Cook University

Re: Trouble redeploying Tomcat webapp using Jackrabbit

Posted by Alexander Klimetschek <ak...@day.com>.
On Fri, Aug 14, 2009 at 7:08 AM, Nigel Sim<ni...@gmail.com> wrote:
> Hi have a Tomcat app which gets a Jackrabbit instance via JNDI. When I try
> to hot-redeploy the app it failes with the following:
>
> javax.jcr.RepositoryException: The repository home
> /data/repository/repository-home appears to be in use since the file named
> .lock is already locked by the current process.
>        at
> org.apache.jackrabbit.core.util.RepositoryLock.tryLock(RepositoryLock.java:159)
> ...
>
> Then if I shutdown Tomcat I have to clean up the lock file to start things
> up again.
>
> The JNDI resource is:
>    <Resource name="jcr/repository" auth="Container"
> type="javax.jcr.Repository"
>        factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
>        configFilePath="/data/repository/repository.xml"
>        repHomeDir="/data/repository/repository-home" />
>
> Do I need to do anything else to help jackrabbit shutdown and start up
> properly in a Tomcat container.

You must shutdown the repository before you can redeploy/restart it,
to properly stop all threads and remove the lock. See
TransientRepository.shutdown(). Not sure if this is possible in case
of a JNDI based resource - Tomcat would need to be able to tell the
resource to shutdown before hot re-deployment, since it is the one who
creates it. But I am not a JNDI expert ;-)


> On a similar note, during development I use mvn tomcat:run to run my webapp.
> When I kill it with ctrl-c Jackrabbit again fails to shutdown properly, this
> time with:
>
> Exception in thread "Thread-6" java.lang.NoClassDefFoundError:
> org/apache/jackrabbit/core/lock/LockManagerImpl$2
>    at
> org.apache.jackrabbit.core.lock.LockManagerImpl.save(LockManagerImpl.java:245)
>    at
> org.apache.jackrabbit.core.lock.LockManagerImpl.close(LockManagerImpl.java:186)
>    at
> org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(RepositoryImpl.java:2133)
>    at
> org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(RepositoryImpl.java:2069)
>    at
> org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1131)
>    at
> org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1081)
>    at
> org.apache.jackrabbit.core.jndi.BindableRepository.shutdown(BindableRepository.java:242)
>    at
> org.apache.jackrabbit.core.jndi.BindableRepository$1.run(BindableRepository.java:120)

Hmm, either there is something broken in your jackrabbit jars or the
classpath is already "closed down" while the shutdown is still in
progress.

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com