Issues with VaadinSession in JAVA 8

Hi,

I have used VaadinSession ( com.vaadin.server.VaadinSession ) in a lot of places in my code. It compiles and runs fine with Java 7 but I get a compile error with Java 8.

The error says :

“Cannot access javax.servlet.http.HttpSessionBindingListener. class file for javax.servlet.http.HttpSessionBindingListener not found.”

I tried inculding this dependency in the pom, but it did not work.

javax.servlet javax.servlet-api 3.0.1 provided

Please let me know how to fix this. Thanks!

Missing this class file shouldn’t be related to compiling in Java 8. Are you sure the dependency is not corrupt in your Maven cache or something like that?

The same code when I run with java 7 works all fine, compiles and runs fine. Its only when I switch to java 8, it complains.

If the servlet api jar is definitely not corrupted and the only thing you change in your project is maven.compiler.source and maven.compiler.target to be 1.8 instead of 1.7. Then I got nothing. Sorry :frowning:

Just in case, I fix this by adding:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>