1 Reply Latest reply on Nov 21, 2012 4:06 AM by Michel Werren

    JBoss AS 7.1.1 clustering error

    Michel Werren Novice

      Hello together

       

      I try to bring our application to run in a cluster. The problem is, thats the HttpSessionProvider would set a instance of unserializable class "SessionsContainer" to the HTTP Session. This result in the following exception:

       

      [Server:server-three] 15:58:33,179 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/achilles].[ErraiServlet]] (http--192.168.1.221-8330-2) Servlet.service() for servlet ErraiServlet threw exception: java.lang.IllegalArgumentException: JBAS018062: Specified attribute cannot be replicated

      [Server:server-three]           at org.jboss.as.web.session.ClusteredSession.setAttribute(ClusteredSession.java:807) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      [Server:server-three]           at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:130) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.jboss.errai.bus.server.HttpSessionProvider.createOrGetSession(HttpSessionProvider.java:46) [errai-bus-2.1.1.Final.jar:2.1.1.Final]

      [Server:server-three]           at org.jboss.errai.bus.server.HttpSessionProvider.createOrGetSession(HttpSessionProvider.java:39) [errai-bus-2.1.1.Final.jar:2.1.1.Final]

      [Server:server-three]           at org.jboss.errai.bus.server.servlet.StandardAsyncServlet.doGet(StandardAsyncServlet.java:47) [errai-bus-2.1.1.Final.jar:2.1.1.Final]

      [Server:server-three]           at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

      [Server:server-three]           at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

      [Server:server-three]           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

      [Server:server-three]           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at ch.apkern.achilles.security.filter.SecurityFilter.doFilter(SecurityFilter.java:26) [achilles-security-1.0-SNAPSHOT.jar:]

      [Server:server-three]           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:67)

      [Server:server-three]           at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:48)

      [Server:server-three]           at org.jboss.as.web.session.ClusteredSessionValve.handleRequest(ClusteredSessionValve.java:125) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      [Server:server-three]           at org.jboss.as.web.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:91) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      [Server:server-three]           at org.jboss.as.web.session.JvmRouteValve.invoke(JvmRouteValve.java:88) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      [Server:server-three]           at org.jboss.as.web.session.LockingValve.invoke(LockingValve.java:56) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      [Server:server-three]           at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

      [Server:server-three]           at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

      [Server:server-three]           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

      [Server:server-three]           at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37]

      [Server:server-three]

       

       

      Is there recommended way, to fix this? Or should i extend these classes?

       

      Thanks in advance

       

      Regards Michel

        • 1. Re: JBoss AS 7.1.1 clustering error
          Michel Werren Novice

          Hello

           

          Extending the servlet, HttpSessionProvider and its static inner class SessionsContainer as follows works for me :

           

          public class ClusterServlet extends StandardAsyncServlet {

              private static final long serialVersionUID = -2108585659125057516L;

           

           

              @Override

              protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

                  if (sessionProvider == null || !(sessionProvider instanceof ClusterSessionProvider)) {

                      sessionProvider = new ClusterSessionProvider();

                  }

                  super.doGet(request, response);

              }

           

           

              @Override

              protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

                  if (sessionProvider == null || !(sessionProvider instanceof ClusterSessionProvider)) {

                      sessionProvider = new ClusterSessionProvider();

                  }

                  super.doPost(request, response);

              }

          }

           

          public class ClusterSessionProvider extends HttpSessionProvider {

           

           

              @Override

              public QueueSession createOrGetSession(final HttpSession externSessRef, final String remoteQueueID) {

                  ClusterSessionContainer sc = (ClusterSessionContainer) externSessRef.getAttribute(HTTP_SESS);

                  if (sc == null) {

                      externSessRef.setAttribute(HTTP_SESS, sc = new ClusterSessionContainer());

                  }

           

           

                  QueueSession qs = sc.getSession(remoteQueueID);

                  if (qs == null) {

                      qs = sc.createSession(externSessRef.getId(), remoteQueueID);

                      qs.setAttribute(HttpSession.class.getName(), externSessRef);

                  }

           

           

                  return qs;

              }

           

           

                    public static class ClusterSessionContainer extends SessionsContainer implements Serializable {

                  private static final long serialVersionUID = -8314591639278711517L;

              }

          }

           

          I will test this.

           

          To say ... we use Errai finally only for RPC calls, broadcasting and clientside events.

           

          Regards

          Michel

          1 of 1 people found this helpful