You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by woodstockrich <Ri...@shaw.ca> on 2012/04/24 18:37:38 UTC

HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

I modified the portfolio demo to do what I need and works great when in the
webapps/demo directory.  I need to now move/merge this into our existing
code which will be deployed in JBOSS 7.1.  

The web page comes up, and I've stepped through the amq initialization and
it looks ok, but the pollHandler which I add via amq.addPollHandler never
gets invoked.

When I look at the web traffic using Fiddler, I note that that the "caching"
column has values of no-cache etc when I run it via the webapps/demo
directory, but there is no data under the caching column when I run under
JBOSS.

When running under the demo, the /amq is called repeatedly doing the polling
after getting favicon.ico, but with the JBOSS version the /amq?timeout=10&_=
never gets a response.

Suggestions please.



--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4584105.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by Khurram Zaman <kh...@sensys.com>.

Sent from my HTC

----- Reply message -----
From: "woodstockrich" <Ri...@shaw.ca>
To: "users@activemq.apache.org" <us...@activemq.apache.org>
Subject: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse
Date: Thu, Apr 26, 2012 4:03 am



Almost there?

I added the kahadb-5.5.1.jar as part of the web deployment assembly, plus
jetty-all-server

When I start JBOSS with activemqra-5.5.1.rar and activemq-web-5.5.1.jar in
standalone deployments
I continue to get these:

15:37:23,140 ERROR [org.jboss.osgi.framework.internal.FrameworkEventsPlugin]
(MSC service thread 1-1) Framework ERROR:
org.osgi.framework.BundleException: Cannot resolve bundle resModule:
[org.apache.activemq.activemq-web:5.5.1]
<stack dump snip>
Caused by: org.jboss.osgi.resolver.XResolverException: Unable to resolve
Module[org.apache.activemq.activemq-web:5.5.1]: missing requirement
[Module[org.apache.activemq.activemq-web:5.5.1]] package;
(&(package=javax.jms)(version>=1.1.0)(!(version>=2.0.0)))

15:37:23,141 ERROR [org.apache.activemq.activemq-web] (Thread-82)
FrameworkEvent ERROR: org.apache.felix.log.LogException:
org.osgi.framework.BundleException: Cannot resolve bundle resModule:
[org.apache.activemq.activemq-web:5.5.1]
<stack dump snip>
Caused by: org.apache.felix.log.LogException:
org.jboss.osgi.resolver.XResolverException: Unable to resolve
Module[org.apache.activemq.activemq-web:5.5.1]: missing requirement
[Module[org.apache.activemq.activemq-web:5.5.1]] package;
(&(package=javax.jms)(version>=1.1.0)(!(version>=2.0.0)))

15:37:23,141 ERROR [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011900:
Cannot start bundle: org.apache.activemq.activemq-web:5.5.1:
org.osgi.framework.BundleException: Cannot resolve bundle:
org.apache.activemq.activemq-web:5.5.1



I am hoping the above only relate to the activemq console.

I get notified that my message broker has started:
15:37:24,827 INFO  [org.apache.activemq.broker.BrokerService] (Starting
ActiveMQ Broker) ActiveMQ JMS Message Broker (epic.broker1,
ID:RICHARPND7D1-60707-1335393444515-0:1) started


Then I "run on server" my project which contains the HML and javascript, and
I get these:
 15:43:38,264 WARN  [org.jboss.as.ee] (MSC service thread 1-2) JBAS011006:
Not installing optional component
org.eclipse.jetty.continuation.Servlet3Continuation$1 due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.eclipse.jetty.continuation.Servlet3Continuation$1

15:43:38,264 WARN  [org.jboss.as.ee] (MSC service thread 1-2) JBAS011006:
Not installing optional component
org.eclipse.jetty.continuation.Servlet3Continuation$2 due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.eclipse.jetty.continuation.Servlet3Continuation$2

15:43:40,899 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RichJMSDispBoardDemo].[AjaxServlet]]
(http--0.0.0.0-8080-1) Servlet.service() for servlet AjaxServlet threw
exception: java.lang.IllegalStateException: The servlet or filters that are
being used by this request do not support async operation

15:43:40,915 ERROR [stderr] (http--0.0.0.0-8080-2)
javax.management.InstanceNotFoundException: naming:type=rmiregistry

15:43:40,947 ERROR [stderr] (JMX connector) Exception in thread "JMX
connector" java.lang.UnsupportedOperationException: JBAS011859: Naming
context is read-only

15:43:41,540 ERROR [stderr] (http--0.0.0.0-8080-2)
javax.management.InstanceNotFoundException: naming:type=rmiregistry


These last 2 repeat.

I see this:
15:43:41,571 INFO  [org.apache.activemq.broker.BrokerService]
(http--0.0.0.0-8080-2) ActiveMQ JMS Message Broker (localhost,
ID:RICHARPND7D1-60966-1335393821368-0:1) started

Note this is a different broker ID than the one that I originally started.
Why doesn't it just connect to the first?
It shuts down in 2 seconds anyway.


When I look at the web-traffic, the amq call returns the broker id
ID:RICHARPND7D1-60966-1335393821368-2:2:1:1:1

--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4588358.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
I finally have success, but it feels rough still.

It seems that when I first start up IE and go to my URL, it does not receive
the messages.  If I do a refresh, then it starts receiving messages.   

This is true with Firefox as well.

So I'm not quite sure why I have to invoke the refresh.

Also, I have two handlers to accept different messages.   Sometimes,
particularly IE, it only receives one of the two messages.

A minor observation related to Firefox. Just something to be aware of when
switching between browsers.
In Javascript, on message receipt the code is:  alert("Machine:"+ 
message.getAttribute('stock') + " " + message.getAttribute('status')+ "
text:" + message.text );
The text message being sent by my server process is: <message type="X"
stock="AB1" status="OK" movement="up"> Message extra text </message>
In IE, the alert displays as: Machine:AB1 OK text:Message extra text
In Firefox, the alert displays as: Machine:AB1 OK text:undefined


At least a nice way to end Friday, when I figured I'd have to abandon
ActiveMQ and all my work leading up to this if I didn't get it
communicating.

--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4594021.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
Very close.

I changed the context-param org.apache.activemq.brokerURL value to
tcp://localhost:61616 in my web.xml and also in broker-config.xml in the rar
file I made sure that transportConnector uri="tcp://localhost:61616"

Cleaned and restarted my JBOSS.  Deployed my web application.   Ran a
separate Java application which pushes out data on a topic and listens for
messages from the client.  Invoked the URL to my webpage, and voila, my Java
application got the message sent to it from my web application.   

However, my web client is not getting any messages back.

Looking at the Web traffic via Fiddler, it makes 3 calls to amq: 
destination=topic://T&message=stocks&type=listen
destination=queue://B&message=login&type=listen
destination=queue://A&message=JMSTYPE:LOGIN_REQUEST
SENT_FROM:DISPBOARD_JS_EMBED-APR271003&type=send

However, it is not going into the behavior I saw before which is the
continuous looping of /amq/timeout=...

Suggestions please.

--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4593271.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
Roadblock averted but still not successful.

Add this to web.xml    servlet clause for AjaxServlet
<async-supported>true</async-supported>  

So now I only have the InstanceNotFoundException and JMX connector Naming
context is read-only

the /amq?timeout= call is made but never gets a response.

--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4591499.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
I think I may be able to turn off the Management of the broker and prevent
the errors regarding the JMX Management/ MBean etc.   I did see
documentation about useJmx, and 

However I believe I will still have this error, which is ultimately what is
being returned in http as seen by Fiddler: 

the Servlet.service() for servlet AjaxServlet threw exception:
java.lang.IllegalStateException: The servlet or filters that are being used
by this request do not support async operation

Looking at JBoss 7, someone else had the same issue (but not for activemq)
and it appears that it was logged as a bug last summer, and does not appear
to be fixed.

Links: https://community.jboss.org/thread/170070

At this point, I think I'm roadblocked.   Which means I have to look at
Hornet.... argh.
If ANYONE has been able to successfully deploy a WAR that uses activeMQ-web
under JBOSS 7.1, let me know.


 


--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4591312.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
Here's my status:

I think part of my problem was that in addition to putting
activemqra-5.5.1.rar to have the message broker into the
standalone/deployments area, I was also putting in the activemq-web.5.5.1
jar by itself.  It was also deployed as part of deploying my application
subsequent to JBOSS server coming up.  So when it started up with JBOSS
start, it wasn't finding everything it needed and also after I deployed my
main project, it probably conflicted.

So I removed the web jar from standalone deployments and JBOSS comes up ok
(before I deploy the project).  I only get this warning, which I am assuming
is inoccuous.

09:45:32,646 WARN  [org.jboss.as.ee] (MSC service thread 1-5) JBAS011006:
Not installing optional component
org.eclipse.jetty.continuation.Servlet3Continuation$1 due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.eclipse.jetty.continuation.Servlet3Continuation$1
in standalone/deployments I have activemqra-5.5.1.rar and
activemq-web.5.5.1.

Also similar WARN for Servlet3Continuation$2

For the first time, when I deploy my main application (WAR), I don't get any
errors or warnings.

It is only when I start my browser and invoke my URL that I get errors:

09:47:00,620 ERROR [stderr] (http--0.0.0.0-8080-1)
javax.management.InstanceNotFoundException: naming:type=rmiregistry
<snipped stack trace>
09:47:00,683 ERROR [stderr] (JMX connector) Exception in thread "JMX
connector" java.lang.UnsupportedOperationException: JBAS011859: Naming
context is read-only
09:47:01,313 ERROR [stderr] (http--0.0.0.0-8080-1)
javax.management.InstanceNotFoundException: naming:type=rmiregistry
09:47:01,328 ERROR [stderr] (http--0.0.0.0-8080-1)
javax.management.InstanceNotFoundException: naming:type=rmiregistry
09:47:01,351 ERROR [stderr] (JMX connector) Exception in thread "JMX
connector" java.lang.UnsupportedOperationException: JBAS011859: Naming
context is read-only
09:47:02,176 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RichJMSDispBoardDemo].[AjaxServlet]]
(http--0.0.0.0-8080-3) Servlet.service() for servlet AjaxServlet threw
exception: java.lang.IllegalStateException: The servlet or filters that are
being used by this request do not support async operation

Then it shuts down the broker.

I'll keep looking...

--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4590385.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
Almost there?

I added the kahadb-5.5.1.jar as part of the web deployment assembly, plus
jetty-all-server

When I start JBOSS with activemqra-5.5.1.rar and activemq-web-5.5.1.jar in
standalone deployments
I continue to get these:

15:37:23,140 ERROR [org.jboss.osgi.framework.internal.FrameworkEventsPlugin]
(MSC service thread 1-1) Framework ERROR:
org.osgi.framework.BundleException: Cannot resolve bundle resModule:
[org.apache.activemq.activemq-web:5.5.1]
<stack dump snip>
Caused by: org.jboss.osgi.resolver.XResolverException: Unable to resolve
Module[org.apache.activemq.activemq-web:5.5.1]: missing requirement
[Module[org.apache.activemq.activemq-web:5.5.1]] package;
(&(package=javax.jms)(version>=1.1.0)(!(version>=2.0.0)))

15:37:23,141 ERROR [org.apache.activemq.activemq-web] (Thread-82)
FrameworkEvent ERROR: org.apache.felix.log.LogException:
org.osgi.framework.BundleException: Cannot resolve bundle resModule:
[org.apache.activemq.activemq-web:5.5.1]
<stack dump snip>
Caused by: org.apache.felix.log.LogException:
org.jboss.osgi.resolver.XResolverException: Unable to resolve
Module[org.apache.activemq.activemq-web:5.5.1]: missing requirement
[Module[org.apache.activemq.activemq-web:5.5.1]] package;
(&(package=javax.jms)(version>=1.1.0)(!(version>=2.0.0)))

15:37:23,141 ERROR [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011900:
Cannot start bundle: org.apache.activemq.activemq-web:5.5.1:
org.osgi.framework.BundleException: Cannot resolve bundle:
org.apache.activemq.activemq-web:5.5.1



I am hoping the above only relate to the activemq console.

I get notified that my message broker has started:
15:37:24,827 INFO  [org.apache.activemq.broker.BrokerService] (Starting
ActiveMQ Broker) ActiveMQ JMS Message Broker (epic.broker1,
ID:RICHARPND7D1-60707-1335393444515-0:1) started


Then I "run on server" my project which contains the HML and javascript, and
I get these:
 15:43:38,264 WARN  [org.jboss.as.ee] (MSC service thread 1-2) JBAS011006:
Not installing optional component
org.eclipse.jetty.continuation.Servlet3Continuation$1 due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.eclipse.jetty.continuation.Servlet3Continuation$1

15:43:38,264 WARN  [org.jboss.as.ee] (MSC service thread 1-2) JBAS011006:
Not installing optional component
org.eclipse.jetty.continuation.Servlet3Continuation$2 due to exception:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011054: Could not find default constructor for class
org.eclipse.jetty.continuation.Servlet3Continuation$2

15:43:40,899 ERROR
[org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/RichJMSDispBoardDemo].[AjaxServlet]]
(http--0.0.0.0-8080-1) Servlet.service() for servlet AjaxServlet threw
exception: java.lang.IllegalStateException: The servlet or filters that are
being used by this request do not support async operation

15:43:40,915 ERROR [stderr] (http--0.0.0.0-8080-2)
javax.management.InstanceNotFoundException: naming:type=rmiregistry

15:43:40,947 ERROR [stderr] (JMX connector) Exception in thread "JMX
connector" java.lang.UnsupportedOperationException: JBAS011859: Naming
context is read-only

15:43:41,540 ERROR [stderr] (http--0.0.0.0-8080-2)
javax.management.InstanceNotFoundException: naming:type=rmiregistry


These last 2 repeat.

I see this:
15:43:41,571 INFO  [org.apache.activemq.broker.BrokerService]
(http--0.0.0.0-8080-2) ActiveMQ JMS Message Broker (localhost,
ID:RICHARPND7D1-60966-1335393821368-0:1) started

Note this is a different broker ID than the one that I originally started. 
Why doesn't it just connect to the first?
It shuts down in 2 seconds anyway.


When I look at the web-traffic, the amq call returns the broker id
ID:RICHARPND7D1-60966-1335393821368-2:2:1:1:1

--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4588358.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
Ok, inching forward, but not there yet.

A key consideration was changing the amq.uri='amq'.  Then at least I no
longer got the http response "The requested resource (/amq) is not
available"

My server returns HTML with the errors:
java.lang.NoClassDefFoundError:
org/apache/kahadb/util/DataByteArrayInputStream

So I will check out to see if that's deployed and probably isn't.

The other thing that is a concern for me is when I deploy activemq-web, I
get the following:
13:15:16,935 ERROR [org.jboss.osgi.framework.internal.FrameworkEventsPlugin]
(MSC service thread 1-6) Framework ERROR:
org.osgi.framework.BundleException: Cannot resolve bundle resModule:
[org.apache.activemq.activemq-web:5.5.1]

If this is just for the ActiveMQ console, I don't care (at this point) as
long as the active mq messaging will still work.  


--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4588007.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
Narrowing it down further.

Fiddler shows that the /amq calls returns the following text  (inside HTML):

requested resource (/amq) is not available

So I think it is just a matter of bringing in the AJAX servlet?

I /thought/ I had done that, but I'll check again tomorrow.

--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4585499.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: HTML/JS works in Demo but not under JBOSS 7.1 / Eclipse

Posted by woodstockrich <Ri...@shaw.ca>.
I actually don't need the pollHandler.

I just need to be able to receive messages where I added the listener, and
send messages to the queue I've defined.



--
View this message in context: http://activemq.2283324.n4.nabble.com/HTML-JS-works-in-Demo-but-not-under-JBOSS-7-1-Eclipse-tp4584105p4584817.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.