mojarra icon indicating copy to clipboard operation
mojarra copied to clipboard

Websocket PushContext not working anymore after application redeploy

Open zonia3000 opened this issue 7 years ago • 4 comments

Hi, I'm trying the new JSF features. I used this example on GlassFish 5 (build 25): https://github.com/hantsy/ee8-sandbox/tree/master/jsf-websocket

At the first deploy all is working fine, but if I undeploy the application and then redeploy it, the push messages are no longer sent. No exception is thrown during the call of the method push.send("msg"), however I noticed this exception during the reload:

TRACE:   WELD-001545: MethodHandler processing call to protected void com.sun.faces.push.WebsocketSessionManager.deregister(java.lang.Iterable) for class com.sun.faces.push.WebsocketSessionManager$Proxy$_$$_WeldClientProxy
ERROR:   WELD-000019: Error destroying an instance com.sun.faces.push.WebsocketChannelManager$ViewScope@57f59f4b of Managed Bean [class com.sun.faces.push.WebsocketChannelManager$ViewScope] with qualifiers [@Any @Default]
DEBUG:   Catching
org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke protected void com.sun.faces.push.WebsocketChannelManager$ViewScope.deregisterViewScope() on com.sun.faces.push.WebsocketChannelManager$ViewScope@57f59f4b
	at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:85)
	at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.preDestroy(DefaultLifecycleCallbackInvoker.java:76)
	at org.jboss.weld.injection.producer.BasicInjectionTarget.preDestroy(BasicInjectionTarget.java:127)
	at org.jboss.weld.bean.ManagedBean.destroy(ManagedBean.java:192)
	at com.sun.faces.application.view.ViewScopeContextManager.destroyBeans(ViewScopeContextManager.java:178)
	at com.sun.faces.application.view.ViewScopeContextManager.sessionDestroyed(ViewScopeContextManager.java:380)
	at com.sun.faces.application.view.ViewScopeManager.sessionDestroyed(ViewScopeManager.java:369)
	at com.sun.faces.application.WebappLifecycleListener.sessionDestroyed(WebappLifecycleListener.java:241)
	at com.sun.faces.config.ConfigureListener.sessionDestroyed(ConfigureListener.java:435)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:867)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:811)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:799)
	at org.apache.catalina.session.StandardManager.stop(StandardManager.java:896)
	at org.apache.catalina.core.StandardContext.stop(StandardContext.java:5817)
	at com.sun.enterprise.web.WebModule.stop(WebModule.java:569)
	at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1048)
	at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2197)
	at com.sun.enterprise.web.WebContainer.unloadWebModule(WebContainer.java:2152)
	at com.sun.enterprise.web.WebApplication.stop(WebApplication.java:158)
	at org.glassfish.internal.data.EngineRef.stop(EngineRef.java:161)
	at org.glassfish.internal.data.ModuleInfo.stop(ModuleInfo.java:324)
	at org.glassfish.internal.data.ApplicationInfo.stop(ApplicationInfo.java:380)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:1059)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.disable(ApplicationLifecycle.java:2127)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.disable(ApplicationLifecycle.java:113)
	at com.sun.enterprise.v3.server.ApplicationConfigListener.disableApplication(ApplicationConfigListener.java:311)
	at com.sun.enterprise.v3.server.ApplicationConfigListener.handleAppEnableChange(ApplicationConfigListener.java:208)
	at com.sun.enterprise.v3.server.ApplicationConfigListener.transactionCommited(ApplicationConfigListener.java:166)
	at org.jvnet.hk2.config.Transactions$TransactionListenerJob.process(Transactions.java:366)
	at org.jvnet.hk2.config.Transactions$TransactionListenerJob.process(Transactions.java:357)
	at org.jvnet.hk2.config.Transactions$ListenerNotifier$1.call(Transactions.java:214)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.jvnet.hk2.config.Transactions$Notifier$1$1.run(Transactions.java:168)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: 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:498)
	at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:83)
	... 37 more
Caused by: org.jboss.weld.contexts.ContextNotActiveException: WELD-001303: No active contexts for scope type javax.enterprise.context.ApplicationScoped
	at org.jboss.weld.manager.BeanManagerImpl.getContext(BeanManagerImpl.java:623)
	at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:89)
	at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.getIfExists(ContextualInstanceStrategy.java:123)
	at org.jboss.weld.bean.ContextualInstance.getIfExists(ContextualInstance.java:63)
	at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:87)
	at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:99)
	at com.sun.faces.push.WebsocketSessionManager$Proxy$_$$_WeldClientProxy.deregister(Unknown Source)
	at com.sun.faces.push.WebsocketChannelManager$ViewScope.deregisterViewScope(WebsocketChannelManager.java:213)
	... 42 more

I have to restart the server in order to have websockets working again.

zonia3000 avatar Apr 22 '18 20:04 zonia3000

Same here. Tested with WildFly 12 and Payara 5

mlarue avatar Apr 28 '18 21:04 mlarue

I also can confirm this behavior for [org.jboss.as] WFLYSRV0049: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001).

@BalusC I noticed you did the majority for the push integration. Do you have any clues on this?

Regards

DennisBayer avatar May 14 '19 08:05 DennisBayer

I also can confirm this behavior for [org.jboss.as] WFLYSRV0049: JBoss EAP 7.2.0.GA (WildFly Core 6.0.11.Final-redhat-00001).

@BalusC I noticed you did the majority for the push integration. Do you have any clues on this?

Regards

I guess it's better to post this issue on the new Mojarra github: https://github.com/eclipse-ee4j/mojarra

SirError avatar May 15 '19 19:05 SirError

I created a cross post in the new repository: https://github.com/eclipse-ee4j/mojarra/issues/4572

DennisBayer avatar May 16 '19 08:05 DennisBayer