首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Websockets没有在WebLogic12.2.1中工作?

Websockets没有在WebLogic12.2.1中工作?
EN

Stack Overflow用户
提问于 2016-08-19 17:33:25
回答 1查看 1.8K关注 0票数 0

Weblogic - 12.2.1 -不初始化ServerContainer!

大家好,我在WebLogic12.2.1上启动我的应用程序时遇到了一个问题,根据websocket规范,在ServletContextListener中启动应用程序时,我正在初始化websocket端点。我正在使用气氛框架启动websocket端点。在类JSR356AsyncSupport中初始化套接字端点时,大气框架试图从servletContext对象中获取属性。它找不到它而且失败了..。在weblogic 12.2.1 / 12.1.3中。然而,当部署在其他web/appserver(如tomcat、websphere fine )上的应用程序相同时,jboss工作得很好。(我正在使用jdk1.8 1.8)

(https://github.com/Atmosphere/atmosphere/blob/master/modules/cpr/src/main/java/org/atmosphere/container/JSR356AsyncSuppo…))

我不知道如何解决这个问题--如果有人能帮我的话,我很感激。谢谢。

代码语言:javascript
复制
public JSR356AsyncSupport(AtmosphereConfig config, ServletContext ctx) {
    super(config);
    ServerContainer container = (ServerContainer) ctx.getAttribute(ServerContainer.class.getName()); //javax.websocket.server.ServerContainer


    if (container == null) {
        if (ctx.getServerInfo().contains("WebLogic")) {
            logger.error("{} must use JDK 1.8+ with WebSocket", ctx.getServerInfo());
        }
        throw new IllegalStateException("Unable to configure jsr356 at that stage. ServerContainer is null");
    }
}

异常堆栈跟踪

代码语言:javascript
复制
2016-08-16 16:10:31,459 [            WGHALBW7] [  STANDARD] [ ] [ ] (pr.DefaultAsyncSupportResolver) ERROR   - Real error: Unable to configure jsr356 at that stage. ServerContainer is null
java.lang.IllegalStateException: Unable to configure jsr356 at that stage. ServerContainer is null
at org.atmosphere.container.JSR356AsyncSupport.<init>(JSR356AsyncSupport.java:51)
at org.atmosphere.container.JSR356AsyncSupport.<init>(JSR356AsyncSupport.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.newCometSupport(DefaultAsyncSupportResolver.java:235)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolveWebSocket(DefaultAsyncSupportResolver.java:307)
at org.atmosphere.cpr.DefaultAsyncSupportResolver.resolve(DefaultAsyncSupportResolver.java:293)
at org.atmosphere.cpr.AtmosphereFramework.autoDetectContainer(AtmosphereFramework.java:2004)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:911)
at org.atmosphere.cpr.AtmosphereFramework.init(AtmosphereFramework.java:835)
EN

回答 1

Stack Overflow用户

发布于 2019-07-22 09:17:48

有点晚了,但我目前正在使用WebLogic12.1.3,虽然它确实实现了websocket协议(oracle文档RFC 6455),但不幸的是,它与JSR356 (仅从12.2.1版本和更高版本)实现了不符合

如果您使用的是气氛,那么我已经通过微调了一些氛围/ Primefaces (我使用PrimeFaces6.0套接字作为服务器通知)init-params来配置一个或多或少的工作示例:

代码语言:javascript
复制
<servlet>
    <description>PrimeFaces Push Notifications Servlet</description>
    <servlet-name>Push Servlet</servlet-name>
    <servlet-class>org.primefaces.push.PushServlet</servlet-class>
    <init-param>
        <param-name>org.atmosphere.cpr.packages</param-name>
        <param-value>my.project.push</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.atmosphereHandlerPath</param-name>
        <param-value>/WEB-INF/lib/_wl_cls_gen.jar</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.resumeOnBroadcast</param-name>
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.websocket.suppressJSR356</param-name> <!-- les versions que tenim no son JSR356-compliant -->
        <param-value>true</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.cpr.broadcasterCacheClass</param-name>
        <param-value>org.atmosphere.cache.UUIDBroadcasterCache</param-value>
    </init-param>
    <init-param>
        <param-name>org.atmosphere.interceptor.HeartbeatInterceptor.clientHeartbeatFrequencyInSeconds</param-name>
        <param-value>20</param-value>
    </init-param>
    <async-supported>true</async-supported>
</servlet>
<servlet-mapping>
    <servlet-name>Push Servlet</servlet-name>
    <url-pattern>/primepush/*</url-pattern>
</servlet-mapping>

无论如何,这是很难实现的,我正在考虑其他的选择。

更多信息,这里这里

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

https://stackoverflow.com/questions/39044782

复制
相关文章

相似问题

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