Wednesday, October 27, 2021

[SOLVED] Hibernate Search on EC2, "Unable to create index directory"

Issue

I'm trying to implement Hibernate Search on my aws application. As usual, everything works great on localhost, but when upload to aws, I receive the following error:

org.hibernate.search.SearchException: Unable to create index directory: 
/usr/lucene/indexes for index com.myproject.domain.User

My Hibernate Search config:

<prop key="hibernate.search.default.directory_provider">filesystem</prop>
<prop key="hibernate.search.default.indexBase">/usr/lucene/indexes</prop>

I'm using EC2 + elastic beanstalk, linux with tomcat 7. I have windows on my local machine.

Should I create a directory named "/usr/lucene/indexes" on EC2 manually? Thanks.


Solution

Could it be that the app does not have the right permissions to create the base directory? Maybe best to create the base directory and give it the right permissions. AFAIK, Hibernate Search will try to create the full path though. If it is not a permission thing it would help to see the full stacktrace.



Answered By - Hardy