Vaadin 8 OSGi push

Hello everyone,
I’m writing to you with a request about Vaadin 8 framework and Equinox OSGi.
I have tried to make a simple Vaadin application without any Maven dependencies in Eclipse.
(https://github.com/sirreaver/vaadin.test)
I have downloaded Vaadin 8.8.2 with Jetty 9.4.18.v20190429 (also tried with 9.3.24).

I have 4 classes (this was taken from lunifera example which Vaadin also use in its part of documentation:
https://github.com/lunifera/lunifera-vaadin-examples/tree/master/org.lunifera.example.vaadin.osgi

Problem starts, when I try to use Push. With settings:
@Push(value = PushMode.AUTOMATIC, transport = Transport.WEBSOCKET)
and over servlet class
@WebServlet(asyncSupported = true)
session expires immediately.

I know that in this forum is quite a lot of topics to this but setting LONG.POLLING is not a solution for me.
When I tried to run Vaadin application with Maven I can see that Atmosphere container is set to JSR356AsyncSupport. But in my case was set to Jetty9AsyncSupportWithWebSocket.

After some googling and also on Jetty official site there is written which bundles I should use to activate Servlet 3.0+ So I have tried to use them but then I got problem with:
Real error: Unable to configure jsr356 at that stage. ServerContainer is null";;"Exception: java.lang.IllegalStateException: Unable to configure jsr356 at that stage. ServerContainer is null.

My question is if somebody could be so nice and revise little bit my project settings in Eclipse with Equinox? From what I have found it may be some dependency on start level of bundles or even used ServiceComponent class from lunifera should not be used anymore and used some different way?

Here is list of activated bundles:
(I bet I do not need some of them, but I was trying some combinations to make JSR container available)

Framework is launched. id State Bundle 0 ACTIVE org.eclipse.osgi_3.13.200.v20181130-2106 1 ACTIVE org.jsoup_1.11.2 2 ACTIVE com.vaadin.server_8.8.2 3 ACTIVE org.eclipse.jetty.http_9.4.18.v20190429 4 ACTIVE com.vaadin.external.org.slf4j_1.6.1 5 ACTIVE org.eclipse.jetty.websocket.servlet_9.4.18.v20190429 6 ACTIVE org.apache.felix.scr_2.1.6 7 ACTIVE org.eclipse.jetty.websocket.api_9.4.18.v20190429 8 ACTIVE org.eclipse.equinox.http.servletbridge_1.1.100.v20180827-1235 10 ACTIVE json_20180813.0.0 11 ACTIVE org.eclipse.jetty.security_9.4.18.v20190429 12 ACTIVE com.vaadin.external.atmosphere.runtime_2.4.30.vaadin1 13 ACTIVE com.vaadin.push_8.8.2 14 ACTIVE org.eclipse.equinox.console_1.3.200.v20181115-0906 15 ACTIVE org.apache.felix.gogo.command_1.0.2.v20170914-1324 16 ACTIVE org.eclipse.osgi.services_3.8.0.v20190206-2147 17 ACTIVE javax.servlet-api_3.1.0 18 ACTIVE org.apache.felix.gogo.runtime_1.1.0.v20180713-1646 19 ACTIVE ch.qos.logback.classic_1.0.7.v20121108-1250 20 ACTIVE org.eclipse.jetty.server_9.4.18.v20190429 21 ACTIVE org.eclipse.equinox.http.servlet_1.6.0.v20190305-2225 22 ACTIVE com.vaadin.compatibility-themes_8.8.2 25 ACTIVE org.eclipse.equinox.cm_3.2.0.v20070116 26 ACTIVE org.eclipse.equinox.ds_1.6.0.v20190122-0806 27 ACTIVE com.vaadin.external.gentyref_1.2.0.vaadin1 29 ACTIVE com.vaadin.shared_8.8.2 31 ACTIVE org.eclipse.equinox.preferences_3.7.200.v20180827-1235 32 ACTIVE org.eclipse.jetty.websocket.common_9.4.18.v20190429 33 ACTIVE org.eclipse.jetty.util_9.4.18.v20190429 34 ACTIVE ch.qos.logback.core_1.0.7.v20121108-1250 36 ACTIVE org.apache.aries.spifly.dynamic.bundle_1.2.1 38 ACTIVE org.eclipse.jetty.websocket.server_9.4.18.v20190429 39 ACTIVE com.vaadin.client-compiled_8.8.2 40 ACTIVE org.eclipse.equinox.common_3.10.200.v20181021-1645 41 ACTIVE org.slf4j.api_1.7.2.v20121108-1250 42 ACTIVE org.apache.felix.gogo.shell_1.1.0.v20180713-1646 43 ACTIVE org.eclipse.equinox.servletbridge_1.4.200.v20181008-1820 44 ACTIVE org.eclipse.jetty.io_9.4.18.v20190429 45 ACTIVE org.eclipse.jetty.servlet_9.4.18.v20190429 46 ACTIVE org.eclipse.equinox.util_1.1.200.v20181008-1820 47 ACTIVE org.eclipse.equinox.http.jetty_3.7.0.v20190305-2216 50 ACTIVE org.osgi.framework_1.9.0.201802012106 55 ACTIVE org.osgi.service.http_3.5.0.LIFERAY-PATCHED-2 58 ACTIVE org.eclipse.jetty.websocket.client_9.4.18.v20190429 59 ACTIVE org.eclipse.jetty.websocket.javax.websocket.server_9.4.18.v20190429 60 ACTIVE org.eclipse.jetty.client_9.4.18.v20190429 61 ACTIVE org.eclipse.jetty.websocket.javax.websocket_9.4.18.v20190429 63 ACTIVE org.eclipse.jetty.xml_9.4.18.v20190429 64 ACTIVE javax.websocket-api_1.1.0 65 ACTIVE org.objectweb.asm.tree.analysis_7.0.0 69 ACTIVE org.objectweb.asm_7.0.0 70 ACTIVE org.objectweb.asm.commons_7.0.0 71 ACTIVE org.objectweb.asm.tree_7.0.0 76 ACTIVE org.objectweb.asm.util_7.0.0 79 ACTIVE org.eclipse.equinox.event_1.5.0.v20181008-1938 81 ACTIVE org.eclipse.jetty.continuation_9.4.18.v20190429 83 ACTIVE javax.annotation-api_1.3.0 84 ACTIVE javax.el-api_3.0.0 85 ACTIVE org.eclipse.jetty.annotations_9.4.18.v20190429 86 ACTIVE javax.interceptor-api_1.2.0 88 ACTIVE org.eclipse.jetty.jndi_9.4.18.v20190429 89 ACTIVE javax.enterprise.cdi-api_1.2.0 90 ACTIVE org.eclipse.jetty.webapp_9.4.18.v20190429 91 ACTIVE org.eclipse.jetty.plus_9.4.18.v20190429 92 ACTIVE org.apache.geronimo.specs.geronimo-jta_1.1_spec_1.1.1 98 ACTIVE javax.transaction-api_1.3.0 99 ACTIVE javax.inject_1.0.0.v20091030 102 ACTIVE vaadin.osgi.test_1.0.0.qualifier

Thank you very much

17745792.png

Hello everyone,
I prepared dummy example for our situation. To reproduce this problem, you can only open workspace in Eclipse, reload target platform (file: push.target) and run by push.launcher

Actual state is:
Push is working over XHR because during initialization of Atmosphere lib exception appear. During first webpage load are cast some NullPointer exceptions. Push is working but over XHR and not by websocket.
Full example link: https://github.com/kalistoking/bug_examples/tree/master/com.engel.push

This is my exception witch I get after Atmosphere is loading:
Jun 28, 2019 4:11:11 PM org.atmosphere.container.Jetty9AsyncSupportWithWebSocket
SEVERE:
java.lang.IllegalStateException: Unable to find required ServletContext attribute: org.eclipse.jetty.util.DecoratedObjectFactory
at org.eclipse.jetty.websocket.server.WebSocketServerFactory.doStart(WebSocketServerFactory.java:313)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.atmosphere.container.Jetty9AsyncSupportWithWebSocket.(Jetty9AsyncSupportWithWebSocket.java:54)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:237)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolveWebSocket(DefaultAsyncSupportResolver.java:308)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolve(DefaultAsyncSupportResolver.java:294)
at org.atmosphere.cpr.AtmosphereFramework.autoDetectContainer(AtmosphereFramework.java:2092)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:914)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838)
at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:206)
at …

and NullPointer by Web loading:
Jun 28, 2019 5:11:02 PM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE:
java.lang.NullPointerException
at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:225)
at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:194)
at org.atmosphere.container.Jetty9AsyncSupportWithWebSocket$1.acceptWebSocket(Jetty9AsyncSupportWithWebSocket.java:49)
at org.atmosphere.container.AbstractJetty9AsyncSupportWithWebSocket.service(AbstractJetty9AsyncSupportWithWebSocket.java:166)
at org.atmosphere.container.Jetty9AsyncSupportWithWebSocket.service(Jetty9AsyncSupportWithWebSocket.java:35)
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2297)
at com.vaadin.server.communication.PushRequestHandler.handleRequest(PushRequestHandler.java:234)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1602)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:445)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl$LegacyServlet.service(HttpServiceRuntimeImpl.java:1232)
at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153)
at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:63)
at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:98)
at org.eclipse.equinox.http.servlet.internal.HttpServiceRuntimeImpl.doDispatch(HttpServiceRuntimeImpl.java:372)
at org.eclipse.equinox.http.servlet.internal.servlet.ProxyServlet.service(ProxyServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

Thanks, for any help with project configuration.

Vit