Hosting multiple instances of Address Book Server on the same server
Multiple instances Address Book Server can be configured to be running on the same server. Each instance can use it's own database as well as license file. The license file is used by the clients to authenticate with the server and should not be shared between instances. Sharing the same license could result in contact and event records becoming distributed across different instances and is strongly discouraged. This feature is only supported with Address Book Server released after the 15th December 2009.
Different instances are configured by modifying the server.xml file in the conf folder. The default installation already contains one Context section.
<Context path="" docBase="AddressBookServer.war">
<Environment name="LicenseFile" value="LicenseKey.license" type="java.lang.String" override="true"/>
<Environment name="BackupsFolder" value="../backups" type="java.lang.String" override="true"/>
<Resource name="jdbc/AddressBookDB" auth="Container" type="javax.sql.DataSource"
maxActive="25" maxIdle="5" maxWait="-1"
username="sa" password="" driverClassName="org.h2.Driver"
url="jdbc:h2:tcp://localhost:48081/../db/AddressBookDB;LOCK_TIMEOUT=60000"/>
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.h2.Driver"
connectionURL="jdbc:h2:tcp://localhost:48081/../db/AddressBookDB;LOCK_TIMEOUT=60000"
connectionName="sa" connectionPassword=""
userTable="WEBUSERS" userNameCol="USERID" userCredCol="PASSWORD"
userRoleTable="WEBROLES" roleNameCol="ACCESSROLE"/>
</Context>
Additional instances can be added by adding further Context sections as shown here. This example configured a second instance accessible via http://localhost:8080/clientA. The path attribute on the context tag specify the URL on which the new instance is accessible. The license and database parameters are set using Environment entries. The database entries set in via Environment parameters must match those specified in the data source defined in the Resource tag.
<Context path="/clientA" docBase="AddressBookServer.war">
<Environment name="LicenseFile" value="LicenseKeyClientA.license" type="java.lang.String" override="true"/>
<Environment name="BackupsFolder" value="../backupsA" type="java.lang.String" override="true"/>
<Environment name="DatabaseFolder" value="../db" type="java.lang.String" override="true"/>
<Environment name="DatabaseName" value="AddressBookDB_A" type="java.lang.String" override="true"/>
<Resource name="jdbc/AddressBookDB" auth="Container" type="javax.sql.DataSource"
maxActive="25" maxIdle="5" maxWait="-1"
username="sa" password="" driverClassName="org.h2.Driver"
url="jdbc:h2:tcp://localhost:48081/../db/AddressBookDB_A;LOCK_TIMEOUT=60000"/>
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.h2.Driver"
connectionURL="jdbc:h2:tcp://localhost:48081/../db/AddressBookDB_A;LOCK_TIMEOUT=60000"
connectionName="sa" connectionPassword=""
userTable="WEBUSERS" userNameCol="USERID" userCredCol="PASSWORD"
userRoleTable="WEBROLES" roleNameCol="ACCESSROLE"/>
</Context>
A third instance is added.
The default instance accessible via http://localhost:8080 First additional instance accessible via htp://localhost:8080/clientA Second additional instance accessible via htp://localhost:8080/clientB
<Context path="/clientB" docBase="AddressBookServer.war">
<Environment name="LicenseFile" value="LicenseKeyClientB.license" type="java.lang.String" override="true"/>
<Environment name="BackupsFolder" value="../backupsB" type="java.lang.String" override="true"/>
<Environment name="DatabaseFolder" value="../db" type="java.lang.String" override="true"/>
<Environment name="DatabaseName" value="AddressBookDB_B" type="java.lang.String" override="true"/>
<Resource name="jdbc/AddressBookDB" auth="Container" type="javax.sql.DataSource"
maxActive="25" maxIdle="5" maxWait="-1"
username="sa" password="" driverClassName="org.h2.Driver"
url="jdbc:h2:tcp://localhost:48081/../db/AddressBookDB_B;LOCK_TIMEOUT=60000"/>
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="org.h2.Driver"
connectionURL="jdbc:h2:tcp://localhost:48081/../db/AddressBookDB_B;LOCK_TIMEOUT=60000"
connectionName="sa" connectionPassword=""
userTable="WEBUSERS" userNameCol="USERID" userCredCol="PASSWORD"
userRoleTable="WEBROLES" roleNameCol="ACCESSROLE"/>
</Context>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)