If a mass indexer is used inside a CMP bean in JBoss 6 to rebuild the search index, an org.hibernate.TransactionException is thrown:
I've included an example EAR (see attachment) that can be deployed to JBoss 6.0.0.CR1 without any modifications.
It contains the required hibernate search libraries and defines one single indexed entity bean Contact as well as a JBoss service EJB named at.mw.contacts:ContactsService that can be accessed via JMX console.
Use this service to do one of the following things:
add new contacts by specifying firstName/lastName
list all contacts
search for contacts using the search index
rebuild the entire search index (using a MassIndexer)
Rebuilding the index fails with the exception listed above.
(the example uses an in-memory HSQL-DB and the ram directory provider for the lucene index).
(see also forum discussion: Could not register synchronization for container transaction)
Hibernate 3.6.0.Final, JBoss 6.0.0.CR1, HSQL 1.8.0 (shipped with JBoss 6.0.0.CR1)
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)