Problem Vaadin 8.0.x / Eclipse / Jetty and @Push

HI,
we have some problems starting a Vaadin application with @Push in Eclipse with an embedded Jetty.

The application startup in Eclipse is fine, but as soon as we start a browser session we immediately receive a
“Session expired”

it
does not work
with Vaadin 8.0.3 or 8.0.4 and Jetty 9.4.x - no matter if we use the compatibility packages or the “core” Vaadin 8 packages
it
does work
with Vaadin 8.0.2 (or earlier versions) and Jetty 9.4.x
and it
does work
with Vaadin 8.0.3 or 8.0.4 and Jetty 9.3.x
(and of course it does work in a Tomcat environment)

is this somehow related with this two issues ?
Problem with Atmosphere → Session Expired
https://github.com/vaadin/framework/issues/8134
https://github.com/Atmosphere/atmosphere/issues/2241

and what can we do ?

Regards
Gerhard

Hi Gerhard,

i had the same problem on Wildfly 10.1.0.Final version.
With and without @PUSH.

i had to set the session-cookie support.

this entry was missed completely. maybe your Jetty needs an equivalent of that?

Good luck on it :slight_smile:

Best regards

Hi!

Hmmm I’m not sure if that one is the same issue like in our case.
Jetty and atmosphere have according to google a bit of a history.

In Vaadin 8.0.3 there has been an update of the atmosphere framework
https://github.com/vaadin/framework/commit/0f08e30f6e735716f6bb4135c22103c2b65911aa
which might be a clou to our Jetty problem.
<atmosphere.runtime.version>2.4.5.vaadin2</atmosphere.runtime.version>

If we use Jetty 9.4.x + Vaadin 8.0.3/8.0.4 and activate the @PUSH annotation we are recieving “Session expired” as soon as we open the website.

If we remove the @PUSH everything seems fine.

@Rhonibaer: You explained that even without the @PUSH annotation Vaadin was not working?

Using Jetty 9.4.x + Vaadin 8.0.2 + @PUSH works fine
Using Jetty 9.3.x + Vaadin 8.0.3/8.0.4 + @PUSH works fine

Servlet:

@SuppressWarnings(“serial”)
@WebServlet(
urlPatterns = {
“/app/",
"/VAADIN/
” },
asyncSupported = true)
@VaadinServletConfiguration(
productionMode = false,
closeIdleSessions = true,
heartbeatInterval = 300,
ui = MyUI.class)



@Theme(“my_valo”)
@SuppressWarnings(“serial”)
@PreserveOnRefresh
@Push(
value = PushMode.AUTOMATIC,
transport = Transport.WEBSOCKET)
// transport = Transport.WEBSOCKET_XHR)
public class MyUI extends UI

We tested WEBSOCKET and WEBSOCKET_XHR without any luck using Jetty 9.4.x + Vaadin 8.0.3/8.0.4 + @PUSH

Cheers
Andy

i had that issue with @PUSH and without @push … but when reading your posting, i think it is not the same issue as mine was.

any comments from Vaadin concerning this problem ?

since the problem occurs when switching from Vaadin 7.x/Vaadin 8.0.2 to Vaadin 8.0.3/Vaadin 8.0.4 perhaps it has something to do with the changes in these releases …
we are still faced with this problem

Regards
Gerhard

we are still facing with this proplem in Vaadin 8.0.5 …

I run the same problem enabling @Push with jetty 9.4.3 atmosphere-runtime-2.4.5.vaadin2.jar and vaadin 8.0.5
Substituting atmosphere-runtime-2.4.5.vaadin2.jar with atmosphere-runtime-2.2.7.vaadin1.jar eliminates the session expired message and shows the UI correctly, BUT there are incompatibility problems and push will not work:
java.lang.NoClassDefFoundError: org/atmosphere/cpr/AtmosphereRequestImpl

Is this only a jetty issue? Can Vaadin revert back to the earlier atmosphere and resolve the compatibility isses?

In the meantime, I cannot upgrade to Vaadin 8.0.5

Nice to know, that we are not the only ones to encounter this problem :slight_smile:

Tomcat seems to work fine, but we are using jetty in our development process, so this issue is a blocker for us as well :frowning:

Today we did a test using jetty-9.4.4.v20170414 but sadly we encounter the same error.

The atmosphere-runtime problem still persists using Jetty 9.4.4

Maybe you need to go to github.com Vaadin issues to get more attention?
There is at least these there, so you are not alone:
https://github.com/vaadin/framework/issues/8134
https://github.com/vaadin/framework/issues/8734

There is a new OPEN ticket in the vaadin framework github:



https://github.com/vaadin/framework/issues/9127

Hi,
it seem’s that I have the same problem as described here.
I switched to latest Vaadin-Version 8.0.5 and latest jetty-Version 9.4.4. and the session timed out. (We have activated PUSH-Technology)
After switching back to jetty-Version 9.3. everything is working fine.

Will this bug be fixed in the near future ?
Best regards, Roland

Apparently Atmosphere must be updated to be compatible with Jetty 9.4.x, so this not purely Vaadin issue.
Maybe you want to push this issue:
https://github.com/Atmosphere/atmosphere/issues/2241

G’Day

Jetty released a new version 9.4.5.v20170502
https://github.com/eclipse/jetty.project/releases/tag/jetty-9.4.5.v20170502

But the issue still persists with Jetty 9.4.5 using Vaadin 8.0.5

Hopefully atmosphere will be adapted soon to play nice with Jetty 9.4.x
Are there any plans for Vaadin to switch back to a previous version of atmosphere which works with Jetty 9.4.x in the meantime?

Hi,
seems to be fixed with Vaadin 8.1.0 beta
Regards
​Gerhard

Hello. Trying to migrate from 7.7.10 to 8.0.* or 8.1.*
In Maven:
<vaadin.version>8.1.0.rc2</vaadin.version>
<jetty.version>9.4.2.v20170220</jetty.version>

@Push(value = PushMode.AUTOMATIC, transport = Transport.LONG_POLLING)
public class VaadinUI extends UI …

@WebServlet(value = “/*”, asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = ReceiveOrderVaadinUI.class)
public static class Servlet extends VaadinServlet …

PUSH doesn’t work.
In logs:
java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/WebSocketFactory$Acceptor
at org.atmosphere.container.JettyServlet30AsyncSupportWithWebSocket.(JettyServlet30AsyncSupportWithWebSocket.java:46)

How can i fix it?

Hi Alex,
the following worked for me-

import com.vaadin.annotations.Push;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.websocket.jsr356.server.ServerContainer;
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;

@Push
public final class MyUI extends UI
{

private void startJetty()
{
final WebAppContext webAppContext = new WebAppContext(“.”, “/”);
webAppContext.setWar(WEBROOT_DIR);
webAppContext.setClassLoader(VaadinLab.class.getClassLoader());
webAppContext.setThrowUnavailableOnStartupException(true);
webAppContext.setDescriptor(WEB_APP_CONTEXT_DESCRIPTOR_FILE);

    Server jettyServer = new Server();
    ServerConnector connector = new ServerConnector(jettyServer);
    connector.setPort(WEB_SERVER_PORT_NUM);
    jettyServer.setConnectors(new Connector[] {connector});
    jettyServer.setHandler(webAppContext);
    Handler jettyServerHandler = jettyServer.getHandler();
    try
    {
        ServerContainer sc =
            WebSocketServerContainerInitializer.configureContext(
            (ServletContextHandler) jettyServerHandler);
    }
    catch (ServletException se) { System.out.println(se.toString()); }

    ...

    try { jettyServer.start(); }
    catch (Exception ex)
    {
        System.err.println("ERROR: Failed to start Jetty web server.");
        ex.printStackTrace();
    }
}

}

import com.vaadin.server.VaadinServlet;
import com.vaadin.server.VaadinServletService;

public class MyServlet extends VaadinServlet
{
final VaadinServletService vaadinServletService = getService();
boolean isPushAvailable = vaadinServletService.ensurePushAvailable();

...

}

In Vaadin web application descriptor file:


pushmode
automatic

true

This didn’t work in my case.

Versions:
Vaadin 8.1.5
Jetty 9.4.7.v20170914

I receive this in logs:
окт 04, 2017 2:59:58 PM com.vaadin.server.communication.PushHandler connectionLost
SEVERE: Could not get resource. This should never happen.
окт 04, 2017 2:59:58 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource ee879653-784d-4e6f-982e-52a2cf16aefd. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

Hmm. Looks like that problem happens somewhere in code inside UI.access()

Here is my access() method:

        UI().access(new Runnable() {
            @Override
            public void run() {
                // Some logic with making changes in UI component, updates Label, for example
                UI().push();
            }
        });

If i comment access() method body, then it works fine, but if it is active - errors occured:
окт 05, 2017 12:22:52 PM com.vaadin.server.communication.PushHandler connectionLost
SEVERE: Could not get resource. This should never happen.
окт 05, 2017 12:22:52 PM org.atmosphere.cpr.DefaultBroadcaster addAtmosphereResource
WARNING: Duplicate resource 261820c3-1aa3-4c56-92d1-8c4f9697c94b. Could be caused by a dead connection not detected by your server. Replacing the old one with the fresh one

What i doing wrong?
In Vaadin 7.. there was no problems.