6.2 Deploying Connect Web in RedHat JBoss 7

Install JDBC Driver

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

  1. Create directory $JBOSS_HOME/modules/oracle/jdbc/driver/main.
  2. Copy ojdbc6.jar and orai18n.jar from $KCHOME/import to here.
  3. Create a file named module.xml in this directory with the following structure:
<?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

  1. Create dir $JBOSS_HOME/modules/com/microsoft/sqlserver/main.
  2. Copy $KCHOME/import/sqljdbc4.jar to here.
  3. Create a file named module.xml in this directory with the following structure:
<?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

  1. Create directory $JBOSS_HOME/modules/mysql/jdbc/driver/main
  2. Copy $KCHOME/import/mysql-connector-java-5.1.13-bin.jar to here
  3. Create a file named module.xml in this directory with the following structure:
<?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>
            

Create Data Source Definition for Connect Web

Once the JDBC driver module is defined, the next step is to define a J2EE data source that will be used by Connect Web. In JBoss 7, data sources are defined in the $JBOSS_HOME/standalone/configuration/standalone.xml file. This file will contain a subsystem element that looks like this:
<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.
Note: You may only define one data source since they all use the same name and cannot coexist.

Oracle Data Source

For Oracle, add the following datasource element:
<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

For SQL Server, add the following datasource element:
<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

For MySQL, add the following datasource element:
<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"/>                    
                

Deploy connectweb.war to the JBoss Server

To deploy Connect Web, copy connectweb.war to the JBoss deployment directory $JBOSS_HOME/standalone/deployments.

Running JBoss

Run JBoss by running the standalone.sh script. Alternatively you can run JBoss as a service and have it started automatically at boot time.

Troubleshooting

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.
To increase the timeout, edit this entry in the standalone.xml file:
<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.