ATG applications running on JBoss use a JTDataSource
component, which should be configured to point to a JNDI reference to a DataSource
component running in JBoss.
The ATG platform installation includes an XML file that contains the default configurations for all the data sources for each application, along with a JNDI name for each data source. The ATG installer copies this XML file into the JBoss deploy
directory so that these data sources are started when JBoss starts.
Where to Configure JBoss Data Sources
You should configure your data source in the localconfig
, jbossconfig
, or equivalent named configuration layer. See “Managing Properties Files” in the ATG Programming Guide for information on application-server-specific and named configuration layers.
In order to use the jbossconfig
directory:
Modify the
MANIFEST.MF
file for the given ATG module to include the following property:
ATG-JbossConfig-Path: jbossconfig
Create a
jbossconfig
directory and put the properties files there.
Note: If JBoss configuration files are stored in the ATG-3rdPartyConfig-Path
layer, you might see errors if you start up applications on other application servers, because the datasources are configured to point to JNDI names that are not set up on that application server. Datasource configuration files that are specific to JBoss should be in the ATG-JBossConfig-Path
rather than the ATG-3rdPartyConfig-Path
of those data source configurations.
Configuring New JBoss Datasources
To configure a new data source, go to the <JBdir>\server\
server_name
\deploy\atg-solid-ds.xml
file. Rename the XML file to something appropriate (for example atg-oracle-ds.xml
), bearing in mind that the filename must end in –ds.xml
. Edit the following configuration settings:
JNDI name
URL
driver class
username
password
transaction isolation level
connection pool numbers
See your application server documentation for information on the available parameters. For example:
<?xml version="1.0" encoding="UTF-8"?> <datasources> <xa-datasource> <jndi-name>atgcore_ds</jndi-name> <track-connection-by-tx>false</track-connection-by-tx> <isSameRM-override-value>false</isSameRM-override-value> <min-pool-size>5</min-pool-size> <max-pool-size>100</max-pool-size> <blocking-timeout-millis>5000</blocking-timeout-millis> <idle-timeout-minutes>15</idle-timeout-minutes> <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction- isolation> <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa- datasource-class> <xa-datasource-property name="URL">jdbc:oracle:thin:@otto.na.ad.atg.com:1521:ora10r2</xa-datasource- property> <xa-datasource-property name="User">username</xa-datasource-property> <xa-datasource-property name="Password">password</xa-datasource-property> <!-- Uncomment the following if you are using Oracle 9i <xa-datasource-property name="oracle.jdbc.V8Compatible">true</xa- datasource-property> --> <exception-sorter-class-name> org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter </exception-sorter-class-name> </xa-datasource> </datasources>
If you have changed the JNDI name, you must also change the name configured in the <ATG9dir>/home/localconfig/atg/dynamo/service/jdbc/JTDataSource.properties
file:
$class=atg.nucleus.JNDIReference
JNDIName=JNDIDataSourceName
For example, java:/ATGOracleDS
.
Note that if you are using a WatcherDataSource
, this would be configured instead in a DirectJTDataSource.properties
file.
Adding Database Class Files
If your database driver is located anywhere other than the server’s lib directory (for example, C:\jboss\jboss-eap-4.3\jboss-as\server\
atg_server
\lib
), you must edit <JBdir>/bin/run.sh|bat
and add your database class files, such as Oracle’s ojdbc14.jar
, to the JBoss classpath. To do this, search for $JBOSS_CLASSPATH
and just above it, create a line:
JBOSS_CLASSPATH=path_to_ojdbc14.jar
Rebuild and redeploy your EAR file.