-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: hibernate-search: relative path for hibernate.search.default
PostPosted: Tue Feb 12, 2008 7:30 am 
Beginner
Beginner

Joined: Thu Sep 21, 2006 2:49 am
Posts: 24
I want to configure my persistence.xml like this:


Code:
<property name="hibernate.search.default.indexBase" value="$JBOSS_HOME/server/all/data/lucene/indexes"/>


or

Code:
<property name="hibernate.search.default.indexBase" value="../../server/all/data/lucene/indexes"/>



but that does not work!

is there any possibility to configure a relative path?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 10:15 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Where does the index end up in the second example? Does it not work at all?

have you thought about filtering the value for ${JBOSS_HOME} into the configuration file at build time. You could have different build profiles for your different environments.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 12:07 pm 
Beginner
Beginner

Joined: Thu Sep 21, 2006 2:49 am
Posts: 24
The second one should end up to my package.ear

If I try:

Code:
<property name="hibernate.search.default.indexBase" value="${JBOSS_HOME}/server/all/data/lucene/indexes"/>


it will result in the error
Code:
org.hibernate.search.SearchException: Cannot write into index directory: ${JBOSS_HOME}/server/all/data/lucene/indexes



any more ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 14, 2008 2:51 pm 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
As said just using ${JBOSS_HOME} in the properties file is not going to work. Hibernate or in this case Hibernate Search would not know how to expand this variable.

A relative path name, however, should work. Hibernate Search uses the specified indexBase property and just and calls
Code:
File indexDir = new File( indexBase );

According to the Java specs in case of a relative path the resulting file/directory should be relative to the system property user.dir which is in turn typically the directory in which the Java virtual machine was invoked. If you can figure out from which directory your startup script is launching the JVM you should be able to work out how the relative path should look like.

Have you tried the filtering approach though?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 21, 2008 6:31 am 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
I'm wondering about this exact same issue - I'd like to deploy to hibernate and my development and deployment environments are different. Generating a different EAR for each environment seems like a pain.

Did the relative path method give any results?

Ideally I'd use a system property or a JNDI resource or something that can be configured inside the server. Otherwise I'd potentially have to generate a custom EAR for every environment I ever deploy to :-(.

Would it make sense for me subclass the directory provider and use my own logic to determine the path based on a system property of my own invention?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 23, 2008 7:17 am 
Beginner
Beginner

Joined: Thu Jun 21, 2007 1:47 pm
Posts: 46
I tried the relative path method and it worked pretty well. You just have to be aware of what the "current directory" means for your appserver.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.