6 Deploying a Connect Web Cluster |
The correct JDBC driver needs to be added to the JBoss configuration as a new module. In general you create a module by creating a directory under $JBOSS_HOME/modules, copying the appropriate jar files to this directory, and creating a module.xml file that describes the module to JBoss.
Installing Oracle JDBC
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="oracle.jdbc.driver"> <resources> <resource-root path="ojdbc6.jar"/> <resource-root path="orai18n.jar"/> </resources> <dependencies> <module name="javax.api"/> </dependencies> </module>
Installing SQL Server JDBC
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="com.microsoft.sqlserver"> <resources> <resource-root path="sqljdbc4.jar"/> </resources> <dependencies> <module name="javax.api"/> </dependencies> </module>
Installing MySQL JDBC
<?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.1" name="mysql.jdbc.driver"> <resources> <resource-root path="mysql-connector-java-5.1.13-bin.jar"/> </resources> <dependencies> <module name="javax.api"/> </dependencies> </module>
<subsystem xmlns="urn:jboss:domain:datasources:1.0"> <datasources> <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true"> <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url> <driver>h2</driver> <security> <user-name>sa</user-name> <password>sa</password> </security> </datasource> <drivers> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> </driver> </drivers> </datasources> </subsystem>You will define a new datasource element and a new driver element for the Connect Web data source. Each data source has a minimum and maximum size setting for the connection pool. For the minimum, we recommend one connection per concurrent user. For maximum, we recommend three or more connections per concurrent user.
Oracle Data Source
<datasource jndi-name="java:/jdbc/BRICK_STREET_SOFTWARE_CONNECT_DS" pool-name="BRICK_STREET_SOFTWARE_CONNECT_DS" enabled="true"> <connection-url>jdbc:oracle:thin:@SERVER:1521:ORCL</connection-url> <driver>oraclejdbc</driver> <pool> <min-pool-size>10</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>true</prefill> </pool> <security> <user-name>USERNAME</user-name> <password>PASSWORD</password> </security> </datasource>In the drivers element, define:
<driver name="oraclejdbc" module="oracle.jdbc.driver"/>
SQL Server Data Source
<datasource jndi-name="java:/jdbc/BRICK_STREET_SOFTWARE_CONNECT_DS" pool-name="BRICK_STREET_SOFTWARE_CONNECT_DS" enabled="true"> <connection-url>jdbc:sqlserver://SERVER:1433;DatabaseName=CONNECT10</connection-url> <driver>sqlserverjdbc</driver> <pool> <min-pool-size>10</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>true</prefill> </pool> <security> <user-name>USERNAME</user-name> <password>PASSWORD</password> </security> </datasource>In the drivers element, define:
<driver name="sqlserverjdbc" module="com.microsoft.sqlserver"/>
MySQL Data Source
<datasource jndi-name="java:/jdbc/BRICK_STREET_SOFTWARE_CONNECT_DS" pool-name="BRICK_STREET_SOFTWARE_CONNECT_DS" enabled="true"> <connection-url>jdbc:mysql://SERVER:3306/CONNECT10</connection-url> <driver>mysqljdbc</driver> <pool> <min-pool-size>10</min-pool-size> <max-pool-size>20</max-pool-size> <prefill>true</prefill> </pool> <security> <user-name>USERNAME</user-name> <password>PASSWORD</password> </security> </datasource>In the drivers element, define:
<driver name="mysqljdbc" module="mysql.jdbc.driver"/>
To deploy Connect Web, copy connectweb.war to the JBoss deployment directory $JBOSS_HOME/standalone/deployments.
Run JBoss by running the standalone.sh script. Alternatively you can run JBoss as a service and have it started automatically at boot time.
JBoss 7 expects connectweb.war to be deployed within 60 seconds. If the deployment does not succeed, JBoss assumes the deployment has failed and terminates the deployment. If you see the following message in the JBoss log, you need to increase the deployment timeout.
ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015052: Did not receive a response to the deployment operation within the allowed timeout period [60 seconds]. Check the server configuration file and the server logs to find more about the status of the deployment.
<subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1"> <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" /> </subsystem>Add a deployment-timeout attribute to the deployment-scanner element. The attribute controls how many seconds JBoss will wait for the deployment operation to complete. The default value is 60. Increase this value until JBoss has sufficient time to deploy Connect Web.