Session Expired on Table Sort in most Browsers

Hey guys,

I’m kind off stuck here.
I have a small Vaadin app that puts Data from a Rest Client into a Table and that’s basically it.
The Servlet is annotated as follows:

@WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = MyVaadinUI.class, widgetset = "de.marrrschine.frontend.AppWidgetSet") public static class Servlet extends VaadinServlet { ... } I fill the Table in the init method with Long’s and String’s.

First of all … super easy stuff. Great Framework!

But here’s the fun part. The table is sortable and when I debug it in the Eclipse browser I can sort the Table with a click on the Columns.
Also in the real Environment I can do this with the Firefox Browser. But the IE, Chrome … no chance. As soon as I click on a Table Column: “Session Expired - Take note of …” Pop Up.

Im glad for any Input I can get.

Cheers,

Martin

Sorry … wrong information. It works on the tomcat on localhost when I deploy it through eclipse (In the eclipse “browser”, chrome and firefox).

But when I deploy the maven project it doesn’t. Neither in Firefox, nor in Chrome.

Hey, have you made sure that Tomcat doesn’t perform context auto reload? This has directly nothing to do with Vaadin except that context auto reload effectively expires the session. Of course if in your case session expires always when you sort the table, then there’s something else wrong. Typically “random” session expirations can be tackled by disabling the autoreloading feature.

See attach screenshot for autoreload in Tomcat configured through Eclipse’s WTP. You can also find it from the server.xml in Context tag reloadable attribute.
13532.png

Thanks for the input with the context reload. But like you said it’s not really helping in my case. Especially since the autoreloading is even enabled in the localhost and it works like a charm anyway…

Just not on the remote host. :*/

may it have anything to do with the scope of cookies? but the app runs on “…:8080/samename” … I gotta say I’m puzzled …

I can now say I have the same problem with the following minimal example from the vaadin demo:

package de.marrrschine.frontend;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.Theme;
import com.vaadin.annotations.VaadinServletConfiguration;
import com.vaadin.data.Item;
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.VaadinServlet;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@Theme("mytheme")
@SuppressWarnings("serial")
public class MyVaadinUI extends UI {

    @WebServlet(value = "/*", asyncSupported = true)
    @VaadinServletConfiguration(productionMode = true, ui = MyVaadinUI.class, widgetset = "de.marrrschine.frontend.AppWidgetSet")
    public static class Servlet extends VaadinServlet {

    }

    @Override
    protected void init(VaadinRequest request) {
        // Create the content root layout for the UI
        VerticalLayout content = new VerticalLayout();
        setContent(content);
        final Table table = new Table("Stars Example");

        // Define two columns for the built-in container
        table.addContainerProperty("Name", String.class, null);
        table.addContainerProperty("Mag", Float.class, null);

        // Add a row the hard way
        Object newItemId = table.addItem();
        Item row1 = table.getItem(newItemId);
        row1.getItemProperty("Name").setValue("Sirius");
        row1.getItemProperty("Mag").setValue(-1.46f);

        // Add a few other rows using shorthand addItem()
        table.addItem(new Object { "Canopus", -0.72f }, 2);
        table.addItem(new Object { "Arcturus", -0.04f }, 3);
        table.addItem(new Object { "Alpha Centauri", -0.01f }, 4);

        // Show 5 rows
        table.setPageLength(5);
        content.addComponent(table);
    }
}

By now the topic should really be called “Session Expired on tomcat server” … still grateful for all the help I can get.

What verison of Vaadin you are using? If 7.0 upgrade the same to the latest version 7.1.x
I actually faced an issue on similar lines and the same was resolved once I migrated to 7.1.10

Thanks,
Krishna.

I’m already on

<vaadin.version>7.1.13</vaadin.version>

Pls give me some time I will check the same on my Machine and come up with a Solution if any!

Pretty cool! Thanks!

Here’s my whole pom.xml … in case there’s something wrong here:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>de.marrrschine.frontend</groupId>
    <artifactId>vaadinfrontend</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>
    <name>Vaadin Web Application</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <vaadin.version>7.1.13</vaadin.version>
        <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
    </properties>
    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
        <repository>
            <id>vaadin-snapshots</id>
            <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>vaadin-snapshots</id>
            <url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <dependencies>
        <!-- My Dependencies -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
            <version>1.8</version>
        </dependency>
        <!-- End My Dep -->
        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <!-- Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory). 
            For widgetset compilation, vaadin-client-compiler is automatically added 
            on the compilation classpath by vaadin-maven-plugin so normally there is 
            no need for an explicit dependency. -->
        <!-- <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-client-compiler</artifactId> 
            <version>${vaadin.version}</version> <scope>provided</scope> </dependency> -->
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client</artifactId>
            <version>${vaadin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
            <version>${vaadin.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- My Dependencies -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <configuration>
                    <url>http://domainname:8080/manager/text</url>
                    <server>tomcat</server>
                    <path>/vaadinfrontend/</path>
                </configuration>
            </plugin>
            <!-- End My Dep -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <!-- As we are doing "inplace" GWT compilation, ensure the widgetset -->
            <!-- directory is cleaned properly -->
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/widgetsets</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>
                <configuration>
                    <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                    <!-- <runTarget>mobilemail</runTarget> -->
                    <!-- We are doing "inplace" but into subdir VAADIN/widgetsets. This 
                        way compatible with Vaadin eclipse plugin. -->
                    <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets
                    </webappDirectory>
                    <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets
                    </hostedWebapp>
                    <!-- Most Vaadin apps don't need this stuff, guide that to target -->
                    <persistentunitcachedir>${project.build.directory}</persistentunitcachedir>
                    <deploy>${project.build.directory}/gwt-deploy</deploy>
                    <!-- Compile report is not typically needed either, saves hunreds of 
                        mb disk -->
                    <compileReport>false</compileReport>
                    <noServer>true</noServer>
                    <!-- Remove draftCompile when project is ready -->
                    <draftCompile>false</draftCompile>

                    <style>OBF</style>
                    <strict>true</strict>
                    <runTarget>http://domainname:8080/</runTarget>
                </configuration>
                <executions>
                    <execution>
                        <configuration>
                            <!-- if you don't specify any modules, the plugin will find them -->
                            <!-- <modules> <module>com.vaadin.demo.mobilemail.gwt.ColorPickerWidgetSet</module> 
                                </modules> -->
                        </configuration>
                        <goals>
                            <goal>clean</goal>
                            <goal>resources</goal>
                            <goal>update-theme</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile-theme</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings 
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>com.vaadin</groupId>
                                        <artifactId>
                                            vaadin-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [7.1.13,)
                                        </versionRange>
                                        <goals>
                                            <goal>resources</goal>
                                            <goal>update-widgetset</goal>
                                            <goal>compile</goal>
                                            <goal>update-theme</goal>
                                            <goal>compile-theme</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore></ignore>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <configuration>
                        <wtpversion>2.0</wtpversion>
                        <additionalProjectnatures>
                            <projectnature>com.vaadin.integration.eclipse.widgetsetNature</projectnature>
                        </additionalProjectnatures>
                        <additionalBuildcommands>
                            <buildcommand>com.vaadin.integration.eclipse.widgetsetBuilder</buildcommand>
                            <buildcommand>com.vaadin.integration.eclipse.addonStylesBuilder</buildcommand>
                        </additionalBuildcommands>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

One thing I have in mind … I’m running the application on a tomcat on a virtual host. Maybe it has something to do with dynamic cpu and memory allocation?

Hello Martin,

I actually ran the code you shared, but I am not able to reproduce the issue.

Also, Pls correct the following statement from -

table.addItem(new Object { "Canopus", -0.72f }, 2); to

table.addItem(new Object []{ "Canopus", -0.72f }, 2);

If there Is anything that you are doing it with Session, pls share! Also, are you using any addon? Pls give me more details about your environment!

Thanks,
Krishna.

This is actually everything there is. eclipse project deployed by this pom file… the server is a virtual host at hosteurope.com

would you be willing to add a small app with a table on my tomcat? I would give you the adress and access data to my tomcat manager via private message. because if that works - we know it’s somewhere in my app.

As you said its on Cloud, Can you please share the url. I will check it has some thing to do with the config

Thanks

Hey Thanks for all the help! I don’t know what exactely but some dependency in my pom must have caused the bug. I regenerated the pom from an archetype and now it works like a charm.

Thanks again!