我在Wildfly 9.0.2上使用Vaadin 7.5.8。在我们的应用程序中,我们需要Push支持,所以我添加了maven依赖
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
并将PushMode参数添加到servlet初始化。
@WebServlet(value = {"/ui/*", "/VAADIN/*"}, asyncSupported = true, initParams = {
@WebInitParam(name = "UIProvider", value = "com.vaadin.cdi.CDIUIProvider"),
@WebInitParam(name = "pushmode", value = "automatic")})
在应用程序启动时,我将看到我们的应用程序的登录页面。从这一点开始,导致服务器通信的每个操作都以此错误结束:
Caused by: javax.enterprise.context.ContextNotActiveException: WebBeans context with scope type annotation @SessionScoped does not exist within current thread
at org.apache.webbeans.container.BeanManagerImpl.getContext(BeanManagerImpl.java:330) ~[openwebbeans-impl-1.2.7.jar:1.2.7]
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:88) ~[openwebbeans-impl-1.2.7.jar:1.2.7]
at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.get(NormalScopedBeanInterceptorHandler.java:70) ~[openwebbeans-impl-1.2.7.jar:1.2.7]
at com.vaadin.cdi.internal.BeanStoreContainer$$OwbNormalScopeProxy0.getUIBeanStore(com/vaadin/cdi/internal/BeanStoreContainer.java) ~[na:1.0.3]
at com.vaadin.cdi.internal.UIScopedContext.get(UIScopedContext.java:97) ~[vaadin-cdi-1.0.0.alpha2.jar:1.0.3]
at org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:754) ~[openwebbeans-impl-1.2.7.jar:1.2.7]
at org.apache.webbeans.inject.instance.InstanceImpl.get(InstanceImpl.java:139) ~[openwebbeans-impl-1.2.7.jar:1.2.7]
当我从servlet配置中删除push参数时,一切正常。我的推送配置有问题吗?
答案 0 :(得分:1)
您的问题可能是由于VaadinUI在会话上下文未激活时尝试异步推送到客户端。尝试切换到async-supported false以使用轮询而不是真正的异步推送。
这是Vaadin CDI插件的限制,遗憾的是,异步推送的设计并未考虑范围实现。
-Juuso