首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Quarkus+Atmosphere失败并显示“Unable to configure jsr356 at that stage.‘”。

Quarkus+Atmosphere失败并显示“Unable to configure jsr356 at that stage.‘”。
EN

Stack Overflow用户
提问于 2021-01-22 22:36:41
回答 1查看 124关注 0票数 0

我无法在Quarkus 1.10.5.Final中使用Atmosphere库(2.4.30.slf4jvaadin1版)。

我已经将quarkus-undertow-websockets工件添加到我的Vaadin Quarkus项目中,但是jsr356支持无法初始化为:

代码语言:javascript
复制
Caused by: java.lang.IllegalStateException: Unable to configure jsr356 at that stage. ServerContainer is null
    at org.atmosphere.container.JSR356AsyncSupport.<init>(JSR356AsyncSupport.java:53)
    at org.atmosphere.container.JSR356AsyncSupport.<init>(JSR356AsyncSupport.java:42)

快速调查显示,在Atmosphere的JSR356AsyncSupport:47中,上下文中不存在ServerContainer (ServerContainer container = (ServerContainer) ctx.getAttribute(ServerContainer.class.getName());返回null)。

这导致Atmosphere退回到似乎不支持websockets的Servlet30CometSupport

有没有办法在Quarkus的嵌入式Undertow servlet容器上启用websockets?我已经将QuarkusVaadinServlet上的异步支持设为true ( servletProducer.produce(ServletBuildItem.builder(QuarkusVaadinServlet.class.getName(), QuarkusVaadinServlet.class.getName()).addMapping("/*").setAsyncSupported(true).build());),但没有用。

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2021-01-27 16:27:29

问题是UndertowWebsocketProcessor.java不会创建WebSocketDeploymentInfo,这反过来会导致io.undertow.websockets.jsr.Bootstrap.handleDeployment()不初始化websocket,除非应用程序中至少有一个websocket端点或websocket配置。

解决方法是引入一个虚拟配置类:

代码语言:javascript
复制
public class EnableWebsockets implements ServerApplicationConfig {
    @Override
    public Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> endpointClasses) {
        return new HashSet<>();
    }

    @Override
    public Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned) {
        return new HashSet<>();
    }
}

有关更多详细信息,请参阅https://github.com/mvysny/vaadin-quarkus/issues/12

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65847175

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档