Hi Gerald,

I'd suggest you try to debug http traffic between your html page and
servlet. Maybe that'll give you some more insight in what's going on. BTW.
you're setup looks ok, but I suspect you're might be using the amq js
object in a wrong way or something.


Regards
-- 
Dejan Bosanac
Senior Software Engineer | FuseSource Corp.
dej...@fusesource.com | fusesource.com
skype: dejan.bosanac | twitter: @dejanb
blog: http://www.nighttale.net
ActiveMQ in Action: http://www.manning.com/snyder/



On Tue, Mar 20, 2012 at 8:27 AM, Gerald Weber <gerald.we...@besharp.at>wrote:

> Hi all,
> i'm using activemq 5.4.3 together with Jetty 8.1.2.
>
> I built a java program using an embedded broker in a thread. The thread
> creates a topic, reads messages from ZeroMQ and sends them to the topic.
> In the program, i enabled a jetty embedded server using the AJAXServlet in
> a ServletContextHandler
> (addServlet).
>
> After that, a HTML/JS page using amq.js is connecting to the jetty with
> the uri in the amq.init call.
> My problem:
> "Error occurred in poll. HTTP result: 0, status: parsererror". in the
> Firefox console.
>
> Facts:
> - I wrote a java test program subscribing to the topic and printing the
> messages to the console. The topic exists and the messages are displayed
> correctly.
> - The messages are text containing JSON format.
> - If i connect with the browser to the jetty url / port (
> http://127.0.0.1:8080/amq), nothing happens. After a timeout (25s),
> "<ajax-response></ajax-response>" is displayed although messages were
> available during that time.
>
> So i guess my Jetty setup is wrong, ..somewhere.
>
> The code initializing Jetty is here:
>                        QueuedThreadPool threadPool = new
> QueuedThreadPool();
>                        threadPool.setMaxThreads(30);
>
>                Server server = new Server(8080);
>            server.setSendDateHeader(true);
>            server.setThreadPool(threadPool);
>            server.setSendServerVersion(true);
>
>                ServletContextHandler context = new
> ServletContextHandler(ServletContextHandler.SESSIONS);
>                context.setContextPath("/");
>                context.setInitParameter("org.apache.activemq.brokerURL",
> brokerURL);
>
>  context.setInitParameter("org.apache.activemq.embeddedBroker", "true");
>
>                server.setHandler(context);
>
>                context.addServlet(new ServletHolder(new
>  AjaxServlet()),"/amq/*");
>                context.addServlet(new ServletHolder(new
>  HelloServlet()),"/hello");
>
>                server.start();
>                server.join();
>
> Jetty basically works, a GET http://127.0.0.1:8080/hello works.
>
>
> Can anyone give me a hint or tell me what i did wrong ?
>
> regards,
> gw
>

Reply via email to