【发布时间】:2014-08-07 12:04:22
【问题描述】:
在我们当前的项目中,我们希望在 Spring Boot 驱动的 Vaadin 应用程序中使用 server-push。
我们按照 wiki 文章 https://vaadin.com/book/vaadin7/-/page/advanced.push.html 中的说明进行操作(向 pom.xml 添加了 vaadin-push 依赖项,向 out UI 类添加了 @Push 注释,没有在 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]
(...)
在阅读 stackoverflow 线程 Getting rid of web.xml in Vaadin 7 with VaadinServlet 后,我们在 UI 类中添加了一个静态 servlet
@WebServlet(asyncSupported = true)
public static class Servlet extends VaadinServlet {
}
并得到相同的错误消息:
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]
(...)
为会话超时添加一个参数也没有改变任何东西:
@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]
(...)
您对解决方案有什么想法吗?
【问题讨论】:
-
因为这个帖子已经有一年了:你还有这个问题吗?我正在使用带有@Push 的 vaadin-spring-boot 没有任何问题
标签: tomcat servlets spring-boot vaadin7 server-push