NoClassDefFoundError (HttpSessionIdListener) when launching SDM, after switching from gwt-2.8.0-beta1 to rc2

2,991 views
Skip to first unread message

Boris Brudnoy

unread,
Aug 15, 2016, 10:47:57 AM8/15/16
to GWT Users

Hello all,


After switching GWT version from '2.8.0-beta1' to '2.8.0-rc2' in my Maven project's pom.xml, launching code server by running `gwt:codeserver` started to fail:


[ERROR] Failed to execute goal net.ltgt.gwt.maven:gwt-maven-plugin:1.0-rc-4:codeserver (default-cli)


With this stack trace preceding the error:


[INFO]    Module setup completed in 7362 ms

[WARNING] java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionIdListener

[WARNING] at org.eclipse.jetty.server.session.SessionHandler.<clinit>(SessionHandler.java:54)

[WARNING] at org.eclipse.jetty.servlet.ServletContextHandler.newSessionHandler(ServletContextHandler.java:241)

[WARNING] at org.eclipse.jetty.servlet.ServletContextHandler.getSessionHandler(ServletContextHandler.java:334)

[WARNING] at org.eclipse.jetty.servlet.ServletContextHandler.relinkHandlers(ServletContextHandler.java:180)

[WARNING] at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:157)

[WARNING] at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:117)

[WARNING] at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:105)

[WARNING] at com.google.gwt.dev.codeserver.WebServer.start(WebServer.java:129)

[WARNING] at com.google.gwt.dev.codeserver.CodeServer.start(CodeServer.java:161)

[WARNING] at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:102)

[WARNING] at com.google.gwt.dev.codeserver.CodeServer.main(CodeServer.java:55)

[WARNING] Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSessionIdListener

[WARNING] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

[WARNING] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

[WARNING] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)

[WARNING] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

[WARNING] ... 11 more


I'm guessing it's to do with the version of the Servlet API being depended on somewhere but so far my attempts to add/substitute/exclude dependencies led nowhere.


Thanks,


Boris

Jens

unread,
Aug 15, 2016, 11:51:00 AM8/15/16
to GWT Users
GWT uses Jetty 9 so it expects servlet-api 3.1. If your project depends on a different version you need to fix that, so look at your dependency tree to see where it comes from.

mvn dependency:tree -Dverbose -Dincludes=javax.servlet:servlet-api,javax.servlet:javax.servlet-api

I hope the include pattern is correct, otherwise just omit it.

-- J.

Boris Brudnoy

unread,
Aug 16, 2016, 11:27:08 AM8/16/16
to GWT Users
Grepcode is telling me that javax.servlet.http.HttpSessionIdListener exists only since javax.servlet-api 3.1, however the dependency:tree command suggests that GWT 2.8 RC2 uses 3.0.1 (I don't undertand the "version managed from 3.1.0" part, though): 

[INFO] +- com.google.gwt:gwt-user:jar:2.8.0-rc2:compile
[INFO] |  \- javax.servlet:javax.servlet-api:jar:3.0.1:provided (version managed from 3.1.0; scope managed from compile)

(I replaced the only reference to Servlets API 2.5 in my project, first with 3.0.1 and then with 3.1, but to no avail)

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
--
BORIS BRUDNOY
Web Application Developer, Java/GWT Enthusiast (LinkedIn)

Thomas Broyer

unread,
Aug 16, 2016, 4:45:50 PM8/16/16
to GWT Users
"version managed from 3.1.0" means that gwt-user depends on 3.1.0 but your dependency tree somehow "manages" the version to be 3.0.1. This (I believe) means you have 3.0.1 somewhere in your dependencyManagement.

Boris Brudnoy

unread,
Aug 16, 2016, 5:38:05 PM8/16/16
to GWT Users
The addition of the morsel about "managed from 3.1.0" pivoted me into looking in the dependencyManagement section of the parent project, and there it was, the declaration I somehow glossed over:

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

Removing it resolved the problem. Thanks Jens and Thomas!

On Tue, Aug 16, 2016 at 4:46 PM Thomas Broyer <t.br...@gmail.com> wrote:
"version managed from 3.1.0" means that gwt-user depends on 3.1.0 but your dependency tree somehow "manages" the version to be 3.0.1. This (I believe) means you have 3.0.1 somewhere in your dependencyManagement.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

N Troncoso

unread,
Oct 3, 2016, 9:22:48 AM10/3/16
to GWT Users

I'm having the same issue as Boris, except my dependency tree shows that I'm using 3.1:

[INFO] +- com.google.gwt:gwt-user:jar:2.8.0-rc2:compile
[INFO] |  \- javax.servlet:javax.servlet-api:jar:3.1.0:provided (scope managed from compile)
[INFO] \- com.google.gwt:gwt-dev:jar:2.8.0-rc2:compile
[INFO]    \- org.eclipse.jetty:apache-jsp:jar:9.2.14.v20151106:compile
[INFO]       +- org.eclipse.jetty:jetty-server:jar:9.2.14.v20151106:compile
[INFO]       |  \- (javax.servlet:javax.servlet-api:jar:3.1.0:provided - scope managed from compile; omitted for duplicate)
[INFO]       \- (javax.servlet:javax.servlet-api:jar:3.1.0:provided - scope managed from compile; omitted for duplicate)

The only place this is specified is in the parent pom:


    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt</artifactId>
                <version>2.8.0-rc2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.1.0</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

I get the exact same error that he posted when trying to run the codeserver. The only difference is that he's using gwt-maven-plugin:1.0-rc-4 and I'm using gwt-maven-plugin:1.0-rc-6

N Troncoso

unread,
Oct 5, 2016, 8:13:26 AM10/5/16
to GWT Users
For anyone with the same issue as me, I had to remove the <scope>provided</scope> in the dependency management for javax.servlet

Thomas Broyer

unread,
Oct 5, 2016, 8:22:53 AM10/5/16
to GWT Users
Or maybe adjust the classpathScope to include provided dependencies? http://tbroyer.github.io/gwt-maven-plugin/devmode-mojo.html#classpathScopehttp://tbroyer.github.io/gwt-maven-plugin/codeserver-mojo.html#classpathScope
(see also the samples from the GWT SDK, or the POM generated by webAppCreator)
Reply all
Reply to author
Forward
0 new messages