Configuring Enterprise Services

Recommended by 0 users

Configuring Enterprise Services

This chapter completes the configuration of the application server, by adding a comprehensive description of the Java Enterprise services that can be run on top of the application server. Each service itself is a core subsystem, which can be included or removed, depending on the kind of applications you are delivering. Here, we will describe the most interesting ones, which have been increasingly adopted by the application server end-users, going in the following order of topics:

  • Configure the database connectivity
  • Configure the enterprise Java Bean container
  • Configure the messaging service
  • Configure the transaction service

Configuring database connectivity

In any application server, you can configure database connectivity by adding datasources to your server configuration. Each datasource contains a pool of database connections that are reserved as soon as the server is started up. Applications acquire a database connection from the datasource by looking it up on the JNDI tree and then calling getConnection().

Connection result = null;

try {

Context initialContext = new


DataSource datasource = (DataSource)initialContext.lookup(“java:/MySqlDS”);

result = datasource.getConnection();

} catch ( Exception ex )

{   log(“Cannot get connection: ” + ex);


Once the connection is established, the application should call connection.close() as early as possible, which returns the database connection to the pool for other applications to use.

Earlier JBoss AS releases needed a well-known datasource configuration file (ending in –ds.xml), which had to be deployed in order to be used by applications. Since the release 7 of JBoss AS, you need to use a different approach, because of the modular nature of the application server.

Out of the box, the application server ships with the H2 open source database engine (http://www.h2database.com), which can be used for testing purposes because of its small footprint and its useful browser-based console.

However, a real world application requires an industry standard database, such as Oracle database or MySQL. In the following section, we will show how to configure a datasource for the MySQL database.

Basically, any database configuration requires a two-step procedure:

  • Installing the JDBC driver.
  • Adding the datasource to your configuration.

0 Responses on Configuring Enterprise Services"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.