Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-70074

java.lang.NoClassDefFoundError is thrown during Liferay startup in case of having a tomcat cluster with session replication activated

    Details

      Description

      java.lang.NoClassDefFoundError is thrown during Liferay startup in case of having a tomcat cluster with session replication activated, full error:

      java.lang.NoClassDefFoundError: Could not initialize class com.liferay.portal.kernel.servlet.filters.compoundsessionid.CompoundSessionIdSplitterUtil

      Steps to reproduce - environment setup

      1. Download and install attached login-liferay.zip script:
        • Unzip file to a empty folder
        • Install node.js and npm if necessary
        • Execute npm install
      2. Configure Liferay cluster with two tomcat nodes.
      3. Edit $TOMCAT_HOME/conf/server.xml of each node and configure the tcp ports to "8080" and "8180"
      4. Activate session replication at tomcat level:
        1. Edit $TOMCAT_HOME/conf/server.xml of each node and inside Engine tag, add following text:
          <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
          
        2. Edit $TOMCAT_HOME/conf/context.xml of each node and inside Context tag, add following text:
              <Manager className="org.apache.catalina.ha.session.DeltaManager"
                       expireSessionsOnShutdown="false"
                       notifyListenersOnReplication="true"/>
          
        3. Edit $TOMCAT_HOME/webapps/ROOT/WEB-INF/web.xml and immediately following the <web-app> tag (inside the tag), add the tag <distributable />
        4. Edit $TOMCAT_HOME/conf/logging.properties and add the following lines.
          ##CLUSTER LOG
          5cluster.org.apache.juli.AsyncFileHandler.level = FINER
          5cluster.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
          5cluster.org.apache.juli.AsyncFileHandler.prefix = cluster.
          
          # just the clustering logs - all others are stock logging.properties
          org.apache.catalina.tribes.MESSAGES.level = FINE
          org.apache.catalina.tribes.MESSAGES.handlers = 5cluster.org.apache.juli.AsyncFileHandler
          
          org.apache.catalina.tribes.level = FINE
          org.apache.catalina.tribes.handlers = 5cluster.org.apache.juli.AsyncFileHandler
          
          org.apache.catalina.ha.level = FINE
          org.apache.catalina.ha.handlers = 5cluster.org.apache.juli.AsyncFileHandler
          
          org.apache.catalina.ha.deploy.level = INFO
          org.apache.catalina.ha.deploy.handlers = 5cluster.org.apache.juli.AsyncFileHandler
          
        5. Also add 5cluster.org.apache.juli.AsyncFileHandler to handlers line at the beggining of the file.

      Steps to reproduce - using login-liferay.zip script

      1. Start first tomcat node
      2. Verify you can login from browser using URL: http://localhost:8080/web/guest
      3. In a new console, execute login-liferay script, in order to generate new sessions and force replication to second node
        • 6.2.x:
          node login-liferay.js -u test@liferay.com -p test --url "http://localhost:8080/web/guest" --num_threads 6 --num_executions 1000 --version 62
          
        • 7.0.x / master:
          node login-liferay.js -u test@liferay.com -p test --url "http://localhost:8080/web/guest" --num_threads 6 --num_executions 1000 --version 70
          
      4. Start second tomcat node:
        • Correct behavior: First node starts successfully
        • Wrong behavior: Second node starts but following error is continuously displayed
          SEVERE: Session event listener threw exception
          java.lang.NoClassDefFoundError: Could not initialize class com.liferay.portal.kernel.servlet.filters.compoundsessionid.CompoundSessionIdSplitterUtil
          	at com.liferay.portal.servlet.PortalSessionListener.sessionCreated(PortalSessionListener.java:39)
          	at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:423)
          	at org.apache.catalina.session.StandardSession.setId(StandardSession.java:395)
          	at org.apache.catalina.ha.session.DeltaSession.setId(DeltaSession.java:277)
          	at org.apache.catalina.ha.session.DeltaManager.handleSESSION_CREATED(DeltaManager.java:1406)
          	at org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1284)
          	at org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1014)
          	at org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:92)
          	at org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:940)
          	at org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:921)
          	at org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:278)
          	at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:84)
          	at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:84)
          	at org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:117)
          	at org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:84)
          	at org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:253)
          	at org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:287)
          	at org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:212)
          	at org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:101)
          	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          	at java.lang.Thread.run(Thread.java:745)
          

      Steps to reproduce - debugging from eclipse

      1. Start first tomcat node
      2. Verify you can login from browser using URL: http://localhost:8080/web/guest
      3. Configure Eclipse debugging session with a breaking point in method PortalContextLoaderListener.contextInitialized(ServletContextEvent servletContextEvent)
      4. Start second tomcat from Eclipse, in order to stop in previous configured breaking point
      5. Open in a new browser another connection to first node: http://localhost:8080/web/guest
      6. Repeat previous step more than one time
      7. Check log of second node:
        • Correct behavior: No exception is displayed
        • Wrong behavior: Following exception is continuously displayed
          SEVERE: Session event listener threw exception
          java.lang.NoClassDefFoundError: Could not initialize class com.liferay.portal.kernel.servlet.filters.compoundsessionid.CompoundSessionIdSplitterUtil
          	at com.liferay.portal.servlet.PortalSessionListener.sessionCreated(PortalSessionListener.java:39)
          	at org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:423)
          [...]
          	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
          	at java.lang.Thread.run(Thread.java:745)
          

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                linda.sui Linda Sui
                Reporter:
                jorge.diaz Jorge Diaz
                Participants of an Issue:
                Recent user:
                Csaba Turcsan
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 37 weeks, 1 day ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 DXP FP11
                  7.0.0 DXP SP2
                  7.0.3 CE GA4
                  7.1.X
                  Master