Hi,
I'm using Atmosphere(0.4.1)-Jersey(1.1.4.1) on glassfish v3.
I have a scenario where users subscribe for an event through Jersey and the
events are broadcaster from an EJB module in the same application.
The code is somethig like that:
In WAR:
@GET
@Suspend
@Path("subscribe/{topic: scene-stream}")
@Produces({"text/html;charset=ISO-8859-1"})
public Broadcastable subscibe(@PathParam("topic") Broadcaster topic)
{
return new Broadcastable("", topic);
}
and in EJB:
{
...
Broadcaster broadcaster = BroadcasterLookup.lookup("scene-stream");
Map<String, Object> model = new HashMap<String, Object>();
model.put("scene", sceneEntity);
Viewable viewable = new Viewable( "/scene-info.ftl", model);
Future f = broadcaster.broadcast(viewable);
}
When broadcastin I'm getting this exception:
[#|2009-12-16T18:15:00.098+0200|WARNING|glassfishv3.0|Atmosphere|_ThreadID=34;_ThreadName=Thread-1;|
java.lang.IllegalStateException
at
com.sun.jersey.server.impl.ThreadLocalHttpContext.getProperties(ThreadLocalHttpContext.java:95)
at
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter.writeTo(ViewableMessageBodyWriter.java:80)
at
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter.writeTo(ViewableMessageBodyWriter.java:58)
at
com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:266)
at
org.atmosphere.jersey.JerseyBroadcaster.broadcast(JerseyBroadcaster.java:193)
at
org.atmosphere.jersey.JerseyBroadcaster.access$400(JerseyBroadcaster.java:66)
at
org.atmosphere.jersey.JerseyBroadcaster$1.run(JerseyBroadcaster.java:175)
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:619)
Is this a bug or broadcasting a Viewable from outside the web container is
just not possible?
Thanks