我无法在Quarkus 1.10.5.Final中使用Atmosphere库(2.4.30.slf4jvaadin1版)。
我已经将quarkus-undertow-websockets工件添加到我的Vaadin Quarkus项目中,但是jsr356支持无法初始化为:
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());),但没有用。
谢谢。
发布于 2021-01-27 16:27:29
问题是UndertowWebsocketProcessor.java不会创建WebSocketDeploymentInfo,这反过来会导致io.undertow.websockets.jsr.Bootstrap.handleDeployment()不初始化websocket,除非应用程序中至少有一个websocket端点或websocket配置。
解决方法是引入一个虚拟配置类:
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。
https://stackoverflow.com/questions/65847175
复制相似问题