Atmosphere / atmosphere

Event Driven WebSockets Framework with Cross-Browser Fallbacks
http://async-io.org/
3.68k stars 747 forks source link

Glassfish completely broken when JSR 356 is enabled. #2067

Closed magsam closed 8 years ago

magsam commented 8 years ago

When JSR 356 is enabled, all 2.x version are all broken.

[2015-10-20T12:28:32.709+0200] [glassfish 4.1] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=58 _ThreadName=http-listener-1(5)] [timeMillis: 1445336912709] [levelValue: 900] [[
  StandardWrapperValve[Push Servlet]: Servlet.service() for servlet Push Servlet threw exception
java.lang.IllegalStateException: Request is within the scope of a filter or servlet that does not support asynchronous operations
   at org.apache.catalina.connector.Request.startAsync(Request.java:4257)
   at org.apache.catalina.connector.Request.startAsync(Request.java:4234)

[http-listener-1(5)] WARN org.atmosphere.cpr.DefaultBroadcaster - Duplicate resource 9fd12d61-4626-4a15-abc3-257f554f763b. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one]]

[2015-10-20T12:28:32.709+0200] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=58 _ThreadName=Thread-15] [timeMillis: 1445336912709] [levelValue: 1000] [[
  [http-listener-1(5)] ERROR org.atmosphere.cpr.AsynchronousProcessor - Interceptor Atmosphere LifeCycle crashed. Processing will continue with other interceptor.]]

[2015-10-20T12:37:41.699+0200] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=45 _ThreadName=Thread-14] [timeMillis: 1445337461699] [levelValue: 1000] [[
  [RunLevelControllerThread-1445337419940] WARN org.atmosphere.cpr.DefaultAsyncSupportResolver - Failed to create AsyncSupport class: class org.atmosphere.container.JSR356AsyncSupport, error: java.lang.reflect.InvocationTargetException]]

[2015-10-20T12:37:41.699+0200] [glassfish 4.1] [SEVERE] [] [] [tid: _ThreadID=45 _ThreadName=Thread-14] [timeMillis: 1445337461699] [levelValue: 1000] [[
  [RunLevelControllerThread-1445337419940] ERROR org.atmosphere.cpr.DefaultAsyncSupportResolver - Real error: class org.atmosphere.container.JSR356AsyncSupport, error: java.lang.IllegalStateException: Not in 'deploy' scope.]]

atmosphere-runtime 2.4.0-RC6, PrimeFaces 5.3, Mojarra 2.2.11 , GlassFish Server Open Source Edition 4.1 (build 13) , Extensions 3.2.0 ,Omnifaces 2.1, Open Source ERP with Primefaces http://osretail.de/osRetail/

scipio11 commented 8 years ago

Having the same trouble with atmosphere-runtime 2.4.0-RC6, PrimeFaces 5.3, Mojarra 2.2.12 , GlassFish Server Open Source Edition 4.1.1 ,Omnifaces 2.1,rewrite-servlet 2.0.12, rewrite-integration-faces-2.0.12

jfarcand commented 8 years ago

Workaround

<init-param>
   <param-name>org.atmosphere.cpr.asyncSupport</param-name>
   <param-value>org.atmosphere.container.GlassFishServ30WebSocketSupport</param-value>
</init-param>
magsam commented 8 years ago

now I get this message when I login to the chat

2015-10-28T12:31:45.648+0100|Schwerwiegend: [http-listener-1(3)] ERROR org.atmosphere.config.managed.Invoker - 2015-10-28T12:31:45.649+0100|Schwerwiegend: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497)

jfarcand commented 8 years ago

@magsam That's not the real error, you should have another exception in the log. Anyway I've commited more stuff for GlassFish that will be part of 2.4.0 and 2.5.6. Use SNAPSHOT right now or the workaround described above.

magsam commented 8 years ago

I installed the Snapshot. I get a second message (first: Schwerwiegend: java.lang.reflect.InvocationTargetException) and then Caused by: java.lang.NullPointerException at de.osretail.basis.ChatResource.onOpen(ChatResource.java:35)

@OnOpen public void onOpen(RemoteEndpoint r, EventBus eventBus) {
logger.info("OnOpen {}", r);
line 35: eventBus.publish(room + "/*", new Message(String.format("%s has entered the room '%s'", username, room), true)); }

Here the log maybe it will help you

INFO de.osretail.basis.ChatResource - OnOpen RemoteEndpointImpl{request=AtmosphereRequest{ method=GET contextPath=/osRetail servletPath=/primepush pathInfo=/{room}/Handel_Versand requestURI=/osRetail/primepush/%7Broom%7D/Handel_Versand requestURL=http://localhost:8080/osRetail/primepush/%7Broom%7D/Handel_Versand AtmosphereResource UUID=e5793fbd-280f-4b97-9f7a-da487346686a destroyable=true}, uri='/osRetail/primepush/%7Broom%7D/Handel_Versand', status=Status{status=OPEN}}

I get this warning

WARN org.atmosphere.cpr.AtmosphereFramework - org.primefaces.push.impl.PushEndpointMapper is not a framework service that could be installed

jfarcand commented 8 years ago

@magsam Try it now :-)

magsam commented 8 years ago

pity no change. This is the Snapshot /osretailPrime/target/osretail-0.1.0-SNAPSHOT/WEB-INF/lib/atmosphere-runtime-2.4.0-20151028.192414-58.jar

jfarcand commented 8 years ago

OK for me it works with the 'showase' project so I won't work anymore on this issue unless you send me a test that reproduce the issue. At last just use the workaround it should work. Thanks.

magsam commented 8 years ago

The bug is caused ChatResource.onOpen and it is know but no solution till now

INFO de.osretail.basis.ChatResource - OnOpen eventBus{}null
eventBus is null so we get nullpointer

thank you for your help

regrads from Bavaria

Peter

jfarcand commented 8 years ago

@magsam This sample works for me, so not sure what is the issue. Try to isolate a test case.

magsam commented 8 years ago

in the showcase ChatResource there is missing these codelines @Inject private EventBus eventBus; @Inject private RemoteEndpoint endpoint;

now it works