Vaadin + Eclipse + Tomcat = Jetty Error

Hello All!

I am running an app in Eclipse on Tomcat 8 server. The app runs fine, but there’s a lot of errors thron into console:

WARNING: Failed to initialize Atmosphere for pl.com.msvc.idgapireader.IdgapireaderUI$Servlet. Push will not work.
java.lang.RuntimeException: Atmosphere init failed
[…]

Caused by: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/server/WebSocketServerFactory
[…]

Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/server/WebSocketServerFactory
[…]

Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory

etc. I’ve read somewhere, that it may be caused by jetty-related jars in my classpath, so I’ve removed them. My ivy.xml:

[code]

    <dependency org="com.vaadin" name="vaadin-client-compiled"
        rev="&vaadin.version;" >
            <exclude org="org.eclipse.jetty" name="*" />
        </dependency>

    <!-- Vaadin client side, needed for widget set compilation -->
    <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
         conf="widgetset-compile->default" >
            <exclude org="org.eclipse.jetty" name="*" />
        </dependency>

    <!-- Compiler for custom widget sets. Should not be deployed -->
    <dependency org="com.vaadin" name="vaadin-client-compiler"
        rev="&vaadin.version;" conf="widgetset-compile->default" >
            <exclude org="org.eclipse.jetty" name="*" />
        </dependency>

[/code]the jars have dissapeared from libraries, but the errors are thrown as usual.

Can anyone, please, help me out with this thing? If I run this app on Tomcat natively in production mode - the errors are in tomcat’s log as well…

I had the same errors when I updated my Vaadin from 7.5.8 to 7.6.4. I ended up adding this to the web.xml which seemed to fix it.

org.atmosphere.cpr.asyncSupport
org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket

https://github.com/Atmosphere/atmosphere/wiki/ClassNotFoundException-at-startup

Hello,

Thank you for the replay, however - that didn’t solve my problem :frowning: Maybe it’s cause by using Tomcat 8, not 7…?

Unfortunately I was using Tomcat 8 as well. I didn’t exclude jetty files though, and still had the original settings in ivy.

        <!-- The core server part of Vaadin -->
        <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;" />

        <!-- Vaadin themes -->
        <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;" />

        <!-- Push support -->
        <dependency org="com.vaadin" name="vaadin-push" rev="&vaadin.version;" />

        <!-- TestBench 4 -->
        <dependency org="com.vaadin" name="vaadin-testbench-api" rev="latest.release" conf="nodeploy -> default" />

        <!-- Precompiled DefaultWidgetSet -->
        <dependency org="com.vaadin" name="vaadin-client-compiled"
            rev="&vaadin.version;" />

        <!-- Vaadin client side, needed for widget set compilation -->
        <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
             conf="widgetset-compile->default" />

        <!-- Compiler for custom widget sets. Should not be deployed -->
        <dependency org="com.vaadin" name="vaadin-client-compiler"
            rev="&vaadin.version;" conf="widgetset-compile->default" />

Thanks Oliver for the information. I have excluded the jetty files. My Ivy.xml looks way different, so I’ll try yours tomorrow as I’ll get to my office.

I’ve programmed GWT for two years, now I have switched to Vaadin and it’s quite different approach. I need to learn a’lot yet :slight_smile:

Still no luck…

Maybe you can point me out, if I’ll pase my files:

web.xml

<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
  <display-name>IdgApiReader</display-name>
      <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>${productionMode}</param-value>
    </context-param>
    <servlet>
        <servlet-name>IdgapireaderUI</servlet-name>
        <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
        <init-param>
            <param-name>UI</param-name>
            <param-value>pl.com.msvc.idgapireader</param-value>
        </init-param>
        <init-param>
            <description>IdgapireaderWidgetset</description>
            <param-name>widgetset</param-name>
            <param-value>pl.com.msvc.idgapireader.widgetset.IdgapireaderWidgetset</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.cpr.asyncSupport</param-name>
            <param-value>org.atmosphere.container.*</param-value>
        </init-param>
        <init-param>
            <param-name>org.atmosphere.cpr.asyncSupport</param-name>
            <param-value>org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket</param-value>
        </init-param>
    </servlet>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>

</web-app>

ivy.xml

<?xml version="1.0"?>
<!DOCTYPE ivy-module [
    <!ENTITY vaadin.version "latest.release">
]>
<ivy-module version="2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="com.example" module="v7proj" />
    <configurations>
        <!-- The default configuration, which should be deployed to the server -->
        <conf name="default" />
        <!-- A configuration only needed when compiling the widget set. Should 
            not be deployed to the server -->
        <conf name="widgetset-compile" />
        <!-- A configuration used in compilation of server side classes only.
            Should be deployed to the server -->
        <conf name="nodeploy" />
    </configurations>
    <dependencies defaultconf="default" defaultconfmapping="default->default">
        
        <!-- The core server part of Vaadin -->
        <dependency org="com.vaadin" name="vaadin-server" rev="&vaadin.version;" />

        <!-- Vaadin themes -->
        <dependency org="com.vaadin" name="vaadin-themes" rev="&vaadin.version;" />

        <!-- Push support -->
        <dependency org="com.vaadin" name="vaadin-push" rev="&vaadin.version;" />
        
        <dependency org="com.google.guava" name="guava-collections" rev="r03"/>
           
           <dependency org="com.google.guava" name="guava" rev="18.0"/>

        <!-- Servlet 3.0 API -->
        <dependency org="javax.servlet" name="javax.servlet-api" rev="3.0.1" conf="nodeploy->default" />

        <!-- TestBench 4 -->
        <dependency org="com.vaadin" name="vaadin-testbench-api" rev="latest.release" conf="nodeploy -> default" />

        <!-- Precompiled DefaultWidgetSet -->
        <dependency org="com.vaadin" name="vaadin-client-compiled"
            rev="&vaadin.version;" />

        <!-- Vaadin client side, needed for widget set compilation -->
        <dependency org="com.vaadin" name="vaadin-client" rev="&vaadin.version;"
             conf="widgetset-compile->default" />

        <!-- Compiler for custom widget sets. Should not be deployed -->
        <dependency org="com.vaadin" name="vaadin-client-compiler"
            rev="&vaadin.version;" conf="widgetset-compile->default" />
            
            <dependency org="org.vaadin.addons" name="googleanalyticstracker" rev="2.1.0" />
            
            <dependency org="org.vaadin.teemu.jsoncontainer" name="JsonContainer" rev="0.1" />
            
            <dependency org="org.apache.httpcomponents" name="httpclient" rev="4.0-beta1"/>
            
            <dependency org="org.peimari" name="maddon" rev="1.21" />
            
            <dependency org="org.vaadin.addon" name="tableexport-for-vaadin" rev="1.5.1.5" />
            
            <dependency org="org.vaadin.addons" name="refresher" rev="1.2.3.7" />
            
            <dependency org="com.itextpdf" name="itextpdf" rev="5.1.1"/>
            
            <dependency org="org.apache.poi" name="poi" rev="3.8-beta2"/>
            
    </dependencies>
</ivy-module>

Errors:[code]
SEVERE: Failed to initialize Atmosphere Framework
java.lang.IllegalArgumentException: Unable to create org.atmosphere.container.*
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:250)
at org.atmosphere.cpr.AtmosphereFramework.doInitParams(AtmosphereFramework.java:1331)
at org.atmosphere.cpr.AtmosphereFramework.doInitParams(AtmosphereFramework.java:1306)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:859)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:780)
at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:219)
at com.vaadin.server.communication.JSR356WebsocketInitializer.initAtmosphereForVaadinServlet(JSR356WebsocketInitializer.java:152)
at com.vaadin.server.communication.JSR356WebsocketInitializer.contextInitialized(JSR356WebsocketInitializer.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.atmosphere.container.*
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:246)
… 16 more

mar 17, 2016 9:29:13 AM com.vaadin.server.communication.JSR356WebsocketInitializer contextInitialized
WARNING: Failed to initialize Atmosphere for IdgapireaderUI
java.lang.RuntimeException: Atmosphere init failed
at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:227)
at com.vaadin.server.communication.JSR356WebsocketInitializer.initAtmosphereForVaadinServlet(JSR356WebsocketInitializer.java:152)
at com.vaadin.server.communication.JSR356WebsocketInitializer.contextInitialized(JSR356WebsocketInitializer.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.servlet.ServletException: java.lang.IllegalArgumentException: Unable to create org.atmosphere.container.*
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:912)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:780)
at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:219)
… 11 more
Caused by: java.lang.IllegalArgumentException: Unable to create org.atmosphere.container.*
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:250)
at org.atmosphere.cpr.AtmosphereFramework.doInitParams(AtmosphereFramework.java:1331)
at org.atmosphere.cpr.AtmosphereFramework.doInitParams(AtmosphereFramework.java:1306)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:859)
… 13 more
Caused by: java.lang.ClassNotFoundException: org.atmosphere.container.*
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:246)
… 16 more

mar 17, 2016 9:29:13 AM org.atmosphere.cpr.AtmosphereFramework addAtmosphereHandler
INFO: Installed AtmosphereHandler com.vaadin.server.communication.PushAtmosphereHandler mapped to context-path: /*
mar 17, 2016 9:29:13 AM org.atmosphere.cpr.AtmosphereFramework addAtmosphereHandler
INFO: Installed the following AtmosphereInterceptor mapped to AtmosphereHandler com.vaadin.server.communication.PushAtmosphereHandler
mar 17, 2016 9:29:13 AM org.atmosphere.util.IOUtils readServiceFile
INFO: META-INF/services/org.atmosphere.cpr.AtmosphereFramework not found in class loader
mar 17, 2016 9:29:13 AM org.atmosphere.cpr.AtmosphereFramework autoConfigureService
INFO: Atmosphere is using org.atmosphere.util.VoidAnnotationProcessor for processing annotation
mar 17, 2016 9:29:13 AM org.atmosphere.cpr.AtmosphereFramework initWebSocket
INFO: Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol
mar 17, 2016 9:29:14 AM org.atmosphere.cpr.AtmosphereFramework init
SEVERE: Failed to initialize Atmosphere Framework
java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/server/WebSocketServerFactory
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:233)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolveWebSocket(DefaultAsyncSupportResolver.java:298)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolve(DefaultAsyncSupportResolver.java:284)
at org.atmosphere.cpr.AtmosphereFramework.autoDetectContainer(AtmosphereFramework.java:1870)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:888)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:780)
at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:219)
at com.vaadin.server.communication.JSR356WebsocketInitializer.initAtmosphereForVaadinServlet(JSR356WebsocketInitializer.java:152)
at com.vaadin.server.communication.JSR356WebsocketInitializer.contextInitialized(JSR356WebsocketInitializer.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)
… 22 more

mar 17, 2016 9:29:14 AM com.vaadin.server.communication.JSR356WebsocketInitializer contextInitialized
WARNING: Failed to initialize Atmosphere for pl.com.msvc.idgapireader.IdgapireaderUI$Servlet
java.lang.RuntimeException: Atmosphere init failed
at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:227)
at com.vaadin.server.communication.JSR356WebsocketInitializer.initAtmosphereForVaadinServlet(JSR356WebsocketInitializer.java:152)
at com.vaadin.server.communication.JSR356WebsocketInitializer.contextInitialized(JSR356WebsocketInitializer.java:118)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4812)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5255)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/server/WebSocketServerFactory
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:912)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:780)
at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:219)
… 11 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/server/WebSocketServerFactory
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getDeclaredConstructor(Unknown Source)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:233)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolveWebSocket(DefaultAsyncSupportResolver.java:298)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolve(DefaultAsyncSupportResolver.java:284)
at org.atmosphere.cpr.AtmosphereFramework.autoDetectContainer(AtmosphereFramework.java:1870)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:888)
… 13 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.server.WebSocketServerFactory
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1308)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1142)
… 22 more
[/code]
Maybe, I’m doing something wrong in here?
This is something that would suggest, that some dependencies are missing, but I completely don’t know how to resolve this:

SEVERE: Failed to initialize Atmosphere Framework
java.lang.IllegalArgumentException: Unable to create org.atmosphere.container.*

Yupi!!! I’ve finally solved the problem.

It turned out, that in my ivy library “nodeploy” - there were two jars “jetty-something” and I couldn’t get rid of them. They came in package org.seleniumhq.jetty7. So, what I did, was to remove everything from my ivy.xml and add each depedency one-by-one.

But… Even with ‘clean’ ivy.xml (by clean I mean default settings) I’ve had that problem. And than it hit me! if the package name was org.seleniumhq - that would point to some testing components. So I’ve commented out thest bench:

<!-- TestBench 4 --> <!--<dependency org="com.vaadin" name="vaadin-testbench-api" rev="latest.release" conf="nodeploy -> default"> <exclude org="org.seleniumhq.jetty7" name="*"/> </dependency>--> cleaned out all the caches and voila! jars has disappeared. Problem stopped existing.

By the way I’ve made some code clean up and now it runs as brand new :slight_smile:

Thank you Oliver for pointing me in the right direction :slight_smile: