activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Zarra <mza...@mac.com>
Subject Re: Tomcat hang-up
Date Tue, 13 Jun 2006 19:41:43 GMT
Note in this situation when the hang occurs there are no error logs  
on either side of the connection.

On Jun 13, 2006, at 1:31 PM, Marcus Zarra wrote:

> 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 
> ("JMS_URL");
>             log.info("URL is '" + jmsURL + "'");
>             ActiveMQConnectionFactory connectionFactory;
>             try {
>                 log.info("Connecting to JMS");
>                 connectionFactory = new ActiveMQConnectionFactory 
> (jmsURL);
>                 log.info("Factory initialized");
>                 connection = connectionFactory.createConnection();
>                 log.info("Connection established");
>                 connection.start();
>                 log.info("Connection started");
>                 getServletContext().setAttribute("queueConnection",  
> connection);
>             } catch (Throwable e) {
>                 log.error("Error initializing JMS Connection", e);
>                 throw new RuntimeException("Failed to initialize  
> JMS Connection");
>             }
>         } 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.
>
> Thanks,
>
> Marcus


Mime
View raw message