You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by absaar <ra...@gmail.com> on 2014/08/20 09:34:35 UTC

Problem Subscribing to AMQ Topic using amq.js

I have two modules of an application written in java: - Written in Java and
publishes messages to a topic successfully using ActiveMQ - A web
application using AMQ's Ajax library

I have issues with the AJAX based portion which is subscribing to a topic to
receive messages from AMQ topic. I am implementing the AJAX side for the
first time and apparently unable to find any solution to my problem so far
which is that I receive 404 Network Error when my jsp page loads. following
is snapshot of my jsp code:

<http://activemq.2283324.n4.nabble.com/file/n4684795/Capture.png> 

*web.xml configuration is as follows:*

<http://activemq.2283324.n4.nabble.com/file/n4684795/Capture1.png> 

*following is the error message i received in mozila firebug:*

<http://activemq.2283324.n4.nabble.com/file/n4684795/Capture3.png> 

I have been stuck with this for over a week now, kindly provide some
guidance.





--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by absaar <ra...@gmail.com>.
Turned out everything was fine except the application server I was using i.e.
*Tomcat*. For this thing to work I had to change application server from
/tomcat/ to *Jetty v9.1.5.*



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4685403.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by artnaseef <ar...@artnaseef.com>.
Sorry - I'm not familiar with that error.  Was there any information in the
webapp server log file?




--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684953.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by absaar <ra...@gmail.com>.
In my code of web.xml given in the screen shot, the last servlet was
commented, now when I removed the comments i received the following error:

*FAIL - Deployed application at context path /FinesseConsumer but context
failed to start
C:\FinesseConsumer\nbproject\build-impl.xml:1052: The module has not been
deployed.
See the server log for details.*

Is this error related to some dependency or is it something else?




--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684924.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by artnaseef <ar...@artnaseef.com>.
I can't be too sure about the web.xml installation.  Try breaking the syntax
in the file (i.e. put invalid content in the file) and see if it causes
errors - if not, it's not being used (most likely).

The parameter is telling the servlet the URL to reach activemq.  That needs
to be set correclty, but I don't think the application is getting that far.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684883.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by absaar <ra...@gmail.com>.
Thanx for the reply. 

404 is unknown resource which means that my request is unable to find the
target. 

My confusion is that:

Do I need to host my web application at some particular location i.e. app
server or is it alright to host it at any location, to access the running
ActiveMQ server via Ajax request?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684845.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by artnaseef <ar...@artnaseef.com>.
By the way - the 404 means the web server is rejecting the incoming path as
an "unknown resource".  In other words, it doesn't map to a file or a
servlet.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684810.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by absaar <ra...@gmail.com>.
When uri : 'amq' request was sent to : localhost:8080/FinesseConsumer/amq .
now with uri : '/amq' request is sent to : localhost:8080/amq .

In both scenarios i am getting same error i.e : 404 error.

As per my knowledge ActiveMQ is running on localhost:8161. So is there any
implication of cross domain request here and am i suppose to configure for
that?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684847.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by absaar <ra...@gmail.com>.
After trying this, i am still getting the same error.

Can you please guide me a bit that what exactly are the meanings of
installing AJAX servlet.
As per my understanding i have simply created a web.xml file in my java web
application project. am i required to do more configuration to make servlet
work?




--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684846.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Problem Subscribing to AMQ Topic using amq.js

Posted by artnaseef <ar...@artnaseef.com>.
Have you tried "uri : '/amq'" - note the leading slash?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Problem-Subscribing-to-AMQ-Topic-using-amq-js-tp4684795p4684809.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.