a4j push component richfaces 4.2.0
tvaana Mar 5, 2012 3:38 AMHi!
I am facing some problems using a4j push component with my app.
I have two pages: index.xhtml which contains info about incoming call, test.xhtml (for testing purposes) with a button which just invokes topics context and try to update index.xhtml page with data.
Data will be updated to the page only if its plain String, if I am trying to use more complicated Object, nothing happens
like this:
this.callInfo = new KlubiCallInfo("Klubi4", "0401234567", "Ok", "How to answer string");
and use it:
TopicKey topicKey = new TopicKey(PUSH_TOPICS_CONTEXT_TOPIC);
TopicsContext topicsContext = TopicsContext.lookup();
topicsContext.publish(topicKey, this.callInfo);
<a4j:push address="Klubi"
ondataavailable="setCallInfo(event.rf.data)" />
//In the js function I can see that the data holds appropriate fields
function setCallInfo(data)
{
alert(data.service) //In this case prints Klubi4
...
if(data.state == "Error")
$("body").addClass("bgError");
else
$("body").addClass("bgSuccess"); //Updates the page bg color ok
$("#serviceId").val(data.service); //doesn't do field value update
$("#msisdnId").val(data.msisdn);
$("#answerToCallId").val(data.answerToCall);
}
Also I am getting exception below when I press the button:
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1302)
at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:383)
at com.sun.grizzly.http.ProcessorTask.terminateProcess(ProcessorTask.java:984)
at com.sun.grizzly.arp.DefaultAsyncExecutor.finishResponse(DefaultAsyncExecutor.java:186)
at com.sun.grizzly.arp.DefaultAsyncExecutor.finishExecute(DefaultAsyncExecutor.java:210)
at com.sun.grizzly.arp.AsyncProcessorTask.doTask(AsyncProcessorTask.java:119)
at com.sun.grizzly.comet.CometEngine.flushPostExecute(CometEngine.java:411)
at com.sun.grizzly.comet.CometEngine.interrupt0(CometEngine.java:393)
at com.sun.grizzly.comet.CometEngine.interrupt(CometEngine.java:371)
at com.sun.grizzly.comet.CometContext.resumeCometHandler(CometContext.java:435)
at org.atmosphere.container.GrizzlyCometSupport.resume(GrizzlyCometSupport.java:160)
at org.atmosphere.container.GrizzlyCometSupport.action(GrizzlyCometSupport.java:172)
at org.atmosphere.container.GrizzlyCometSupport.action(GrizzlyCometSupport.java:65)
at org.atmosphere.cpr.AtmosphereResourceImpl.resume(AtmosphereResourceImpl.java:220)
at org.richfaces.application.push.impl.RequestImpl.onBroadcast(RequestImpl.java:129)
at org.atmosphere.cpr.AtmosphereResourceImpl.onBroadcast(AtmosphereResourceImpl.java:670)
at org.atmosphere.cpr.AtmosphereResourceImpl.notifyListeners(AtmosphereResourceImpl.java:615)
at org.atmosphere.cpr.AtmosphereResourceImpl.notifyListeners(AtmosphereResourceImpl.java:591)
at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:719)
at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:749)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
When I go to the index.xhtml page I see via firebug that session is created
SEVERE: 72 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereServlet - Using BroadcasterFactory class: org.atmosphere.cpr.DefaultBroadcasterFactory
SEVERE: 153 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereServlet - Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path: /*
SEVERE: 194 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereServlet - Atmosphere is using async support: org.atmosphere.container.GlassFishWebSocketSupport running under container: GlassFish Server Open Source Edition 3.1.1 with WebSocket enabled.
SEVERE: 212 [http-thread-pool-8080(2)] INFO org.atmosphere.handler.ReflectorServletProcessor - Installing Servlet null
SEVERE: 219 [http-thread-pool-8080(2)] INFO org.atmosphere.handler.ReflectorServletProcessor - Installing Filter PushHandlerFilter
SEVERE: 220 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereServlet - Using broadcaster class: org.atmosphere.cpr.DefaultBroadcaster
SEVERE: 224 [http-thread-pool-8080(2)] INFO org.atmosphere.cpr.AtmosphereServlet - Atmosphere Framework 0.8.5 started.
RF 4.2.0
Glassfish: 3.1.1
Timo