1 Reply Latest reply on Feb 12, 2004 7:45 AM by hkotsubo

    Jboss + Tomcat and Database stored sessions

    hkotsubo

      Hi!

      I'm using Jboss 3.2.1 with Tomcat 4.1.24, and Tomcat is running as a Jboss MBean.

      I want to control the number of sessions each application can have. To do this, I'm trying to store sessions in a postgresql database, and use the Tomcat PersistentManager Implementation.

      The tomcat configuration is under the Jboss deploy directory, at the following path:

      /opt/jboss/server/default/deploy/jbossweb-tomcat.sar/

      In this directory I have all the jar files needed by tomcat, a web.xml file and a META-INF directory, with a manifest file and a jboss-service.xml file

      I guess that something is wrong with one of the xml files.
      Can anyone help me?

      thanks
      Hugo Kotsubo
      <hugo@tendencies.com.br>

        • 1. Re: Jboss + Tomcat and Database stored sessions
          hkotsubo

          Here's the contents of the jboss-service.xml file:
          &lt;server&gt;

          &lt;mbean code="org.jboss.web.catalina.EmbeddedCatalinaService41"
          name="jboss.web:service=WebServer"&gt;

          &lt;attribute name="Java2ClassLoadingCompliance"&gt;true&lt;/attribute&gt;

          &lt;!--
          *******************************************************
          ****************** CLUSTERING *************************
          *******************************************************
          In order to activate HTTP Session clustering for Tomcat
          make sure you run JBoss's "all" configuration i.e.
          "run -c all"
          (the default configuration doesn't contain clustering)
          Furthermore, you may change SnapshotMode and
          SnapshotInterval attributes below to indicate when to
          synchronize changes with the other node(s).

          If you use Apache+mod_jk(2) you will most probably use
          the AJP1.3 connector below. Thus, if you so wish,
          you may comment (i.e. deactivate) the HTTP connector
          as it won't be used anymore.

          *******************************************************
          *******************************************************
          *******************************************************
          --&gt;
          &lt;!--
          If you are using clustering, the following two attributes
          define when the sessions are replicated to the other nodes.
          The default value, "instant", synchronously replicates changes
          to the other nodes. In this case, the "SnapshotInterval" attribute
          is not used.
          The "interval" mode, in association with the "SnapshotInterval"
          attribute, indicates that Tomcat will only replicates modified
          sessions every "SnapshotInterval" miliseconds at most.
          --&gt;
          &lt;attribute name="SnapshotMode"&gt;instant&lt;/attribute&gt; &lt;!-- you may switch to "interval" --&gt;
          &lt;attribute name="SnapshotInterval"&gt;2000&lt;/attribute&gt;

          &lt;attribute name="Config"&gt;
          &lt;Server&gt;
          &lt;Service name = "JBoss-Tomcat"&gt;
          &lt;Engine name="MainEngine" defaultHost="localhost"&gt;
          &lt;Logger className = "org.jboss.web.catalina.Log4jLogger"
          verbosityLevel = "debug" category = "org.jboss.web.localhost.Engine"/&gt;
          &lt;Host name="localhost"&gt;

          &lt;!-- Access logger --&gt;
          &lt;Valve className = "org.apache.catalina.valves.AccessLogValve"
          prefix = "localhost_access" suffix = ".log"
          pattern = "common" directory = "${jboss.server.home.dir}/log" /&gt;

          &lt;!-- Default context parameters --&gt;
          &lt;DefaultContext cookies = "true" crossContext = "true" override = "true"&gt;
          &lt;Manager className="org.apache.catalina.session.PersistentManager"
          debug="0" saveOnRestart="true" maxActiveSessions="-1"
          minIdleSwap="-1" maxIdleSwap="-1" maxIdleBackup="-1"&gt;
          &lt;Store className="org.apache.catalina.session.JDBCStore" driverName="org.postgresql.Driver"
          connectionURL="jdbc:postgresql://localhost:5432/hugo-bi?user=hugo&amp;password=hugo"
          sessionTable="tomcatsessions" sessionIdCol="id"
          sessionDataCol="data" sessionValidCol="valid" sessionAppCol="appname"
          sessionMaxInactiveCol="maxinactive" sessionLastAccessedCol="lastaccess"
          checkInterval="60" debug="99" /&gt;
          &lt;/Manager&gt;
          &lt;/DefaultContext&gt;
          &lt;/Host&gt;
          &lt;/Engine&gt;

          &lt;!-- A HTTP/1.1 Connector on port 8080 --&gt;
          &lt;Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
          port="8080" minProcessors="3" maxProcessors="10"
          enableLookups="true" acceptCount="10" debug="0"
          connectionTimeout="20000" useURIValidationHack="false" /&gt;

          &lt;!-- A AJP 1.3 Connector on port 8009 --&gt;
          &lt;Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
          port="8009" minProcessors="5" maxProcessors="75"
          enableLookups="true" redirectPort="8443"
          acceptCount="10" debug="0" connectionTimeout="20000"
          useURIValidationHack="false"
          protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/&gt;

          &lt;/Service&gt;
          &lt;/Server&gt;
          &lt;/attribute&gt;
          &lt;/mbean&gt;

          &lt;/server&gt;