activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patrice <>
Subject Ajax and Tomcat 6 - based on web-demo with a non embedded broker
Date Wed, 09 Feb 2011 17:00:24 GMT

Hi ,

I use activeMQ 5.4.2

I am trying to implement a simple web demo to show log message from
different programs using ajax into a web page.

To do that, I use the basic broker, (tcp://localhost:61616).
The producer is a simple program with log4j configured to log on a jms
appender, using topic (topic name is logTopic).
If I run the example consumer with the command "ant consumer -Dtopic=true
-Dsubject=logTopic", I am able to get the log on the consumer side.

so now, the next step for me is to have the consumer into a WebApp which can
"provide" the messages to the client into a webpage using ajax.

So I looked at the ajax page : and
configure my web.xml as it is explain. The broker was not found, but I
solved it by using context-param in my web.xml

my web.xml looks like that : 
	<display-name>Archetype Created Web Application</display-name>


	<!-- tomcat listeners -->
		<description>The URL of the Message Broker to connect to</description>
		<description>Whether we should include an embedded broker or

	<!-- Servlet to get JMS message -->

The web page code is very simple, as the market portfolio example that comes
with activeMQ distrib : 

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/amq_jquery_adapter.js"></script>
<script type="text/javascript" src="js/amq.js"></script>
<script type="text/javascript">
  var amq = org.activemq.Amq;
    uri: 'amq', 
    logging: true,
    timeout: 30,
    clientId:(new Date()).getTime().toString()
<script type="text/javascript">
  var myHandler =
    rcvMessage: function(message)
       amq.adapter.log('receive message' + message);
       var txt = document.createTextNode(message);
<h2>Test !</h2>
<div id="list"></div>

but, it does not work. I traced request, there are send from the web page,
but nothing is updated,...
looking at log file I can see the following error 

java.lang.IllegalStateException: !(Jetty || Servlet 3.0 ||

I searched for a long time without find any solution to solve this problem.
So do you know how to configure Tomcat to make this sample works ?

Feel free to ask for more detail if needed.


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message