Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Setting Configuration Properties for Tomcat/ActiveMQ backend
PostPosted: Fri Aug 28, 2009 3:53 pm 
Newbie

Joined: Thu Aug 27, 2009 2:57 pm
Posts: 4
I am trying to implement a JMS backend for Hibernate Search indexing.
Using Spring 2.5, Tomcat 6.0.18 with ActiveMQ 5.2 as JMS Provider.
The post referenced in https://www.hibernate.org/421.html has been very helpful however I am missing one piece of the puzzle that I cannot figure out.
How do I set the hibernate search worker properties to refer to the Tomcat resources defined.

e.g. I am trying:

Code:
hibernate.search.worker.jms.connection_factory=jms/ConnectionFactory
hibernate.search.worker.jms.queue=queue/hibernatesearch


to refer to the resources defined in:

Code:
<!-- ActiveMQ ConnectionFactory -->   
<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?trace=true" brokerName="LocalActiveMQBroker"/>

<!-- ActiveMQ HibernateSearch queue -->   
<Resource name="queue/hibernatesearch" auth="Container" type="org.apache.activemq.command.ActiveMQQueue"
        description="Hibernate search queue" factory="org.apache.activemq.jndi.JNDIReferenceFactory"
        physicalName="HibernateSearchController"/>


Unfortunately, I obviously have some sort of disconnect here.
Getting exceptions at startup (truncated):

Code:
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:68)
   at org.hibernate.search.backend.impl.jms.JMSBackendQueueProcessorFactory.initialize(JMSBackendQueueProcessorFactory.java:38)
   at org.hibernate.search.backend.impl.BatchedQueueingProcessor.<init>(BatchedQueueingProcessor.java:101)
   at org.hibernate.search.backend.impl.TransactionalWorker.initialize(TransactionalWorker.java:53)
   at org.hibernate.search.backend.WorkerFactory.createWorker(WorkerFactory.java:58)
   at org.hibernate.search.impl.SearchFactoryImpl.<init>(SearchFactoryImpl.java:129)
   at org.hibernate.search.event.ContextHolder.getOrBuildSearchFactory(ContextHolder.java:30)
   at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:59)
   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)
   ... 130 more
Caused by: javax.naming.NameNotFoundException: Name jms is not bound in this Context


Does anyone know how or have any experience of setting these worker properties to refer to Tomcat defined Resources?

Would be most grateful for any advice.


Top
 Profile  
 
 Post subject: Re: Setting Configuration Properties for Tomcat/ActiveMQ backend
PostPosted: Mon Aug 31, 2009 8:31 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

have you tried: java:comp/env/queue/hibernatesearch and java:comp/env/jms/ConnectionFactory.
Tomcat uses java:comp/env/ as root for JNDI. Have a look at http://tomcat.apache.org/tomcat-6.0-doc ... howto.html.

--Hardy


Top
 Profile  
 
 Post subject: Re: Setting Configuration Properties for Tomcat/ActiveMQ backend
PostPosted: Wed Sep 30, 2009 4:19 pm 
Newbie

Joined: Thu Aug 27, 2009 2:57 pm
Posts: 4
Thanks Hardy,

that worked perfectly.


Top
 Profile  
 
 Post subject: Re: Setting Configuration Properties for Tomcat/ActiveMQ backend
PostPosted: Fri Oct 02, 2009 5:30 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
alanoregan wrote:
Thanks Hardy,

that worked perfectly.



Have you managed to use XA Connection factory for JMS? Our XA Connection factory for JMS is configured in Spring (jencks) and it's being a pain to export as JNDI. Tried exporting the bean as JNDI but the sessionfactory gets created before the bean that exports the xa connection bean into JNDI (I wish libraries weren't specifically designed for Spring). It seems as though jencks will not work anyway. The org.jencks.amqpool.XaPooledConnectionFactory doesn't implement javax.jms.QueueConnectionFactory. As a result I get a classcastexception. Is there any example of XA jms connection examples?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 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.