On Jan 22, 2011, at 9:23 AM, habumaster wrote:

> 
> 
> Alex Dean-2 wrote:
>> 
>> 
>> On Jan 21, 2011, at 11:13 PM, habumaster wrote:
>> 
>> 
>> Replies inline. It seems I am getting to 8161 and it is returning the
>> welcome page for ActiveMQ?

Yes, I agree.  More information below.


>>> 2. What URL do you visit to view your test web page?
>> 
>> I have run my own test send/receive web pages in the demo directory. They
>> work fine without having to redirect via a proxy, since I am local on the
>> server. 
>> 
>> What I progressed to - I login to my existing rails app I had running
>> using FireFox indcating the workbench I want. The rails app serves up that
>> workbench. Onload of the workbench, I have amq.init starting. I am
>> expecting amq client to be available. 
>> 
>> Login:
>> URL http://server:8080
>> 
>> Workbench:             
>> URL http://server:8080/workbenches/ID
>> 
>> 
>>> 3. Post the <script> tags you have in that page, and the JS code you're
> using to configure amq.js.
>> 
>> Application.js 
>> function startOV_amq(myChannel) {
>> 
>>      var amq = org.activemq.Amq;
>> 
>>    var MyHandler = {
>>              rcvMessage: function(message)
>>              { eval(message.data) }
>>              };      
>>              
>>      amq.init({ uri: "/amq",
>>      logging: true,
>>      timeout: 45,
>>      clientId: (new Date()).getTime().toString()});
>>      
>>      amq.addListener('MyHandler', myChannel, MyHandler.rcvMessage);
>>      }
>> 
>> 
>> <%= javascript_include_tag :defaults, 'ov', 'amq_prototype_adapter', 'amq'
>> %>

Just curious why you're serving amq_prototype_adapter.js and amq.js from your 
Rails app instead of directly from ActiveMQ?  Do you have local changes of some 
kind to those libraries?  If not, I suggest just loading them from ActiveMQ 
itself.

>> 
>> 
>>> 4. Post the proxy configuration you've got in Apache.
>> 
>> ProxyRequests Off
>>      ProxyPass /amq http://localhost:8161 retry=10     
>>      ProxyPassReverse /amq http://localhost:8161           
>>      ProxyPassReverseCookiePath / /amq

As a test, this means you should be able to load http://server:8080/amq/demo/, 
which should be proxied to http://server:8161/demo - the path to the ActiveMQ 
demo application.  You should also be able to load 
http://server:8080/amq/demo/js/amq.js and 
http://server:8080/amq/demo/js/amq_prototype_adapter.js.

If those URLs are working, then you'll need to use:
  amq.init({ uri: "/amq/demo/amq" })

due to the default configuration in 
apache-activemq-5.4.2/webapps/demo/WEB-INF/web.xml:
  <servlet-mapping>
    <servlet-name>AjaxServlet</servlet-name>
    <url-pattern>/amq/*</url-pattern>
  </servlet-mapping>

>> 
>>> 5. Post a few examples of the Apache errors you see.
>> 
>> [Fri Jan 21 21:39:17 2011] [debug] mod_proxy_http.c(56): proxy: HTTP:
>> canonicalising URL //localhost:8161
>> [Fri Jan 21 21:39:17 2011] [debug] proxy_util.c(1488): [client
>> 47.102.211.208] proxy: http: found worker http://localhost:8161 for
>> http://localhost:8161/?timeout=45000&d=1295668347118&r=0.3465096321093155&clientId=1295668340376,

This should be a request for 
http://localhost:8161/demo/amq?timeout=45000&d=1295668347118&r=0.3465096321093155&clientId=1295668340376

I think the adjustments I suggest above will have that effect.

>>> 6. Post a few examples of whatever is filling the Firebug log.  It would
> be great to see a GET for polling, >and the response which comes back from
> ActiveMQ.
>> 
>> This was the most I could get since it spools by so fast :(
>> 
>> 47.102.211.208 - - [22/Jan/2011:08:24:26 -0600] "GET
>> /amq?timeout=45000&d=1295707035229&r=0.6207296420130076&clientId=1295706770151
>> HTTP/1.1" 200 6618 "http://47.105.91.75:8080/workbenches/12"; "Mozilla/5.0
>> (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203
>> Firefox/3.6.13
>> 
>> And the incoming result 
>> 
>> Error occurred in poll. HTTP result: undefined, status: TypeError:
>> data.getElementsByTagName is not a function
>> Exception in the poll handler: <!-- Licensed to the Apache Software
>> Foundation (ASF) under one or more contributor license agreements. See the

Yup.  You're getting the HTML content of http://server:8161/ returned to you.  
The amq.js code isn't getting the type of XML content it expects, and chaos 
ensues.  The messages are coming so fast because as soon as one request 
returns, the client immediately initiates a new request (which is what it's 
designed to do).

Let me know how it goes when you're able to make those adjustments.  Perhaps we 
should add a "Proxying with Apache" section to 
http://activemq.apache.org/ajax.html.

best,
alex

Reply via email to