You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Francis Exocet <ex...@yahoo.fr> on 2005/02/17 14:26:28 UTC

How to call RepositoryImpl.shutdown() when using RegistryHelper

Hi,
I've checked out jackrabbit sources yesterday and I'm
having bugs with searches because of the write.lock
file being persistent in the search index directory.

In a previous message, marcel said to call the
RepositoryFactory.shutdown() method.
My question is how to call this method when using
RegistryHelper ?

For the moment i "resolved" the problem by puting
rep.shutdown() at the end of SessionImpl.logout(). But
this is not a good solution. For example, units tests
fail because it uses more than one session per
repository.

Thanks in advance for your reply and for your great
product.

Francis


	

	
		
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Francis Exocet <ex...@yahoo.fr>.
Marcel,
> but please also check that your jsps only work on
> one single repository 
> instance, as posted by tobi and edgar.
It works ! I did what Edgar said, even if i had to
adapt for Tomcat 5.5 (replace nodes parameters by
attributes in the context).

Sorry, i didn't understand how JNDI works since i've
never used it.

Thanks again, and congratulations for this great
product.

Regards,
Francis


	

	
		
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Francois,

I just changed the startup behaviour of the query manager to remove a 
possible write.lock and write a warn message to the log.
svn revision: 154158

but please also check that your jsps only work on one single repository 
instance, as posted by tobi and edgar.

cheers
  marcel


Francis Exocet wrote:

> Hi,
> I've checked out jackrabbit sources yesterday and I'm
> having bugs with searches because of the write.lock
> file being persistent in the search index directory.
> 
> In a previous message, marcel said to call the
> RepositoryFactory.shutdown() method.
> My question is how to call this method when using
> RegistryHelper ?
> 
> For the moment i "resolved" the problem by puting
> rep.shutdown() at the end of SessionImpl.logout(). But
> this is not a good solution. For example, units tests
> fail because it uses more than one session per
> repository.
> 
> Thanks in advance for your reply and for your great
> product.
> 
> Francis
> 
> 
> 	
> 
> 	
> 		
> Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
> Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
> 
> 

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Marcel Reutegger <ma...@gmx.net>.
> personally, i think that this could be resolved in the
> search implementation, in the sense that if it finds
> an inconsistent lock, it would log that with a 
> single error and then remove it the "lock".
> this should avoid that the logfiles are filled with the
> same stacktrace ;), right ?

yes, that would probably work in most cases. Currently it is coded quite 
defensive, that it does not touch the index when a lock file is there. I 
will change the implementation to remove the lock, if one is there on 
startup.

regards,
  marcel

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by David Nuescheler <da...@gmail.com>.
hi francis,

> > that's definitely not a good idea to shutdown the
> > entire repository when a session has logged out ;)
> Sure :) I did that just for debugging.
> > there's no need to explicitly shutdown the
> > repository as
> > this is done automatically through a ShutdownHook.
> > though be sure to not kill your jvm process but
> > terminate
> > it properly.
> I use Jackrabbit API from JSPs under Tomcat 5.5.7 and
> i don't know if hooks are called when processing JSPs
> (i don't know how hooks work). I'll google the web but
> if someone have the solution, it would be nice to post
> it here.
i think i had that issue a number times too, caused 
through a variety of reasons (killed jvm, multiple 
jackrabbit instances on the on the same 
"repository-home").

personally, i think that this could be resolved in the
search implementation, in the sense that if it finds
an inconsistent lock, it would log that with a 
single error and then remove it the "lock".
this should avoid that the logfiles are filled with the
same stacktrace ;), right ?

regards,
david
----------------------------------------------------------------------
standardize your content-repository !
                               http://www.jcp.org/en/jsr/detail?id=170
---------------------------------------< david.nuescheler@day.com >---

This message is a private communication. If you are not the intended
recipient, please do not read, copy, or use it, and do not disclose it
to others. Please notify the sender of the delivery error by replying
to this message, and then delete it from your system. Thank you.

The sender does not assume any liability for timely, trouble free,
complete, virus free, secure, error free or uninterrupted arrival of
this e-mail. For verification please request a hard copy version.


mailto:david.nuescheler@day.com
http://www.day.com

David Nuescheler
Chief Technology Officer
Day Software AG
Barfuesserplatz 6 / Postfach
4001 Basel
Switzerland

T  41 61 226 98 98
F  41 61 226 98 97

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Francis Exocet <ex...@yahoo.fr>.
> so you are saying, that each time you access the
> jsp, a new repository
> is created and started? this might not be the best
> way how to use a
> repository in a j2ee environment :-)
> i suggest, you create/register the repository in a
> servlet that is
> loaded on startup, and from within the jsp, you just
> lookup the
> repository using jndi.
I use JNDI as it is described in the firts steps.

That's what i want to do :
- import.jsp : (HTTP) post XML documents in the repo
- navig.jsp : navigate in the repo
- query.jsp : search nodes with XPath or SQL.

Assume that the repo has not been created yet.

1) I call navig.jsp : the repo is automatically
filled, so indexing happens and the write.lock file is
created. At this time, the search index has not been
created succefully (because of multiple sessions
indexer i think). There are just 3 files in the index
directory : segments (1Ko), ns_mappings.properties
(1Ko) and the lock file.

2) I call import.jsp : the document is added in the
repo, but indexing fails.

3) I call query.jsp : searches always returns an empty
result because there is no index.

I hope this will help you understand my problem.

Regards,
Francis


	

	
		
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Tobias Strasser <to...@gmail.com>.
> I use Jackrabbit API from JSPs under Tomcat 5.5.7 and
> i don't know if hooks are called when processing JSPs
> (i don't know how hooks work). I'll google the web but
> if someone have the solution, it would be nice to post
so you are saying, that each time you access the jsp, a new repository
is created and started? this might not be the best way how to use a
repository in a j2ee environment :-)
i suggest, you create/register the repository in a servlet that is
loaded on startup, and from within the jsp, you just lookup the
repository using jndi.

cheers, tobi
-- 
------------------------------------------< tobias.strasser@day.com >---
Tobias Strasser, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97 
-----------------------------------------------< http://www.day.com >---

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Edgar Poce <ed...@gmail.com>.
Hi francis

> I use Jackrabbit API from JSPs under Tomcat 5.5.7 and
> i don't know if hooks are called when processing JSPs
> (i don't know how hooks work). I'll google the web but
> if someone have the solution, it would be nice to post
> it here.
You can delegate on the container the jackrabbit lifecycle through j2ee 
JNDI Resources. Tomcat will take care of jackrabbit startup and the hook 
will take care of shutting it down when you stop tomcat.
Just don't kill the jvm process and it should work ok.

You have to register jackrabbit in the JNDI env.

   <Resource
	name="jcr/repositoryFactory"
	auth="Container"
	type="org.apache.jackrabbit.core.jndi.BindableRepository"/>

   <ResourceParams name="jcr/repositoryFactory">
     <parameter>
       <name>factory</name>
 
<value>org.apache.jackrabbit.core.jndi.BindableRepositoryFactory</value>
     </parameter>
     <parameter>
       <name>configFilePath</name>
       <value>[path to repository.xml]</value>
     </parameter>
     <parameter>
       <name>repHomeDir</name>
       <value>[path to repository folder]</value>
     </parameter>
   </ResourceParams>

and you will be able to get the repository with this code

   InitialContext ctx = new InitialContext();
   Context env = (Context) ctx.lookup("java:comp/env");
   Repository o = (Repository) env.lookup("jcr/repositoryFactory");

regards
Edgar

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Francis Exocet <ex...@yahoo.fr>.
Stefan,

> that's definitely not a good idea to shutdown the
> entire repository when a session has logged out ;)
Sure :) I did that just for debugging.
 
> there's no need to explicitly shutdown the
> repository as
> this is done automatically through a ShutdownHook.
> though be sure to not kill your jvm process but
> terminate 
> it properly.
I use Jackrabbit API from JSPs under Tomcat 5.5.7 and
i don't know if hooks are called when processing JSPs
(i don't know how hooks work). I'll google the web but
if someone have the solution, it would be nice to post
it here.

Thanks for your quick reply.

regards,
Francis


	

	
		
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/

Re: How to call RepositoryImpl.shutdown() when using RegistryHelper

Posted by Stefan Guggisberg <st...@gmail.com>.
On Thu, 17 Feb 2005 14:26:28 +0100 (CET), Francis Exocet
<ex...@yahoo.fr> wrote:
> Hi,
> I've checked out jackrabbit sources yesterday and I'm
> having bugs with searches because of the write.lock
> file being persistent in the search index directory.
> 
> In a previous message, marcel said to call the
> RepositoryFactory.shutdown() method.
> My question is how to call this method when using
> RegistryHelper ?
> 
> For the moment i "resolved" the problem by puting
> rep.shutdown() at the end of SessionImpl.logout(). But
> this is not a good solution. For example, units tests

that's definitely not a good idea to shutdown the
entire repository when a session has logged out ;)

there's no need to explicitly shutdown the repository as
this is done automatically through a ShutdownHook.

though be sure to not kill your jvm process but terminate 
it properly.

cheers
stefan

> fail because it uses more than one session per
> repository.
> 
> Thanks in advance for your reply and for your great
> product.
> 
> Francis
> 
> Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
> Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
>