The configuration file used for shark beans configuration is Shark.conf and is located in sharkejb.war (in WEB-INF/classes), which is inside EAR file.
For now, shark is defined to work with HSQL database.
Beside this configuration file, property file describing database defined by DataSourceName should be set on the proper place for each EJB container.
This chapter explains more detail all settings needed for different EJB containers.
When proper configuration files are set to the desired values, EAR should be generated. In configure.properties file (located in <shark_install_dir> directory) should be set the name of EJB container for which will the EAR be generated for. The name of this parameter is ejb_container and the possible values are jboss, jonas, geronimo and jboss-ws. The default value is jboss.
# EJB container for which the ear file will be built, pick one of: # jboss, jboss-ws, jonas, geronimo # NOTE: if you pick jboss-ws, it will build ear for JBoss with possibility # to expose beans as WebServices ejb_container=jboss
Value jboss-ws means that EAR file will be built for JBOSS server with possibility to expose shark's stateless session beans as WebServices.
Also, in this file can be set the database that will be used (the default value is HSQL):
# database vendor, pick one of: # db2, hsql, informix, msql, msql2005, mysql, oracle, postgresql, sybase db_loader_job=msql
and the location of JDBC driver (needed for all databases except HSQL):
# directory containing JDBC driver jar/zip files db_ext_dirs=C:/drivers/MSQL
For the database defined in this property file will all configuration files needed for the EJB be generated for.
After all parameters are set, the EAR file is being generated by running configure.bat script (for windows) or configure.sh script (for linux), located in <shark_install_dir> directory. After generation, the proper EAR file and other needed files are placed in <shark_install_dir>/EJB directory.
The configuration file that will be generated for JOnAS EAR is called Shark.conf.in and is located in <shark_install_dir>/.dist/EJB/conf directory. During the build of EAR, the parameters specific for JOnAS will be set to the following values:
DatabaseManager.defaults.XATransactionManagerLookupName=java:comp/UserTransaction SharkTxSynchronizationFactory.XATransactionManagerLookupName=java:comp/UserTransaction DatabaseManager.DB.sharkdb.Connection.DataSourceName=jndi:sharkdb
The parameter DataSourceName has the following form: "jndi:<jndi name of the database defined in JOnAS>". In this example, jndi name is sharkdb.
The property file describing the database is called sharkdb.properties.in and is located in <shark_install_dir>/.dist/EJB/conf/jonas directory. During the EAR generation, this file will be generated for the database defined in configure.properties file under the name sharkdb.properties. After generation, this file should be placed in <jonas_root>/conf directory.
Here is given the example for Postgresql database:
jdbc.wrapper=org.enhydra.jdbc.standard.StandardXADataSource jdbc.minconpool=12 jdbc.maxconpool=180 jdbc.connmaxage=30 jdbc.connchecklevel=1 datasource.description=Shark WfEngine DataSource jdbc.connteststmt=SELECT 1 datasource.name=sharkdb datasource.classname=org.postgresql.Driver datasource.url=jdbc:postgresql://localhost/shark datasource.username=sa datasource.password=sa
Database drivers, if not already added to JOnAS, should be added somewhere in <jonas_root>/lib directory (for example, in <jonas_root>/lib/commons/jonas).
When JOnAS is started, the database must be deployed (JOnAS server loads data source, related jdbc drivers, and registers the data sources into JNDI). The easiest way to do it is to use JOnAS Admin tool (URL http://<localhost:connection_port>/jonasAdmin). By default, the url is http://localhost:9000/jonasAdmin/.
By default, username for JOnAS admin is "jonas", and password is also "jonas".
When admin application appears, go to Domain -> Server JOnAS -> Resources ->Database (JDBC).
Then, on Deployment card, choose sharkdb database and deploy it.
The another way for database deployment is to add database to deployment list defined by jonas.service.dbm.datasources parameter in <jonas_root>/conf/jonas.properties file. This parameter contains a coma-separated list of DataSources that will be deployed at JOnAS start.
For example:
jonas.service.dbm.datasources HSQL1,sharkdb