Vaadin Push: Failed to initialize Atmosphere Framework

I am using Karaf 4.1.2, vaadin 8.1.4, and pax-web 6.0.6, with following two dependencies:

<dependency>
    <groupId>com.vaadin.external.atmosphere</groupId>
    <artifactId>atmosphere-runtime</artifactId>
    <version>2.4.11.vaadin2</version>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-push</artifactId>
    <version>28.1.4</version>
</dependency>

and the configuration:

@Component(service = myUI.class, scope = ServiceScope.PROTOTYPE)
@Theme("custom")
@Push(value = PushMode.AUTOMATIC,
    //transport = Transport.LONG_POLLING,
    transport = Transport.WEBSOCKET)
public class myUI extends UI {

@Component(scope = ServiceScope.PROTOTYPE, service = VaadinServlet.class)
@WebServlet(urlPatterns = "/pushsample/*", name = "PushSampleServlet", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = VaadinPushUI.class)
public class VaadinPushServlet extends VaadinServlet {

However, it always failed to initialize the AtmosphereFramework:

2017-11-30T18:39:37,536 | ERROR | pipe-update 92   | AtmosphereFramework              | 84 - com.vaadin.external.org.slf4j - 1.6.1 | Failed to initialize Atmosphere Framework
java.util.ServiceConfigurationError: org.atmosphere.inject.Injectable: Provider org.atmosphere.inject.AtmosphereConfigInjectable not found
    at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]

    at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]

    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372) ~[?:?]

    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) ~[?:?]

    at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]

    at org.atmosphere.inject.InjectableObjectFactory.configure(InjectableObjectFactory.java:86) ~[82:com.vaadin.external.atmosphere.runtime:2.4.11.vaadin2]

    at org.atmosphere.cpr.AtmosphereFramework.lookupDefaultObjectFactoryType(AtmosphereFramework.java:1697) ~[82:com.vaadin.external.atmosphere.runtime:2.4.11.vaadin2]

    at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:880) [82:com.vaadin.external.atmosphere.runtime:2.4.11.vaadin2]

    at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:838) [82:com.vaadin.external.atmosphere.runtime:2.4.11.vaadin2]

    at com.vaadin.server.communication.PushRequestHandler.initAtmosphere(PushRequestHandler.java:216) [88:com.vaadin.server:8.1.4]

    at com.vaadin.server.communication.PushRequestHandler.<init>(PushRequestHandler.java:84) [88:com.vaadin.server:8.1.4]

    at com.vaadin.server.VaadinServletService.createRequestHandlers(VaadinServletService.java:53) [88:com.vaadin.server:8.1.4]

Anyone has the idea about this error???

the karaf log:

AtmosphereFramework     | 83 - com.vaadin.external.org.slf4j - 1.6.1 |
Installed AtmosphereHandler com.vaadin.server.communication.PushAtmosphereHandler mapped to context-path: /*
AtmosphereFramework     | 83 - com.vaadin.external.org.slf4j - 1.6.1 |
Installed the following AtmosphereInterceptor mapped to AtmosphereHandler com.vaadin.server.communication.PushAtmosphereHandler
AtmosphereFramework     | 83 - com.vaadin.external.org.slf4j - 1.6.1 |
Failed to initialize Atmosphere Framework
java.util.ServiceConfigurationError: org.atmosphere.inject.Injectable: Provider org.atmosphere.inject.AtmosphereConfigInjectable not found
    at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]

    at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]

    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372) ~[?:?]

    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) ~[?:?]

    at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]

Looks like you have a typo in the vaadin push artifact version

<dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-push</artifactId> <version>28.1.4</version> </dependency> the version should be 8.1.4, not
2
8.1.4. Also, why did you introduce a dependency to atmosphere-runtime? In normal Vaadin apps all you should need is

<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<version>${vaadin.version}</version>
</dependency>


https://vaadin.com/docs/framework/advanced/advanced-push.html

Thanks for your info. I update as your advice. Again it failed to initialize Atmosphere Framework, any idea why? is it because of pax-jetty, or something else?

Did you enable asynchrone mode in your app? I use
@EnableAsync
annotation in my Spring Boot (2.0.0.M6) main application class:

import org.springframework.scheduling.annotation.EnableAsync;

@EnableAsync
public class MyApplication {

}

but maybe you could use it on your UI class too.

Getting same error:

2018-03-15T12:19:52,794 | ERROR | nioEventLoopGroup-3-3 | AtmosphereFramework              | 212 - com.vaadin.external.org.slf4j - 1.6.1 | Failed to initialize Atmosphere Framework
java.util.ServiceConfigurationError: org.atmosphere.inject.Injectable: Provider org.atmosphere.inject.AtmosphereConfigInjectable not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239) ~[?:?]

        at java.util.ServiceLoader.access$300(ServiceLoader.java:185) ~[?:?]

        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372) ~[?:?]

        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) ~[?:?]

        at java.util.ServiceLoader$1.next(ServiceLoader.java:480) ~[?:?]

        at org.atmosphere.inject.InjectableObjectFactory.configure(InjectableObjectFactory.java:86) ~[210:com.vaadin.external.atmosphere.runtime:2.4.11.vaadin2]

Have you solved the problem?

@A V: it works for me. Could you give more information? Which appserver/container do you use? Which build tool do you use? Maven or Gradle, if the previous one what is your pom.xml dependencies? Do you use Spring Boot? After building your jar it contains the atmosphere-runtime-2.4.11.vaadin2.jar (for Spring Boot the location is [jar]
\BOOT-INF\lib\ ) or do you have it on the classpath at runtime?

@Károly Kótay-Szabó: it’s all similar to what OP provided.

In some ways, we have solved the issue. Don’t know is it really good solution.
Getting removed dependencies step by step we’ve found, that javax.inject was a problem.

After installing mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject/1_2 Athmosphere breaks.
Don’t know if it a requred bundle or it was added by our developers (I have legacy project), but without it all good.
So, we wrapped atmosphere-runtime-2.4.11.vaadin2 that it is not importing any javax.inject (we do it, because it’s already was optional)

Wrapped bundle looks like this:

wrap:mvn:com.vaadin.external.atmosphere/atmosphere-runtime/2.4.11.vaadin2$Import-Package=com.sun.enterprise.web.connector.grizzly.comet;resolution:=optional,com.sun.grizzly.comet;resolution:=optional;version="[1.9,2)",com.sun.grizzly.tcp;resolution:=optional;version="[1.9,2)",com.sun.grizzly.util.buf;resolution:=optional;version="[1.9,2)",com.sun.grizzly.websockets;resolution:=optional;version="[1.9,2)",com.vaadin.external.org.slf4j;version="[1.6,2)",javax.annotation,javax.enterprise.context;resolution:=optional,javax.enterprise.inject;resolution:=optional,javax.servlet;version="[2.5,4)",javax.servlet.annotation;version="[2.5,4)",javax.servlet.http;version="[2.5,4)",javax.websocket;resolution:=optional;version="[1.0,2)",javax.websocket.server;resolution:=optional;version="[1.0,2)",javax.xml.bind,javax.xml.parsers,org.apache.catalina;resolution:=optional;version="[6.0,9)",org.apache.catalina.comet;resolution:=optional;version="[6.0,9)",org.apache.catalina.connector;resolution:=optional;version="[6.0,9)",org.apache.catalina.util;resolution:=optional;version="[6.0,9)",org.apache.catalina.websocket;resolution:=optional;version="[6.0,9)",org.apache.commons.pool2;resolution:=optional;version="[2.3,3)",org.apache.commons.pool2.impl;resolution:=optional;version="[2.3,3)",org.apache.coyote.http11.upgrade;resolution:=optional,org.apache.shiro;resolution:=optional;version="[1.2,2)",org.apache.shiro.mgt;resolution:=optional;version="[1.2,2)",org.apache.shiro.subject;resolution:=optional;version="[1.2,2)",org.apache.shiro.web.env;resolution:=optional;version="[1.2,2)",org.apache.shiro.web.subject;resolution:=optional;version="[1.2,2)",org.apache.shiro.web.util;resolution:=optional;version="[1.2,2)",org.atmosphere.cache;version="[2.4,3)",org.atmosphere.client;version="[2.4,3)",org.atmosphere.config;version="[2.4,3)",org.atmosphere.config.managed;version="[2.4,3)",org.atmosphere.config.service;version="[2.4,3)",org.atmosphere.handler;version="[2.4,3)",org.atmosphere.interceptor;version="[2.4,3)",org.atmosphere.jboss.as.websockets;resolution:=optional,org.atmosphere.jboss.as.websockets.servlet;resolution:=optional,org.atmosphere.jboss.websockets;resolution:=optional,org.atmosphere.jboss.websockets.frame;resolution:=optional,org.atmosphere.util;version="[2.4,3)",org.eclipse.jetty.continuation;resolution:=optional;version="[7.6,10)",org.eclipse.jetty.websocket;resolution:=optional;version="[7.6,10)",org.eclipse.jetty.websocket.api;resolution:=optional;version="[9.3,10)",org.eclipse.jetty.websocket.server;resolution:=optional;version="[9.3,10)",org.eclipse.jetty.websocket.servlet;resolution:=optional;version="[9.3,10)",org.glassfish.grizzly;resolution:=optional;version="[2.3,3)",org.glassfish.grizzly.comet;resolution:=optional;version="[2.3,3)",org.glassfish.grizzly.http.server;resolution:=optional;version="[2.3,3)",org.glassfish.grizzly.websockets;resolution:=optional;version="[2.3,3)",org.jboss.servlet.http;resolution:=optional;version="[0.0,1)",org.jboss.vfs;resolution:=optional,org.mortbay.util.ajax;resolution:=optional;version="[6.1,7)",org.w3c.dom,org.xml.sax,weblogic.websocket;resolution:=optional,weblogic.websocket.annotation;resolution:=optional&amp;overwrite=merge