activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Zarra <>
Subject Tomcat hang-up
Date Tue, 13 Jun 2006 19:31:43 GMT
Hopefully this is a simple question that has been answered before.  I  
am attempting to connect to an ActiveMQ broker from tomcat and the  
broker is running on another machine.  The tomcat version that is  
being used is old enough that I cannot put a context.xml in place and  
access the broker via a context lookup.  Therefore I am simply  
attempting to connect to the broker inside of the init method for a  
servlet using the following code:

         o = getServletContext().getAttribute("queueConnection");
         Connection connection;
         if (o == null) {
             String jmsURL = getServletContext().getInitParameter 
   "URL is '" + jmsURL + "'");
             ActiveMQConnectionFactory connectionFactory;
             try {
       "Connecting to JMS");
                 connectionFactory = new ActiveMQConnectionFactory 
       "Factory initialized");
                 connection = connectionFactory.createConnection();
       "Connection established");
       "Connection started");
             } catch (Throwable e) {
                 log.error("Error initializing JMS Connection", e);
                 throw new RuntimeException("Failed to initialize JMS  
         } else {
             connection = (QueueConnection)o;

There is some additional things going on in the init method but this  
is the area having an issue.  The issue is that the code stops dead  
on connection.start() every time and locks so hard that I need to  
kill -9 tomcat.

Has anyone seen and/or resolved this issue before?  Or is there a  
cleaner/safer way to establish a connection to a broker from inside  
of a 4.x tomcat instance.



View raw message