Hi everyone,
I just can't seem to get Hibernate search running. I'm trying to add hibernate search to and old project. I use the following libraries:
Hibernate core 3.2.6.gaHibernate annotations 3.3.1Hibernate search 3.0.1Here are my configurations
Code:
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hbm2ddl.auto">update</property>
<!-- Connection data, using orion's internal datasource management -->
<property name="connection.datasource">jdbc/SherlockPDS</property>
<property name="jdbc.batch_size">20</property>
<!-- Hibernate 2-level cache -->
<property name="cache.provider_class">framework.hibernate.oscache.OSCacheProvider</property>
<property name="cache.use_query_cache">true</property>
<!-- Transaction management -->
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.OrionTransactionManagerLookup</property>
<!--<property name="transaction.flush_before_completion">true</property>-->
<property name="transaction.auto_close_session">true</property>
<property name="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</property>
<property name="hibernate.search.default.indexBase">C:\LuceneIndexes</property>
Mappings...
.
.
.
<!-- Event listeners -->
<event type="post-update">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-insert">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-delete">
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
I'm not using annotations to map my dao classes, instead i'm using the old hibernate xml mapping files.
When debugging the application it starts normal, but when it reaches the line where it calls configuration.buildSessionFactory() in the code below nothing happens, it never returns. And I get no error messages.
Code:
Configuration configuration = new Configuration();
configuration.configure();
SessionFactory sessionFactory = configuration.buildSessionFactory();
I have set debug level for hibernate in the log4j.properties file and this is the last output I get:
Code:
08:41:59 [INFO]: NamingHelper.java:26 - JNDI InitialContext properties:{}
08:41:59 [INFO]: DatasourceConnectionProvider.java:61 - Using datasource: jdbc/SherlockPDS
08:42:00 [INFO]: SettingsFactory.java:89 - RDBMS: MySQL, version: 5.0.67-community-nt
08:42:00 [INFO]: SettingsFactory.java:90 - JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.8 ( Revision: ${svn.Revision} )
08:42:00 [INFO]: Dialect.java:152 - Using dialect: org.hibernate.dialect.MySQLDialect
08:42:00 [INFO]: TransactionFactoryFactory.java:34 - Transaction strategy: org.hibernate.transaction.JTATransactionFactory
08:42:00 [INFO]: NamingHelper.java:26 - JNDI InitialContext properties:{}
08:42:00 [INFO]: TransactionManagerLookupFactory.java:38 - instantiating TransactionManagerLookup: org.hibernate.transaction.OrionTransactionManagerLookup
08:42:00 [INFO]: TransactionManagerLookupFactory.java:42 - instantiated TransactionManagerLookup
08:42:00 [INFO]: TransactionManagerLookupFactory.java:38 - instantiating TransactionManagerLookup: org.hibernate.transaction.OrionTransactionManagerLookup
08:42:00 [INFO]: TransactionManagerLookupFactory.java:42 - instantiated TransactionManagerLookup
08:42:00 [INFO]: SettingsFactory.java:143 - Automatic flush during beforeCompletion(): disabled
08:42:00 [INFO]: SettingsFactory.java:147 - Automatic session close at end of transaction: enabled
08:42:00 [INFO]: SettingsFactory.java:154 - JDBC batch size: 20
08:42:00 [INFO]: SettingsFactory.java:157 - JDBC batch updates for versioned data: disabled
08:42:00 [INFO]: SettingsFactory.java:162 - Scrollable result sets: enabled
08:42:00 [DEBUG]: SettingsFactory.java:166 - Wrap result sets: disabled
08:42:00 [INFO]: SettingsFactory.java:170 - JDBC3 getGeneratedKeys(): enabled
08:42:00 [INFO]: SettingsFactory.java:178 - Connection release mode: auto
08:42:00 [INFO]: SettingsFactory.java:202 - Maximum outer join fetch depth: 2
08:42:00 [INFO]: SettingsFactory.java:205 - Default batch fetch size: 1
08:42:00 [INFO]: SettingsFactory.java:209 - Generate SQL with comments: disabled
08:42:00 [INFO]: SettingsFactory.java:213 - Order SQL updates by primary key: disabled
08:42:00 [INFO]: SettingsFactory.java:217 - Order SQL inserts for batching: disabled
08:42:00 [INFO]: SettingsFactory.java:386 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
08:42:00 [INFO]: ASTQueryTranslatorFactory.java:24 - Using ASTQueryTranslatorFactory
08:42:00 [INFO]: SettingsFactory.java:225 - Query language substitutions: {}
08:42:00 [INFO]: SettingsFactory.java:230 - JPA-QL strict compliance: disabled
08:42:00 [INFO]: SettingsFactory.java:235 - Second-level cache: enabled
08:42:00 [INFO]: SettingsFactory.java:239 - Query cache: enabled
08:42:00 [INFO]: SettingsFactory.java:373 - Cache provider: framework.hibernate.oscache.OSCacheProvider
08:42:00 [INFO]: SettingsFactory.java:254 - Optimize cache for minimal puts: disabled
08:42:00 [INFO]: SettingsFactory.java:263 - Structured second-level cache entries: disabled
08:42:00 [INFO]: SettingsFactory.java:360 - Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
08:42:00 [DEBUG]: SQLExceptionConverterFactory.java:52 - Using dialect defined converter
08:42:00 [INFO]: SettingsFactory.java:283 - Echoing all SQL to stdout
08:42:00 [INFO]: SettingsFactory.java:290 - Statistics: disabled
08:42:00 [INFO]: SettingsFactory.java:294 - Deleted entity synthetic identifier rollback: disabled
08:42:00 [INFO]: SettingsFactory.java:309 - Default entity-mode: pojo
08:42:00 [INFO]: SettingsFactory.java:313 - Named query checking : enabled
If i remove the event listeners from the configuration file it gets past this line and everything seems to be fine. But later when I'm about to start adding objects to the index I get the following error: "Search Event listeners not configured". This is due to one of the following reasons:
Quote:
The full error message looks something like this:
Caused by: org.hibernate.HibernateException: Hibernate Search Event listeners not configured, please check the reference documentation and the application's hibernate.cfg.xml
at org.hibernate.search.util.ContextHelper.getSearchFactoryBySFI(ContextHelper.java:32)
There are several possibilities for this error.
* You are not using Hibernate Annotations in which case the event listeners have to be manually configured (see also the event listener configuration in the online documentation):
<hibernate-configuration>
<session-factory>
<event type="post-update"/>
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-insert"/>
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
<event type="post-delete"/>
<listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>
</session-factory>
</hibernate-configuration>
(Latest releases require more event listeners, please refer to the documentation relevant to the version you are using)
* Your are using the wrong version of Hibernate Annotation/Search. Hibernate Annotation has tries to detect Search at startup and configures the event listeners in case they are found. This however requires that you have the right versions of the dependencies. Check the Compatibility Matrix for the right combination of jar files. In case you are using the jar files which ship with the Hibernate Search distribution make sure that you really installed the right jar files and they they are really used. Some containers might have a shared lib directory with a older versions of the required libraries. Check the log file. Each Hibernate product reports its version when starting up.
* If you sure you are using the right version of Annotations and Search and you still get this exception it might be that you have a custom class loading configuration which prevents Annotations to locate the Search specific event listeners. If this is the case try the manual configuration.
[url]
https://www.hibernate.org/446.html[/url]
I don't know what more to do from here. Is there anyone here who had this problem before? Does anyone have any suggestions? I would be grateful for any help I can get.