0

Weblogic - 12.2.1 - not initializing the ServerContainer !

Hello Everyone , I am facing an issue while starting my application on weblogic 12.2.1 , as per the websocket spec i am initializing the websocket end-point at the time of startup of application in ServletContextListener . I am using atmosphere framework to start the websocket endpoint. While initializing the socket endpoint in class JSR356AsyncSupport - atmosphere framework tries to fetch the attribute from servletContext object . It doesn't find it and fails .... in weblogic 12.2.1 / 12.1.3. However the same application when deployed on other web/appservers like tomcat , websphere liberty , jboss works fine. (Am using jdk1.8)

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

I don't have clue how to solve this - Much Appreciated if some one can help me out. Thank you.

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");
    }
}

Exception stack trace.

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)
ppeterka
  • 20,583
  • 6
  • 63
  • 78
TEJA
  • 1
  • 6
  • Have you read the weblogic docs? https://docs.oracle.com/middleware/1212/wls/WLPRG/websockets.htm#WLPRG807 – Taylor Aug 19 '16 at 17:43
  • thank you for sharing the documentation , my application works perfectly alright on websphere liberty.jboss , tomcat . however it doesn't work on weblogic.. I went through the documentation - not much help for my issue. – TEJA Aug 19 '16 at 18:40

1 Answers1

0

Kind of late to the party, but I'm currently working with weblogic 12.1.3 and though it does implement the websocket protocol (oracle docs, RFC 6455), unfortunately it does not comply with JSR356 (only from version 12.2.1 and up).

If you are using atmosphere, I've managed to configure a more-or-less working example by fine-tuning some of the atmosphere/primefaces servlet (I'm using Primefaces 6.0 socket for the server notifications) init-params:

<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>

Anyway, it's being really hard to implement and I'm considering other options.

More info here and here.

Community
  • 1
  • 1
Repoker
  • 202
  • 3
  • 12