activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Tomcat hang-up
Date Wed, 14 Jun 2006 06:26:02 GMT
BTW how many connections are being created? (Might be worth adding
some logging).
You could add some synchronization to ensure that you don't create
lots of connections.

On 6/14/06, James Strachan <james.strachan@gmail.com> wrote:
> That code looks fine to me. I've no idea why this can be causing a
> hang. Which version are you using?
>
> Does attempting to create a thread dump give you anything?
>
> On 6/13/06, Marcus Zarra <mzarra@mac.com> 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
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message