-->
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.  [ 7 posts ] 
Author Message
 Post subject: question on configuring hibernate search.
PostPosted: Thu May 19, 2011 8:19 pm 
Newbie

Joined: Thu May 19, 2011 1:59 pm
Posts: 10
Hi,

I am using hibernate annotations and hibernate search. However, I getting the following stack trace:

Exception in thread "main" 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:54)
at org.hibernate.search.util.ContextHelper.getSearchFactory(ContextHelper.java:40)
at org.hibernate.search.impl.FullTextSessionImpl.getSearchFactoryImplementor(FullTextSessionImpl.java:220)
at org.hibernate.search.impl.FullTextSessionImpl.index(FullTextSessionImpl.java:186)
at com.nexant.search.index.EntityIndexer.reIndex(EntityIndexer.java:32)
at com.nexant.search.main.Main.main(Main.java:27)

So, I try putting the following in the hibernate.cfg.xml file:

<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>

and I am getting the following exception:

Initial SessionFactory creation failed.org.hibernate.MappingException: Unable to instantiate specified event (post-update) listener class: org.hibernate.search.event.FullTextIndexEventListener
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.nexant.search.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:18)
at com.nexant.search.util.HibernateUtil.<clinit>(HibernateUtil.java:8)
at com.nexant.search.main.Main.main(Main.java:23)
Caused by: org.hibernate.MappingException: Unable to instantiate specified event (post-update) listener class: org.hibernate.search.event.FullTextIndexEventListener
at org.hibernate.cfg.Configuration.setListeners(Configuration.java:2408)
at org.hibernate.cfg.Configuration.parseEvent(Configuration.java:2377)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2299)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2260)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2213)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2128)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2107)
at com.nexant.search.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:13)
... 2 more
Caused by: org.hibernate.search.SearchException: FullTextIndexEventListener default constructor is obsolete. Remove all explicitevent listener configuration. As of Hibernate Core 3.6 Hibernate Search will be automatically enabled if it is detected on the classpath.
at org.hibernate.search.event.FullTextIndexEventListener.<init>(FullTextIndexEventListener.java:124)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.hibernate.cfg.Configuration.setListeners(Configuration.java:2405)


Any advice would be greatly appreciated.

Thanks.


Top
 Profile  
 
 Post subject: Re: question on configuring hibernate search.
PostPosted: Thu May 19, 2011 8:43 pm 
Newbie

Joined: Thu May 19, 2011 8:04 pm
Posts: 6
Which version of Hibernate Search you are using? I had got this problem when I was using JBoss 5.1, Hibernate Search 3.4 . I still could not figure out because JBoss was causing problems even though I had used Jboss classloader to specifically tell JBoss that it should use the project's Hibernate jars and not of JBoss

I had to use Hibernate Search 3.1 with Jboss 5.1 to resolve this.


Top
 Profile  
 
 Post subject: Re: question on configuring hibernate search.
PostPosted: Thu May 19, 2011 8:46 pm 
Newbie

Joined: Thu May 19, 2011 1:59 pm
Posts: 10
Thanks for the reply.

I am not running it within any application server yet. I just write a standalone program to see if I can get hibernate search to work.

I am using hibernate core 3.6.4. According to the jboss web site, this include the hibernate annotations?
and I am using hibernate search 3.4.0

Thanks.


Top
 Profile  
 
 Post subject: Re: question on configuring hibernate search.
PostPosted: Thu May 19, 2011 9:30 pm 
Newbie

Joined: Thu May 19, 2011 1:59 pm
Posts: 10
I am able to get Hibernate search to run with hibernate search 3.1.1 and hibernate core 3.3.1. But I still have to put

<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>

in my hibernate.cfg.xml

Any advice on how to get it to work with the latest version of hibernate search and hibernate core will be greatly helpful.

Thanks.


Top
 Profile  
 
 Post subject: Re: question on configuring hibernate search.
PostPosted: Fri May 20, 2011 5:39 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
Any advice on how to get it to work with the latest version of hibernate search and hibernate core will be greatly helpful.

you refer to Hibernate Search 3.4.0 and Hibernate core 3.6.4 ?
In that case you don't need to enable any listener, it will be picked up automatically.

In case you're using JBossAS you'll have to include both Hibernate core and Search jars in your EAR file and make sure you're configuring it to load the Hibernate core bundled with the ear instead of the one bundled by the AS; This can be tricky, an alternative is to replace the core version in the AS, and not bundle it with your application. In case you run other AS, then I don't know sorry.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: question on configuring hibernate search.
PostPosted: Fri May 20, 2011 1:18 pm 
Newbie

Joined: Thu May 19, 2011 1:59 pm
Posts: 10
ok, stupid me. sorry

I copy and paste the hibernate.cfg.xml and somehow it has the hibernate.search.autoregister_listeners
set to false. Setting it to true and it work.

Thanks.


Top
 Profile  
 
 Post subject: Re: question on configuring hibernate search.
PostPosted: Sat Jul 09, 2011 12:33 pm 
Regular
Regular

Joined: Thu Jun 16, 2011 12:03 pm
Posts: 94
Hi,

Could you please tell me how did you make hibernate search work in jboss 5.1ga?

I would like to use the last version of hibernate search 3.4 and it includes a diferent new version of hibernate-core. Well, the application deploys but at some moment i get errors from the hibernate-core.

I tried to configure my ear and my war to not use the jar of jboss but i don't know if i am doing well....

I created a jboss-classloading.xml in my META-INF ear and war but i don't know the exactly configuration...

thanks in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.