Hi Mark, if you don't actually use Ajax to send messages, you should use REST API ( http://activemq.apache.org/rest.html)
curl -d 'body=message' http://localhost:8161/demo/message/t1?type=topic This doesn't stop you from consuming your messages using Ajax however. Cheers -- Dejan Bosanac - http://twitter.com/dejanb Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Tue, Apr 20, 2010 at 4:13 PM, magellings <[email protected]> wrote: > > Hello. I'm trying to get ActiveMQ AJAX to work but can't so far. > > I'm using fiddler, and when I post to our address of > "http://wamqdev1:10201/demo/amq" with request body of > "destination=topic://t1&message=message&type=send" I get a response with > the > exception below. The topic I'm posting to does exist. The AJAX portfolio > example also does work. The exception and my WEB.xml is below. > > Anyone have any ideas? > > <html> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> > <title>Error 500 A destination must be specified.</title> > </head> > <body><h2>HTTP ERROR: 500</h2><pre>A destination must be specified.</pre> > <p>RequestURI=/demo/amq</p><h3>Caused > by:</h3><pre>java.lang.UnsupportedOperationException: A destination must be > specified. > at > > org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:195) > at > > org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:300) > at org.apache.activemq.web.WebClient.send(WebClient.java:214) > at > > org.apache.activemq.web.MessageListenerServlet.doPost(MessageListenerServlet.java:214) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:713) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:806) > at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093) > at org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:43) > at > > org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084) > at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) > at > org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) > at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) > at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726) > at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) > at > > org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) > at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) > at org.mortbay.jetty.Server.handle(Server.java:324) > at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) > at > > org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842) > at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648) > at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) > at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) > at > > org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) > at > > org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450) > </pre> > <p><small> http://jetty.mortbay.org/ Powered by Jetty:// </small></p><br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > <br/> > > </body> > </html> > > <?xml version="1.0" encoding="UTF-8"?> > <!-- > Licensed to the Apache Software Foundation (ASF) under one or more > contributor license agreements. See the NOTICE file distributed with > this work for additional information regarding copyright ownership. > The ASF licenses this file to You under the Apache License, Version 2.0 > (the "License"); you may not use this file except in compliance with > the License. You may obtain a copy of the License at > > http://www.apache.org/licenses/LICENSE-2.0 > > Unless required by applicable law or agreed to in writing, software > distributed under the License is distributed on an "AS IS" BASIS, > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > See the License for the specific language governing permissions and > limitations under the License. > --> > <!DOCTYPE web-app > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" > "http://java.sun.com/dtd/web-app_2_3.dtd"> > > <web-app> > > <display-name>ActiveMQ Web Demos</display-name> > <description> > Apache ActiveMQ Web Demos > </description> > > <!-- context config --> > <context-param> > <param-name>org.apache.activemq.brokerURL</param-name> > <param-value>vm://localhost</param-value> > <description>The URL of the Message Broker to connect > to</description> > </context-param> > > <context-param> > <param-name>org.apache.activemq.embeddedBroker</param-name> > <param-value>true</param-value> > <description>Whether we should include an embedded broker or > not</description> > </context-param> > > <!-- servlet mappings --> > > <!-- the subscription REST servlet --> > <servlet> > <servlet-name>AjaxServlet</servlet-name> > <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class> > <load-on-startup>1</load-on-startup> > </servlet> > > <servlet> > <servlet-name>MessageServlet</servlet-name> > > <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class> > <load-on-startup>1</load-on-startup> > <!-- > Uncomment this parameter if you plan to use multiple consumers over > REST > <init-param> > <param-name>destinationOptions</param-name> > <param-value>consumer.prefetchSize=1</param-value> > </init-param> > --> > > </servlet> > > <!-- the queue browse servlet --> > <servlet> > <servlet-name>QueueBrowseServlet</servlet-name> > > <servlet-class>org.apache.activemq.web.QueueBrowseServlet</servlet-class> > </servlet> > > <!-- servlets for the portfolio demo --> > <servlet> > <servlet-name>PortfolioPublishServlet</servlet-name> > > > <servlet-class>org.apache.activemq.web.PortfolioPublishServlet</servlet-class> > <load-on-startup>1</load-on-startup> > </servlet> > > <servlet-mapping> > <servlet-name>AjaxServlet</servlet-name> > <url-pattern>/amq/*</url-pattern> > </servlet-mapping> > > <servlet-mapping> > <servlet-name>MessageServlet</servlet-name> > <url-pattern>/message/*</url-pattern> > </servlet-mapping> > > <servlet-mapping> > <servlet-name>QueueBrowseServlet</servlet-name> > <url-pattern>/queueBrowse/*</url-pattern> > </servlet-mapping> > > <servlet-mapping> > <servlet-name>PortfolioPublishServlet</servlet-name> > <url-pattern>/portfolioPublish</url-pattern> > </servlet-mapping> > > <filter> > <filter-name>session</filter-name> > <filter-class>org.apache.activemq.web.SessionFilter</filter-class> > </filter> > > <filter-mapping> > <filter-name>session</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > </web-app> > > -- > View this message in context: > http://old.nabble.com/ActiveMQ-AJAX-Problems-tp28287864p28287864.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > >
