Installation guide
<Context cookies="true" crossContext="true">
<Manager
className="org.jboss.web.tomcat.service.session.persistent.DataSourcePersis
tentManager"
dataSourceJndiName="java:HttpSessionDS"/>
:</Context>
Note
The className and dataSourceJndiName are compulsory attributes. You can also define
further Context and Manager attributes (refer to Section 18.1,
“DataSourcePersistentManager Configuration Attributes”.
Configuring Da ta base and Da tasource
Create the database session table, which will hold the web session data and then create the respective
datasource:
1. Create the web session ( httpsessions ) database table:
You can change the name of the table and of the columns; however, make sure to configure the
DataSourcePersistentManager attributes appropriately.
Individual columns must be able to store values of particular datatypes:
creationtime and lastaccess : java long values
maxinactive and version : java int value
metadata : serialized java objects (currently not used)
attributes : serialized java objects (stores the session attributes map; should be large enough
to store your largest sessions)
primary key : synthetic primary key (optional, make sure there is a UNIQUE INDEX on app + id).
The following command creates the table with default settings in the most common databases
(MySQL, IBM DB2, Oracle Database):
CREATE TABLE httpsessions (app VARCHAR(255) NOT NULL, id VARCHAR(255) NOT
NULL,
fullId VARCHAR(255) NOT NULL, creationtime BIGINT NOT NULL,
maxinactive BIGINT NOT NULL, version INT NOT NULL, lastaccess BIGINT
NOT NULL,
isnew CHAR(1) NOT NULL, valid CHAR(1) NOT NULL, metadata VARBINARY
NULL,
attributes LONGVARBINARY NOT NULL,
CONSTRAINT app_id PRIMARY KEY (app, id))
2. Deploy an appropriate datasource to allow the DataSourcePersistentManager to communicate
with the database (refer to the chapter on Datasource Configuration in the Administration and
Configuration Guide. Make sure the datasource is set up as local-tx-datasource (xa-datasources
are not supported).
3. Add the dataSourceJndiName with the jndi-name of the created datasource to
DataSourcePersistentManager element in the context.xml file.
18.1. DataSourcePersistentManager Configuration Attributes
The DataSourcePersistentManager element must define the className and dataSourceJndiName
attributes. Apart from these, it can define other properties to specify manager's behavior and the way it
interacts with the database.
Compulsory Properties
cla ssName
fully-qualified class name of the org.apache.catalina.Manager implementation (that is,
org.jboss.web.tomcat.service.session.persistent.DataSourcePersistentManager)
dataSourceJndiName
JNDI name of the data source, which defines the database connection to the httpsessions
Propert ies Defining the Databa se Connection Propert ies
connectionName
value of the username parameter to pass to the DataSource.getConnection method (if
null, the getConnection with no arguments is called)
JBoss Enterprise Application Platform 5 HTTP Connectors Load Balancing Guide 73