jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Klimetschek <aklim...@day.com>
Subject Re: Trouble redeploying Tomcat webapp using Jackrabbit
Date Fri, 14 Aug 2009 20:49:39 GMT
On Fri, Aug 14, 2009 at 7:08 AM, Nigel Sim<nigel.sim@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

Mime
View raw message