1 Reply Latest reply on Mar 26, 2004 7:57 AM by Mike Finn

    Clustering Duke's Bank wtih mod_jk2

    ckoch Newbie

      Hi,
      after going through the JBOSS Tutorial and installing the Sun Duke's Bank App successfully under JBOSS 3.2.3 with Linux and JDK 1.4.2, I was curious about clustering the app.

      I did a lot of things for making the app work (Load balancing with apache2/mod_jk2, etc..). But when trying to access the application with a browser with http://192.168.1.242/bank/main, I am load balanced to one of my three jboss cluster nodes in RR fashion to the URL below:
      http://localhost/bank/logon;jsessionid=NqVBhizRkcvwwYowltXyaA**.server2

      and then I get the following error:

      Apache Tomcat/4.1.29 - Error report<!--H1{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} H3{font-family : sans-serif,Arial,Tahoma;color : white;background-color : #0086b2;} BODY{font-family : sans-serif,Arial,Tahoma;color : black;background-color : white;} B{color : white;background-color : #0086b2;} HR{color : #0086b2;} --> <h1>HTTP Status 500 - </h1><hr size="1" noshade>type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute
      at org.jboss.web.tomcat.session.ClusteredSession.setAttribute(ClusteredSession.java:1237)
      at org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:191)
      at com.sun.ebank.web.Dispatcher.doGet(Unknown Source)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
      <hr size="1" noshade><h3>Apache Tomcat/4.1.29</h3>

      The error message is actually quite long, but I think that the first errors should point to the problem. I ensured that load balancing is working. The database access to the hsql database is also running. I can modify customers in the database with the java admin client of Duke's bank. I think that I have some problem maybe with HA-JNDI or HTTP Session replication. Any help would be appreciated. What follows is config files.

      First I installed apache2 and mod_jk2 on one machine and tested the Load Balancing with a standalone installation of tomcat. It worked in the round robin fashion. Here is my workers2.properties file:

      [logger]
      level=DEBUG

      [config:]
      #file=/conf/workers2.properties
      file=/usr/local/apache2/conf/workers2.properties
      debug=5
      debugEnv=0

      [uriMap:]
      info=Maps the requests. Options: debug
      debug=0

      # Alternate file logger
      [logger.file:0]
      level=DEBUG
      file=/usr/local/apache2/logs/jk2.log

      [shm:]
      info=Scoreboard. Required for reconfiguration and status with multiprocess servers
      file=/usr/local/apache2/logs/jk2.shm
      size=10000
      debug=0
      disabled=0

      [workerEnv:]
      info=Global server options
      timing=1
      debug=0
      # Default Native Logger (apache2 or win32 )
      # can be overriden to a file logger, useful
      # when tracing win32 related issues
      #logger=logger.file:0

      # Loadbalancer
      [lb:lb]
      info=Default load balancer.
      debug=5
      stickySession=1

      # First Tomcat Instance
      [channel.socket:192.168.1.30:8009]
      info=Ajp13 forwarding over socket
      debug=5
      tomcatId=jboss01:8009
      port=8009
      host=192.168.1.30
      disabled=0

      [ajp13:192.168.1.30:8009]
      channel=channel.socket:192.168.1.30:8009
      group=lb
      lb_factor=1


      # Second Tomcat Instance
      [channel.socket:192.168.1.203:8009]
      info=Ajp13 forwarding over socket
      debug=5
      tomcatId=jboss02:8009
      port=8009
      host=192.168.1.203
      disabled=0

      [ajp13:192.168.1.203:8009]
      channel=channel.socket:192.168.1.203:8009
      group=lb
      lb_factor=1


      # Third Tomcat Instance
      [channel.socket:192.168.1.242:8009]
      info=Ajp13 forwarding over socket
      debug=5
      tomcatId=jboss01:8009
      port=8009
      host=192.168.1.242
      disabled=0

      [ajp13:192.168.1.242:8009]
      channel=channel.socket:192.168.1.242:8009
      group=lb
      lb_factor=1


      [status:]
      info=Status worker, displays runtime informations

      # Uri mapping
      [uri:/*.jsp]
      group=lb

      [uri:/bank/*]
      group=lb

      [uri:/servlet/*]
      group=lb

      I used the "all" configuration as it was proposed in the JBOSS Clustering Docs. My servers find each other, UDP Multicasting is working. I can even modify the customer in Duke's bank with the provided java client. So I Think that I have some problems with HA-JNDI or HTTP Session replication. And yes, I added the clustered and distributable tags. Any help would be appreciated. You will get an account in Duke's bank with $ 1.000.000 ....
      yours
      Chris

        • 1. Re: Clustering Duke's Bank wtih mod_jk2
          Mike Finn Apprentice

          When doing http session replication, everything on the session has to be serializable, including any attributes set on it (session.setAttribute()). Otherwise the session state can't be put over the wire to other nodes in the cluster.

          It looks like this line:
          org.apache.catalina.session.StandardSessionFacade.setAttribute(StandardSessionFacade.java:191)

          is putting something on the session that is not serializable.

          mike