JBoss 3.x config

Application Servers
JBoss config and usage

JBoss server configuration and Usage

 

Following are notes and information on configuration and usage of JBoss 3.x version server. The information below covers:

  1. Structure of JBoss folders
  2. How to configure JBoss
  3. Configuration of descriptors for Oracle Data source etc
  4. Using JMX Console to verify deployments, JNDI names etc

 

JBoss 3.2.3

 

JBoss Folder Structure

 

 

 

JBoss Folders

 

folder

Description

bin

Scripts to start and shut down JBoss

client

Java libraries (Jars) required by client applications to communicate with JBoss

docs

Sample configuration files for database configuration, etc.

lib

Jars shared by all JBoss configurations.

server

Various JBoss configurations. Predefined configurations which come with JBoss are all, default, minimal

server/all

JBoss’s complete configuration, starts clustering and IIOP also

server/minimal

Very basic services

server/default

Default JBoss configuration

server/default/conf

Configuration files

server/default/data

Database files used by JBoss and JbossMQ

server/default/deploy

Hot deployment directory for JBoss, any EJB, WAR, EAR or service file put in this folder is automatically deployed by JBoss

server/default/lib

Jars used by JBoss in default configuration

server/default/log

Log files. Server.log has JBoss startup, deployment, and application output using System.out.println().

 

 

 

 

 

 

JBoss Configuration Files

 

File

Description

Jbossmq-state.xml

JBossMQ (JMS provider) configuration

Jboss-service.xml

JBoss’s services (class loader, JNDI, deployers etc).

Log4j.xml

Configuration for logging

Login-config.xml

JBoss security configuration (JBossSX)

Standardjboss.xml

Default container configuration. Can be overridden by individual EJBs

Standardjbosscmp-jdbc.xml

Configuration for JBoss CMP 2.0 engine. Defines JDBC to SQL mappings for various databases, and other default CMP settings

 

 

 

 

 

 

JBoss server level configuration files:

 

 

standardjbosscmp-jdbc.xml defines the type mappings between Java, JDBC, and SQL, for various databases.

e.g. for oracle:

 

<mapping>

<java-type>java.lang.Integer</java-type>

<jdbc-type>INTEGER</jdbc-type>

<sql-type>NUMBER(10)</sql-type>

</mapping>

 

For MySQL:

 

<mapping>

<java-type>java.lang.Integer</java-type>

<jdbc-type>INTEGER</jdbc-type>

<sql-type>INTEGER</sql-type>

</mapping>

 

 

Running JBoss server

run.bat:

  1. Runs org.jboss.Main from run.jar located in JBOSS_HOME\bin folder.
  2. Run.bat can be modified to set memory options to JVM.

 

rem Sun JVM memory allocation pool parameters. Uncomment and modify as appropriate.

rem set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

 

Shutting down server:

  1. Run Shutdown.bat to shutdown the server.
  2. Or ctrl-C, the quick and not-so-dirty way.

 

 

Server log files:

 

JBOSS_HOME\server\default\log contains various log files:

  1. server.log: contains the startup log, and console log. Can be used for debugging any configuration or application errors: by checking deployment exceptions, application related exceptions, and application logs.

 

 

Oracle Datasource configuration:

  1. JBOSS_HOME\docs\examples\jca\oracle-ds.xml gives the template for configuration of an oracle datasource.
  2. Copy it into JBOSS_HOME\server\default\deploy, and modify for your own oracle configurations.
  3. Similarly, other database configuration templates for Mysql, Sybase, and other databases are found in the same folder.
  4. hsqldb-ds.xml contains configuration for HSQLDB, which by default is pre-configured for use. The JNDI name to access this datasource is: java:/DefaultDS.

 

In previous versions of JBoss (e.g. 3.0.6), datasource file names have names as oracle-service.xml, i.e., <DB_Name>-service.xml. The format of file is also different than in JBoss 3.2 version. So one should take care not to mix up the database configurations by copying files from 3.0 to 3.2 or vice versa. It may give unexpected results while running application.

 

To configure and use oracle through JBoss, Jar for oracle JDBC thin driver (classes12.jar etc) must be copied into JBoss default/lib directory. This provides the JDBC thin driver for oracle.

 

JMS configuration:

jbossmq-destinations-service.xml inside JBOSS_HOME\server\default\deploy\jms contains configuration for queues and topics. A topic called testTopic, and a queue called testQueue are defined, along with other items. New topics and queues can be defined in a similar manner.

 

 

Example of an Oracle-ds.xml:

<datasources>

<local-tx-datasource>

<jndi-name>OracleDS</jndi-name>

<connection-url>jdbc:oracle:thin:@databaseserver:1521:jdopoc</connection-url>

<!--

 

Here are a couple of the possible OCI configurations.

For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm

 

<connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>

or

<connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>

 

Clearly, its better to have TNS set up properly.

-->

<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

<user-name>rs</user-name>

<password>rs</password>

name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->

<!-- Checks the Oracle error codes and messages for fatal errors -->

<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

 

</local-tx-datasource>

 

</datasources>

 

 

 

Deployment in JBoss

JBoss constantly scans the JBOSS_HOME/server/default/deploy directory for any changes. It deploys any new Jar or other files if fresh ones are copied to the directory.

 

The type of files which are deployed by JBoss include:

  1. Any Jar. The classes are added to JBoss classpath.
  2. An EJB Jar.
  3. A WAR (Web Application Archive).
  4. An EAR (Enterprise Application Archive).
  5. An XML file containing JBoss MBean definitions.
  6. A directory ending in .jar, .war, or .ear, and containing the extracted content of an EJB JAR, a WAR, or an EAR.

 

To redeploy a Jar etc, overwrite the existing file with a more recent one. JBoss compares the timestamps, undeploys the previous files, and deploys the new ones.

 

To undeploy a Jar etc, remove it from the deploy directory.

 

 

JBoss Deployment Tips

To verify if a deployment is successful:

  1. Check JNDI names in JMX-Console. Go to service=JNDIView, click on list operation of MBean to see the configured JNDI names of various deployed applications.
  2. Check JBoss log. For a successfully deployed bean, it will give a message to that effect. Any errors can also be checked. Many a time, it will clearly point out to the error in deployment descriptor, or other errors etc.

 

 

Using JMX-Console

 

  1. Open http://localhost:8080/jmx-console. Go to Jboss:: service=JNDIView. Invoke List operation on MBean.
  2. Under Global JNDI Namespace, you can see various deployed EJBs, as well as queue and topic names, which have been configured.
  3. In case there is problem accessing a bean using a particular JNDI name, JMX-console can be used to verify that the particular JNDI name exists. If it does not, it could mean that the name is not configured properly, or deployment has not gone through properly.
  4. Managing Beans in JBoss through JMX console. Each EJB deployed in JBoss is managed as a JMX MBean. Go to Jboss.J2ee and click on any of the beans deployed to see its attributes.

 

 

 

References:

  1. www.jboss.org. Check JBoss forums for any issues with JBoss installation, configuration etc.