1 Reply Latest reply on Jul 13, 2012 3:31 AM by MJ Kim

    JBoss 7.1.1 Session Replication Problem (Custom java class type)

    MJ Kim Newbie

      Hi, all.

       

      I have a problem with JBoss session replication.

       

      I've configured JBoss cluster with JGroups(FILE_PING) + Infinispan, no mod_cluster. (Because I don't need the load balancing at WAS level. I hava the front proxy,Nginx).

       

      I accomplished session replication test with a basic JSP page with java.lang.String typed session element.

       

      But I tried to save/read session data with Value Object, it was failed.

      The value object is written by myself, implements Serializable, and have some data field.

       

      Here is my configuration.

       

       

      Start script

      #!/bin/sh

       

       

      SERVER_NAME=MYAPP11

       

       

      #-----------------------------------------------------------------------

      # Global Java options

      #-----------------------------------------------------------------------

       

       

      MY_SETTINGS=-Dmy.home.path=/my/my_app

      MY_SETTINGS="$MY_SETTINGS -Dmy.configuration.path=/nas/deploy/configure"

      MY_SETTINGS="$MY_SETTINGS -Dmy.log.path=/my/my_app/myapp/log/$SERVER_NAME"

      MY_SETTINGS="$MY_SETTINGS -Dmy.server.type=Dev"

      MY_SETTINGS="$MY_SETTINGS -Dmy.program.name=myapp"

       

       

      MY_SETTINGS="$MY_SETTINGS -Dmy.deploy.path=/nas/deploy/application/myapp"

       

       

      MY_SETTINGS="$MY_SETTINGS -Djboss.host.name=$HOSTNAME:8080"

      MY_SETTINGS="$MY_SETTINGS -Djboss.node.name=$HOSTNAME"

      MY_SETTINGS="$MY_SETTINGS -Djboss.server.config.dir=/my/my_app/myapp/conf"

      MY_SETTINGS="$MY_SETTINGS -Djboss.server.log.dir=/my/my_app/myapp/log/$SERVER_NAME"

       

       

      #-----------------------------------------------------------------------

      # Java options for this Instance

      #-----------------------------------------------------------------------

      MY_SETTINGS="$MY_SETTINGS -Dmy.was.name=$SERVER_NAME"

       

       

      # Infinispan

      MY_SETTINGS="$MY_SETTINGS -Djgroups.tcp.address=$HOSTNAME"

      MY_SETTINGS="$MY_SETTINGS -Djgroups.tcp.port=26100"

      MY_SETTINGS="$MY_SETTINGS -Djboss.server.data.dir=/my/my_app/myapp/data"

       

       

      MY_SETTINGS="$MY_SETTINGS -Djboss.socket.binding.port-offset=0"

       

       

      #-----------------------------------------------------------------------

      # Run WAS

      #-----------------------------------------------------------------------

       

       

      export SERVER_NAME

      export MY_SETTINGS

       

       

      . bin/standalone.sh -b $HOSTNAME --server-config="standalone.xml"

       

       

      standalone.xml

      <?xml version="1.0" ?>

       

       

      <server xmlns="urn:jboss:domain:1.2">

       

       

          <extensions>

              <extension module="org.jboss.as.clustering.infinispan"/>

              <extension module="org.jboss.as.clustering.jgroups"/>

              <extension module="org.jboss.as.configadmin"/>

              <extension module="org.jboss.as.connector"/>

              <extension module="org.jboss.as.deployment-scanner"/>

              <extension module="org.jboss.as.ee"/>

              <extension module="org.jboss.as.jaxrs"/>

              <extension module="org.jboss.as.jdr"/>

              <extension module="org.jboss.as.jmx"/>

              <extension module="org.jboss.as.logging"/>

              <extension module="org.jboss.as.naming"/>

              <extension module="org.jboss.as.pojo"/>

              <extension module="org.jboss.as.remoting"/>

              <extension module="org.jboss.as.sar"/>

              <extension module="org.jboss.as.security"/>

              <extension module="org.jboss.as.threads"/>

              <extension module="org.jboss.as.transactions"/>

              <extension module="org.jboss.as.web"/>

              <extension module="org.jboss.as.weld"/>

          </extensions>

       

       

      (....)

       

              <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="web">

                  <cache-container name="web" aliases="standard-session-cache" default-cache="repl">

                      <transport stack="tcp" lock-timeout="60000"/>

                      <replicated-cache name="repl" mode="ASYNC" start="EAGER" batching="true">

                          <locking isolation="REPEATABLE_READ"/>

                          <eviction strategy="LRU" max-entries="200"/>

                          <file-store/>

                      </replicated-cache>

                  </cache-container>

              </subsystem>

       

      (....)

       

              <subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="tcp">

                  <stack name="tcp">

                      <transport type="TCP" socket-binding="jgroups-tcp" diagnostics-socket-binding="jgroups-diagnostics"/>

                      <protocol type="FILE_PING">

                          <property name="location">

                              /nas/cluster/jboss

                          </property>

                          <property name="timeout">

                              5000

                          </property>

                          <property name="num_initial_members">

                              2

                          </property>

                      </protocol>

                      <protocol type="MERGE2"/>

                      <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd"/>

                      <protocol type="FD"/>

                      <protocol type="VERIFY_SUSPECT"/>

                      <protocol type="BARRIER"/>

                      <protocol type="pbcast.NAKACK"/>

                      <protocol type="UNICAST2"/>

                      <protocol type="pbcast.STABLE"/>

                      <protocol type="pbcast.GMS"/>

                      <protocol type="UFC"/>

                      <protocol type="MFC"/>

                      <protocol type="FRAG2"/>

                  </stack>

              </subsystem>

       

      (....)

       

          <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

              <socket-binding name="management-native" interface="management" port="${jboss.management.native.port:18089}"/>

              <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:18080}"/>

              <socket-binding name="http" port="8080"/>

              <socket-binding name="jgroups-diagnostics" port="0"/>

              <socket-binding name="jgroups-tcp" port="7600"/>

              <socket-binding name="jgroups-tcp-fd" port="57600"/>

              <socket-binding name="remoting" port="4447"/>

              <socket-binding name="txn-recovery-environment" port="4712"/>

              <socket-binding name="txn-status-manager" port="4713"/>

          </socket-binding-group>

       

      (....)

       

       

       

      web.xml

      <?xml version="1.0" encoding="UTF-8"?>

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">

       

      (....)

       

          <!-- ==================================================== -->

          <!-- Clusterable (JBOSS Setting)                       -->

          <!-- ==================================================== -->

          <distributable/>

      </web-app>

       

       

      jboss-web.xml(in OOO-web/WebContent/WEB-INF)

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-web version="6.0"

                 xmlns="http://www.jboss.com/xml/ns/javaee"

                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                 xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_6_0.xsd">

       

      <!--

          <use-session-cookies>true</use-session-cookies>

      -->

       

                <replication-config>

                    <cache-name>web.repl</cache-name>

                    <replication-trigger>SET</replication-trigger>

                    <replication-granularity>SESSION</replication-granularity>

                          <replication-mode>ASYNCHRONOUS</replication-mode>

                </replication-config>

      </jboss-web>

       

       

      Can you guys give me a solution?