title: Hibernate Search Slave setup on Tomcat 7 + ActiveMQ 5.9 + Spring 3.2
body: <p>I am unable to correctly setup a slave node for Hibernate Search.  I have found multiple articles on the subject and follow them, but it will not work for me.  I have setup the the master successfully.  Maybe a few more sets of eyes can see something I don't.</p>
  
  <p>I'm using:
  Spring 3.2<br/>
  Hibernate Search 3.4.1<br/>
  Hibernate 3.6.1<br/>
  Apache Tomcat 7.0.27<br/>
  ActiveMQ 5.9.0 (as stand-alone.  I've tried embedded as well with the same results).<br/></p>
  
  <p>Application META-INF\context.xml:</p>
  
  <pre><code>&lt;Context&gt;
  &lt;Resource
  name="jms/ConnectionFactory"
  auth="Container"
  type="org.apache.activemq.ActiveMQConnectionFactory"
  description="JMS Connection Factory"
  factory="org.apache.activemq.jndi.JNDIReferenceFactory"
  brokerURL="tcp://localhost:61616"
  brokerName="HibernateSearchBroker" /&gt;
  
  &lt;Resource
  name="queue/hibernatesearch"
  auth="Container" type="org.apache.activemq.command.ActiveMQQueue"
  description="Hibernate search queue"
  factory="org.apache.activemq.jndi.JNDIReferenceFactory"
  physicalName="hibernateSearchQueue" /&gt;
  
  &lt;/Context&gt;
  </code></pre>
  
  <p>Hibernate dao-config.xml:</p>
  
  <pre><code>    &lt;bean id="breezeSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="dataSource"/&gt;
      &lt;property name="annotatedClasses"&gt;
          &lt;list&gt;
  ...
          &lt;/list&gt;
      &lt;/property&gt;
  
      &lt;property name="hibernateProperties"&gt;
          hibernate.search.worker.backend=jms
          hibernate.search.worker.jndi.url=tcp://localhost:61616
          hibernate.search.worker.jms.connection_factory=jms/ConnectionFactory (tried java:comp/env/jms/ConnectionFactory as well)
          hibernate.search.worker.jms.queue=queue/hibernatesearch (tried java:comp/env/queue/hibernatesearch as well) 
           hibernate.search.worker.jndi.java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
          #hibernate.search.default.directory_provider=org.hibernate.search.store.FSSlaveDirectoryProvider (tried this as well)
  hibernate.search.default.directory_provider = filesystem-slave
  
          hibernate.search.default.refresh=120
          hibernate.search.default.indexBase=[local]
          hibernate.search.default.sourceBase=[share]
          hibernate.search.retry_initialize_period=15
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Stack Trace:</p>
  
  <pre><code>...
  Caused by: org.hibernate.HibernateException: could not init listeners
  at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
  at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1980)
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
  at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:863)
  at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:782)
  at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:188)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
  ... 61 more
  Caused by: org.hibernate.search.SearchException: Unable to lookup Search queue (queue/hibernatesearch   ) and connection factory (jms/ConnectionFactory)
  at org.hibernate.search.backend.impl.jms.JMSBackendQueueProcessorFactory.prepareJMSTools(JMSBackendQueueProcessorFactory.java:97)
  at org.hibernate.search.backend.impl.jms.JMSBackendQueueProcessorFactory.initialize(JMSBackendQueueProcessorFactory.java:61)
  at org.hibernate.search.backend.impl.BatchedQueueingProcessor.&lt;init&gt;(BatchedQueueingProcessor.java:108)
  at org.hibernate.search.backend.impl.TransactionalWorker.initialize(TransactionalWorker.java:98)
  at org.hibernate.search.backend.WorkerFactory.createWorker(WorkerFactory.java:69)
  at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:277)
  at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:144)
  at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:151)
  at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
  at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
  at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
  ... 68 more
  Caused by: javax.naming.NameNotFoundException: jms/ConnectionFactory
  at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:235)
  at javax.naming.InitialContext.lookup(InitialContext.java:411)
  at org.hibernate.search.backend.impl.jms.JMSBackendQueueProcessorFactory.prepareJMSTools(JMSBackendQueueProcessorFactory.java:92)
  ... 78 more
  </code></pre>
  
  <p>To me that says I didn't configure the JNDI name correctly - but I've tried every combo I could think of out of frustration.  Any help is appreciated.</p>