Tomcat 为Spring启动的Vaadin应用程序启用服务器推送功能不起作用

Tomcat 为Spring启动的Vaadin应用程序启用服务器推送功能不起作用,tomcat,servlets,spring-boot,vaadin7,server-push,Tomcat,Servlets,Spring Boot,Vaadin7,Server Push,在我们当前的项目中,我们希望在Spring引导的Vaadin应用程序中使用服务器推送 我们遵循wiki文章中的说明(将vaadin push依赖项添加到pom.xml,将@push注释添加到out UI类,未在web.xml文件中设置支持的异步,因为在本例中不存在该文件),并收到以下错误消息: 2014-06-17 14:32:43,340 [http-nio-8080-exec-3] WARN org.atmosphere.cpr.AtmosphereFramework - SessionS

在我们当前的项目中,我们希望在Spring引导的Vaadin应用程序中使用服务器推送

我们遵循wiki文章中的说明(将vaadin push依赖项添加到pom.xml,将@push注释添加到out UI类,未在web.xml文件中设置支持的异步,因为在本例中不存在该文件),并收到以下错误消息:

2014-06-17 14:32:43,340 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.AtmosphereFramework - SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead
2014-06-17 14:32:44,981 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.DefaultAsyncSupportResolver - Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport,  until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport
2014-06-17 14:32:45,001 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7CometSupport, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar Is the NIO or APR Connector enabled?
2014-06-17 14:32:45,005 [http-nio-8080-exec-3] ERROR org.atmosphere.cpr.AtmosphereFramework - If you have more than one Connector enabled, make sure they both use the same protocol, e.g NIO/APR or HTTP for all. If not, org.atmosphere.container.BlockingIOCometSupport will be used and cannot be changed.
java.lang.IllegalStateException: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar
    at org.atmosphere.container.Tomcat7CometSupport.<clinit>(Tomcat7CometSupport.java:56) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
2014-06-17 14:32:45,006 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.BlockingIOCometSupport

2014-06-17 14:32:58,684 [http-nio-8080-exec-1] ERROR com.vaadin.server.DefaultErrorHandler - 
java.lang.IllegalStateException: Cannot suspend a response longer than the session timeout. Increase the value of session-timeout in web.xml
    at org.atmosphere.cpr.AtmosphereResourceImpl.suspend(AtmosphereResourceImpl.java:314) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
2014-06-17 14:33:52,928 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead
2014-06-17 14:33:54,557 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.DefaultAsyncSupportResolver - Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport,  until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport
2014-06-17 14:33:54,577 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7CometSupport, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar Is the NIO or APR Connector enabled?
2014-06-17 14:33:54,581 [http-nio-8080-exec-1] ERROR org.atmosphere.cpr.AtmosphereFramework - If you have more than one Connector enabled, make sure they both use the same protocol, e.g NIO/APR or HTTP for all. If not, org.atmosphere.container.BlockingIOCometSupport will be used and cannot be changed.
java.lang.IllegalStateException: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar
    at org.atmosphere.container.Tomcat7CometSupport.<clinit>(Tomcat7CometSupport.java:56) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
   (...)
2014-06-17 14:33:54,582 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.BlockingIOCometSupport

2014-06-17 14:34:07,338 [http-nio-8080-exec-3] ERROR com.vaadin.server.DefaultErrorHandler - 
java.lang.IllegalStateException: Cannot suspend a response longer than the session timeout. Increase the value of session-timeout in web.xml
    at org.atmosphere.cpr.AtmosphereResourceImpl.suspend(AtmosphereResourceImpl.java:314) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
并收到相同的错误消息:

2014-06-17 14:32:43,340 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.AtmosphereFramework - SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead
2014-06-17 14:32:44,981 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.DefaultAsyncSupportResolver - Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport,  until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport
2014-06-17 14:32:45,001 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7CometSupport, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar Is the NIO or APR Connector enabled?
2014-06-17 14:32:45,005 [http-nio-8080-exec-3] ERROR org.atmosphere.cpr.AtmosphereFramework - If you have more than one Connector enabled, make sure they both use the same protocol, e.g NIO/APR or HTTP for all. If not, org.atmosphere.container.BlockingIOCometSupport will be used and cannot be changed.
java.lang.IllegalStateException: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar
    at org.atmosphere.container.Tomcat7CometSupport.<clinit>(Tomcat7CometSupport.java:56) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
2014-06-17 14:32:45,006 [http-nio-8080-exec-3] WARN  org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.BlockingIOCometSupport

2014-06-17 14:32:58,684 [http-nio-8080-exec-1] ERROR com.vaadin.server.DefaultErrorHandler - 
java.lang.IllegalStateException: Cannot suspend a response longer than the session timeout. Increase the value of session-timeout in web.xml
    at org.atmosphere.cpr.AtmosphereResourceImpl.suspend(AtmosphereResourceImpl.java:314) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
2014-06-17 14:33:52,928 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead
2014-06-17 14:33:54,557 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.DefaultAsyncSupportResolver - Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport,  until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport
2014-06-17 14:33:54,577 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7CometSupport, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar Is the NIO or APR Connector enabled?
2014-06-17 14:33:54,581 [http-nio-8080-exec-1] ERROR org.atmosphere.cpr.AtmosphereFramework - If you have more than one Connector enabled, make sure they both use the same protocol, e.g NIO/APR or HTTP for all. If not, org.atmosphere.container.BlockingIOCometSupport will be used and cannot be changed.
java.lang.IllegalStateException: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar
    at org.atmosphere.container.Tomcat7CometSupport.<clinit>(Tomcat7CometSupport.java:56) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
   (...)
2014-06-17 14:33:54,582 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.BlockingIOCometSupport

2014-06-17 14:34:07,338 [http-nio-8080-exec-3] ERROR com.vaadin.server.DefaultErrorHandler - 
java.lang.IllegalStateException: Cannot suspend a response longer than the session timeout. Increase the value of session-timeout in web.xml
    at org.atmosphere.cpr.AtmosphereResourceImpl.suspend(AtmosphereResourceImpl.java:314) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
2014-06-17 14:33:52928[http-nio-8080-exec-1]警告org.atmosphere.cpr.AtmosphereFramework-会话支持错误。请确保将org.atmosphere.cpr.SessionSupport定义为web.xml中的侦听器
2014-06-17 14:33:54557[http-nio-8080-exec-1]警告org.atmosphere.cpr.DefaultAsyncSupportResolver-找到多个容器,请指定要使用的容器:org.atmosphere.container.Tomcat7ComeSupport,org.atmosphere.container.TomcatComeSupport,在您这样做之前,atmosphere将使用:class org.atmosphere.container.Tomcat7ComeSupport
2014-06-17 14:33:54577[http-nio-8080-exec-1]警告org.atmosphere.cpr.AtmosphereFramework-使用comet支持失败:org.atmosphere.container.Tomcat7CometSupport,错误:Tomcat未能检测到这是Comet应用程序,因为缺少context.xml或未启用Http11NioProtocol连接器。必须使用atmosphere本机运行时依赖项才能使用本机Comet支持
如果不是这样,还可以删除META-INF/context.xml和WEB-INF/lib/atmosphere-compat-tomcat7.jar是否启用了NIO或APR连接器?
2014-06-17 14:33:54581[http-nio-8080-exec-1]错误org.atmosphere.cpr.AtmosphereFramework-如果启用了多个连接器,请确保它们都使用相同的协议,例如nio/APR或http for all。否则,将使用org.atmosphere.container.BlockingIOCometSupport,并且无法更改。
java.lang.IllegalStateException:Tomcat未能检测到这是Comet应用程序,因为缺少context.xml或未启用Http11NioProtocol连接器。必须使用atmosphere本机运行时依赖项才能使用本机Comet支持
如果不是这样,还可以删除META-INF/context.xml和WEB-INF/lib/atmosphere-compat-tomcat7.jar
在org.atmosphere.container.Tomcat7ComeSupport.(tomcat7ComeSupport.java:56)~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
(...)
2014-06-17 14:33:54582[http-nio-8080-exec-1]警告org.atmosphere.cpr.AtmosphereFramework-使用org.atmosphere.container.BlockingIOCometSupport
2014-06-17 14:34:07338[http-nio-8080-exec-3]错误com.vaadin.server.DefaultErrorHandler-
java.lang.IllegalStateException:无法暂停超过会话超时的响应。增加web.xml中会话超时的值
在org.atmosphere.cpr.atmosphereSourceImpl.suspend(atmosphereSourceImpl.java:314)~[atmospher-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
(...)
为会话超时添加参数也没有改变任何内容:

@WebServlet(asyncSupported = true, initParams = { @WebInitParam(name = "session-timeout", value = "120") })
public static class Servlet extends VaadinServlet {
}

2014-06-17 14:36:18,636 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - SessionSupport error. Make sure you define org.atmosphere.cpr.SessionSupport as a listener in web.xml instead
2014-06-17 14:36:20,284 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.DefaultAsyncSupportResolver - Found multiple containers, please specify which one to use: org.atmosphere.container.Tomcat7CometSupport, org.atmosphere.container.TomcatCometSupport,  until you do, Atmosphere will use:class org.atmosphere.container.Tomcat7CometSupport
2014-06-17 14:36:20,303 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - Failed using comet support: org.atmosphere.container.Tomcat7CometSupport, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar Is the NIO or APR Connector enabled?
2014-06-17 14:36:20,307 [http-nio-8080-exec-1] ERROR org.atmosphere.cpr.AtmosphereFramework - If you have more than one Connector enabled, make sure they both use the same protocol, e.g NIO/APR or HTTP for all. If not, org.atmosphere.container.BlockingIOCometSupport will be used and cannot be changed.
java.lang.IllegalStateException: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.You must use the atmosphere-native-runtime dependency in order to use native Comet Support
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat7.jar
    at org.atmosphere.container.Tomcat7CometSupport.<clinit>(Tomcat7CometSupport.java:56) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
2014-06-17 14:36:20,308 [http-nio-8080-exec-1] WARN  org.atmosphere.cpr.AtmosphereFramework - Using org.atmosphere.container.BlockingIOCometSupport

2014-06-17 14:36:44,341 [http-nio-8080-exec-9] ERROR com.vaadin.server.DefaultErrorHandler - 
java.lang.IllegalStateException: Cannot suspend a response longer than the session timeout. Increase the value of session-timeout in web.xml
    at org.atmosphere.cpr.AtmosphereResourceImpl.suspend(AtmosphereResourceImpl.java:314) ~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
    (...)
@WebServlet(asyncSupported=true,initParams={@WebInitParam(name=“session timeout”,value=“120”)})
公共静态类Servlet扩展了VaadinServlet{
}
2014-06-17 14:36:18636[http-nio-8080-exec-1]警告org.atmosphere.cpr.AtmosphereFramework-会话支持错误。请确保将org.atmosphere.cpr.SessionSupport定义为web.xml中的侦听器
2014-06-17 14:36:20284[http-nio-8080-exec-1]警告org.atmosphere.cpr.DefaultAsyncSupportResolver-找到多个容器,请指定要使用的容器:org.atmosphere.container.Tomcat7ComeSupport,org.atmosphere.container.TomcatComeSupport,在您这样做之前,atmosphere将使用:class org.atmosphere.container.Tomcat7ComeSupport
2014-06-17 14:36:20303[http-nio-8080-exec-1]警告org.atmosphere.cpr.AtmosphereFramework-使用comet支持失败:org.atmosphere.container.Tomcat7CometSupport,错误:Tomcat未能检测到这是Comet应用程序,因为缺少context.xml或未启用Http11NioProtocol连接器。必须使用atmosphere本机运行时依赖项才能使用本机Comet支持
如果不是这样,还可以删除META-INF/context.xml和WEB-INF/lib/atmosphere-compat-tomcat7.jar是否启用了NIO或APR连接器?
2014-06-17 14:36:20307[http-nio-8080-exec-1]ERROR org.atmosphere.cpr.AtmosphereFramework-如果启用了多个连接器,请确保它们都使用相同的协议,例如nio/APR或http for all。否则,将使用org.atmosphere.container.BlockingIOCometSupport,并且无法更改。
java.lang.IllegalStateException:Tomcat未能检测到这是Comet应用程序,因为缺少context.xml或未启用Http11NioProtocol连接器。必须使用atmosphere本机运行时依赖项才能使用本机Comet支持
如果不是这样,还可以删除META-INF/context.xml和WEB-INF/lib/atmosphere-compat-tomcat7.jar
在org.atmosphere.container.Tomcat7ComeSupport.(tomcat7ComeSupport.java:56)~[atmosphere-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
(...)
2014-06-17 14:36:20308[http-nio-8080-exec-1]警告org.atmosphere.cpr.AtmosphereFramework-使用org.atmosphere.container.BlockingIOCometSupport
2014-06-17 14:36:44341[http-nio-8080-exec-9]错误com.vaadin.server.DefaultErrorHandler-
java.lang.IllegalStateException:无法暂停超过会话超时的响应。增加web.xml中会话超时的值
在org.atmosphere.cpr.atmosphereSourceImpl.suspend(atmosphereSourceImpl.java:314)~[atmospher-runtime-2.1.2.vaadin2.jar:2.1.2.vaadin2]
(...)

您对解决方案有什么想法吗?

目前,只有在您没有将WEBSOCKET设置为传输模式的情况下,Spring+Vaadin才能工作。尝试将其更改为长轮询或流式处理:

@Push(transport = Transport.LONG_POLLING)
就我个人而言,我仍然对web应用程序使用旧的xml配置。这是Vaadin 7推送配置的一部分

 <!-- Vaadin context -->
<servlet>
    <servlet-name>ISM Application</servlet-name>
    <servlet-class>org.vaadin.spring.servlet.SpringAwareVaadinServlet</servlet-class>
    <init-param>
        <param-name>closeIdleSessions</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:ism-web.xml</param-value>
    </init-param>
    <!-- Vaadin 7.1 @Push -->
    <init-param>
        <param-name>org.atmosphere.useWebSocketAndServlet3</param-name>
        <param-value>true</param-value>
    </init-param>
    <async-supported>true</async-supported>
</servlet>

ISM应用
org.vaadin。