Spring + Hibernate Search 3.1.0 = ArrayStoreException

Posted by Double Compile. Tuesday, January 19. 2010, 11:30 AM in Java

I'm using Spring Framework version 3.0.0 (although, I'll bet the same problem would happen with 2.x). I'm using Hibernate Search 3.1.0 (That's what's in Maven. I wonder why there's no 3.1.1).

Trying to use the configuration as follows inside of a Spring configuration document.

<property name="eventListeners">
<map>
<entry key="post-update" value-ref="fullTextEventListener" />
<entry key="post-delete" value-ref="fullTextEventListener" />
<entry key="post-insert" value-ref="fullTextEventListener" />
<entry key="flush">
<list>
<bean class="org.hibernate.event.def.DefaultFlushEventListener" />
<ref local="fullTextEventListener" />
</list>
</entry>
</map>
</property>

Upon running some unit tests, I get a nasty Exception stack, with the following at the root.

Caused by: java.lang.ArrayStoreException
	at java.lang.System.arraycopy(Native Method)
	at java.util.ArrayList.toArray(ArrayList.java:306)
	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:759)
	at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1460)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1398)
	... 57 more

The root cause of the problem (and I needed to debug the Spring/Hibernate internals to figure this out) is that FullTextIndexEventListener does not implement the FlushEventListener interface in version 3.1.0, but it does in 3.1.1.

Solution: upgrade (if you're using Maven, try the JBoss repository which has the latest stuff) or omit the "flush" event from the configuration.

Trackbacks

Comments

No comments

Add Comment


Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Pavatar/Gravatar/Favatar/MyBlogLog/Pavatar author images supported.