Vaadin 7, Atmosphere and Server Push problems
Asked Answered
K

4

6

I've started to build a project using the Maven archetype for Vaadin 7.2.4 and am getting a lot of errors thrown up relating to Atmosphere startup issues. As things stand, I won't be able to enable push support which I'd require to use an addon (OAuthButtonPopup). Although there's lots of general chat about Atmosphere, I can't seem to find anything specific to this issue so am wondering if there is an installation/configuration issue on my side, particularly as there seem to be attempts to instantiate some classes relating to Jetty which doesn't seem relevant to my installation.

Current setup as follows: Java 8 SDK, Java EE7 JDK, Idea IntelliJ 13, Vaadin 7.2.4 and Wildfly 8.

Any pointers would be much appreciated.

Error trace on deployment as follows:

[2014-07-17 10:21:10,394] Artifact OAuthPopupTest:war: Artifact is being deployed, please wait...
[0m22:21:10,540 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "OAuthPopupTest-1.0-SNAPSHOT.war" (runtime-name: "OAuthPopupTest-1.0-SNAPSHOT.war")
[0m[33m22:21:12,921 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015960: Class Path entry xml-apis.jar in /content/OAuthPopupTest-1.0-SNAPSHOT.war/WEB-INF/lib/serializer-2.7.1.jar  does not point to a valid jar for a Class-Path reference.
[0m[33m22:21:13,286 WARN  [org.jboss.as.ee] (MSC service thread 1-8) JBAS011006: Not installing optional component org.eclipse.jetty.continuation.Servlet3Continuation$1 due to an exception (enable DEBUG log level to see the cause)
[0m[33m22:21:13,287 WARN  [org.jboss.as.ee] (MSC service thread 1-8) JBAS011006: Not installing optional component org.eclipse.jetty.continuation.Servlet3Continuation$2 due to an exception (enable DEBUG log level to see the cause)
[0m[0m22:21:13,540 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017534: Registered web context: /OAuthPopupTest-1.0-SNAPSHOT
[0m[0m22:21:13,557 INFO  [org.jboss.as.server] (management-handler-thread - 2) JBAS018559: Deployed "OAuthPopupTest-1.0-SNAPSHOT.war" (runtime-name : "OAuthPopupTest-1.0-SNAPSHOT.war")
[0m[2014-07-17 10:21:13,578] Artifact OAuthPopupTest:war: Artifact is deployed successfully
[2014-07-17 10:21:13,579] Artifact OAuthPopupTest:war: Deploy took 3,185 milliseconds
[33m22:21:13,949 WARNING [com.vaadin.server.DefaultDeploymentConfiguration] (default task-1) 
=================================================================
Vaadin is running in DEBUG MODE.
Add productionMode=true to web.xml to disable debug features.
To show debug window, add ?debug to your application URL.
=================================================================
[0m[0m22:21:13,989 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-1) Installed AtmosphereHandler com.vaadin.server.communication.PushHandler$1 mapped to context-path: /*
[0m[0m22:21:13,990 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-1) Installed the following AtmosphereInterceptor mapped to AtmosphereHandler com.vaadin.server.communication.PushHandler$1
[0m[33m22:21:13,995 WARNING [org.atmosphere.cpr.AtmosphereFramework] (default task-1) SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead
[0m[0m22:21:14,003 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-1) Atmosphere is using org.atmosphere.cpr.DefaultAnnotationProcessor for processing annotation
[0m[0m22:21:14,003 INFO  [org.atmosphere.cpr.DefaultAnnotationProcessor] (default task-1) AnnotationProcessor class org.atmosphere.cpr.DefaultAnnotationProcessor$ServletContainerInitializerAnnotationProcessor being used
[0m[33m22:21:14,005 WARNING [org.atmosphere.cpr.DefaultAnnotationProcessor] (default task-1) Unable to detect annotations. Application may fail to deploy.
[0m[0m22:21:14,039 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-1) Auto detecting WebSocketHandler in /WEB-INF/classes/
[0m[0m22:21:14,047 INFO  [org.atmosphere.cpr.AtmosphereFramework] (default task-1) Installed WebSocketProtocol org.atmosphere.websocket.protocol.SimpleHttpProtocol 
[0m[31m22:21:14,054 SEVERE [org.atmosphere.cpr.DefaultAsyncSupportResolver] (default task-1) failed to create comet support class: class org.atmosphere.container.JettyServlet30AsyncSupportWithWebSocket, error: null
[0m[31m22:21:14,054 SEVERE [org.atmosphere.cpr.AtmosphereFramework] (default task-1) Failed to initialize Atmosphere Framework: java.lang.IllegalArgumentException: Unable to createclass org.atmosphere.container.JettyServlet30AsyncSupportWithWebSocket
    at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:229) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolveWebSocket(DefaultAsyncSupportResolver.java:288) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolve(DefaultAsyncSupportResolver.java:274) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    at org.atmosphere.cpr.AtmosphereFramework.autoDetectContainer(AtmosphereFramework.java:1591) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:717) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:614) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    at com.vaadin.server.communication.PushRequestHandler.<init>(PushRequestHandler.java:120) [vaadin-server-7.2.4.jar:7.2.4]
    at com.vaadin.server.VaadinServletService.createRequestHandlers(VaadinServletService.java:92) [vaadin-server-7.2.4.jar:7.2.4]
    at com.vaadin.server.VaadinService.init(VaadinService.java:180) [vaadin-server-7.2.4.jar:7.2.4]
    at com.vaadin.server.VaadinServlet.createServletService(VaadinServlet.java:190) [vaadin-server-7.2.4.jar:7.2.4]
    at com.vaadin.server.VaadinServlet.init(VaadinServlet.java:96) [vaadin-server-7.2.4.jar:7.2.4]
    at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:214) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:157) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727) [undertow-core-1.0.15.Final.jar:1.0.15.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_05]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_05]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_05]
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_05]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [rt.jar:1.8.0_05]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.8.0_05]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:408) [rt.jar:1.8.0_05]
    at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:225) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    ... 38 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/WebSocketFactory$Acceptor
    at org.atmosphere.container.JettyServlet30AsyncSupportWithWebSocket.<init>(JettyServlet30AsyncSupportWithWebSocket.java:46) [atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    ... 43 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.WebSocketFactory$Acceptor from [Module "deployment.OAuthPopupTest-1.0-SNAPSHOT.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
Kemppe answered 18/7, 2014 at 11:48 Comment(0)
L
2

For me it looks like there are libraries included in your war package that should not be packed. You might look into your war to see what jar dependencies are included. Maybe some parts of jetty. You could use

mvn dependency:tree

to see where they come from and exclude them if necessary.

And to enable push this wiki page describes all the required steps: https://vaadin.com/wiki/-/wiki/Main/Enabling%20server%20push

Lonna answered 21/7, 2014 at 10:45 Comment(1)
Hi Raffael - looks like you may well be right. There appears to be quite a few Jetty-related dependencies included in the build. Looking at the tree, it looks like this is related to changing a line in the archetype pom from "vaadin-compiled" to "vaadin-compiler" (required to get the the archetype to build and compile on first execution - myself and others have flagged this on the Vaadin forums before).I'll try reverting to the original plugin type and see if that resolves the issue.Kemppe
R
4

Following on the previous answers from rustproofFish and Raffael, I was able to fix the error by adding those exclusions:

   <groupId>com.vaadin</groupId>
   <artifactId>vaadin-client-compiler</artifactId>
   <version>${vaadin.version}</version>
   <exclusions>
        <exclusion>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlets</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-annotations</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-util</artifactId>
        </exclusion>
    </exclusions>
Rushing answered 22/12, 2014 at 3:47 Comment(0)
K
3

Thanks for the pointer Raffael - you were quite correct. There were Jetty dependencies included in the build as a result of changing one of the dependencies in the Vaadin 7.2.4 archetype from vaadin-client-compiled to vaadin-client-compiler in order to get the project to build and compile on first run (see posting on the Vaadin forums entitled GWT compiler error - Vaadin Charts using Maven and IntelliJ https://vaadin.com/forum#!/thread/4751650). The erroneous errors in the dependencies tree were as follows:

[INFO] uk.co.awardtech:OAuthPopupTest:war:1.0-SNAPSHOT
[INFO] +- com.vaadin:vaadin-server:jar:7.2.4:compile
[INFO] |  +- com.vaadin:vaadin-sass-compiler:jar:0.9.6:compile
[INFO] |  |  \- com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile
[INFO] |  +- com.vaadin:vaadin-shared:jar:7.2.4:compile
[INFO] |  |  +- com.vaadin.external.streamhtmlparser:streamhtmlparser-jsilver:jar:0.0.10.vaadin1:compile
[INFO] |  |  +- com.vaadin.external.google:guava:jar:16.0.1.vaadin1:compile
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:compile
[INFO] |  \- org.jsoup:jsoup:jar:1.6.3:compile
[INFO] +- com.vaadin:vaadin-client-compiler:jar:7.2.4:compile
[INFO] |  +- commons-collections:commons-collections:jar:3.1:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.1.3:compile
[INFO] |  +- ant:ant:jar:1.6.5:compile
[INFO] |  +- net.sourceforge.cssparser:cssparser:jar:0.9.11:compile
[INFO] |  +- ant:ant-launcher:jar:1.6.5:compile
[INFO] |  +- org.eclipse.jetty:jetty-annotations:jar:8.1.12.v20130726:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-plus:jar:8.1.12.v20130726:compile
[INFO] |  |  |  +- org.eclipse.jetty.orbit:javax.transaction:jar:1.1.1.v201105210645:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-jndi:jar:8.1.12.v20130726:compile
[INFO] |  |  |     +- org.eclipse.jetty:jetty-server:jar:8.1.12.v20130726:compile
[INFO] |  |  |     |  \- org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile
[INFO] |  |  |     \- org.eclipse.jetty.orbit:javax.mail.glassfish:jar:1.4.1.v201005082020:compile
[INFO] |  |  |        \- org.eclipse.jetty.orbit:javax.activation:jar:1.1.0.v201105071233:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-webapp:jar:8.1.12.v20130726:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-xml:jar:8.1.12.v20130726:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-servlet:jar:8.1.12.v20130726:compile
[INFO] |  |  |     \- org.eclipse.jetty:jetty-security:jar:8.1.12.v20130726:compile
[INFO] |  |  +- org.eclipse.jetty.orbit:javax.annotation:jar:1.1.0.v201108011116:compile
[INFO] |  |  \- org.eclipse.jetty.orbit:org.objectweb.asm:jar:3.1.0.v200803061910:compile
[INFO] |  +- org.eclipse.jetty:jetty-servlets:jar:8.1.12.v20130726:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-continuation:jar:8.1.12.v20130726:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-client:jar:8.1.12.v20130726:compile
[INFO] |  |     \- org.eclipse.jetty:jetty-http:jar:8.1.12.v20130726:compile
[INFO] |  |        \- org.eclipse.jetty:jetty-io:jar:8.1.12.v20130726:compile
[INFO] |  +- org.eclipse.jetty:jetty-util:jar:8.1.12.v20130726:compile

Changing the pom.xml entry back to vaadin-client-compiled, cleaning and rebuilding resolved the incorrect dependency; Atmosphere now starts without errors/warnings and push functionality appears to be present and correct based on my limited tests so far.

Kemppe answered 21/7, 2014 at 14:29 Comment(0)
L
2

For me it looks like there are libraries included in your war package that should not be packed. You might look into your war to see what jar dependencies are included. Maybe some parts of jetty. You could use

mvn dependency:tree

to see where they come from and exclude them if necessary.

And to enable push this wiki page describes all the required steps: https://vaadin.com/wiki/-/wiki/Main/Enabling%20server%20push

Lonna answered 21/7, 2014 at 10:45 Comment(1)
Hi Raffael - looks like you may well be right. There appears to be quite a few Jetty-related dependencies included in the build. Looking at the tree, it looks like this is related to changing a line in the archetype pom from "vaadin-compiled" to "vaadin-compiler" (required to get the the archetype to build and compile on first execution - myself and others have flagged this on the Vaadin forums before).I'll try reverting to the original plugin type and see if that resolves the issue.Kemppe
M
2

I had a similar error with Tomcat. I fixed the error by adding the following on my web.xml

    <init-param>
        <param-name>org.atmosphere.cpr.asyncSupport</param-name>
        <param-value>org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket</param-value>
    </init-param>

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

Matronly answered 15/3, 2016 at 22:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.