JMS

Automate WebLogic 12c Deployment

In this post we show a step-by-step example of how to set-up a high available tuned Java EE environment by using scripts. We start with installing a Java Virtual Machine (in this case JRockit) and WebLogic 12c. We continue with configuring a domain and tune the Java Virtual Machine. Next, we show the steps involved in setting up a cluster (with machines, managed servers and resource such data sources and Java Messaging). When running on a WebLogic environment (without fusion middleware components of which an example can be found here) we can proceed as follows.

First, we have to decide which directory structure we are going to use. Below an example is given in which the binaries (that create the WebLogic run-time) are separated from the configuration.

/home/weblogic
	/jrockit-jdk1.6.0_29-R28.2.2-4.1.0 (created during the installation of JRockit)
	/weblogic12.1.1
		/installation (directory which will contain all the software)
			/coherence_3.7 (created during the installation of WebLogic Server)
			/wlserver_12.1 (created during the installation of WebLogic Server)
		/configuration
			/applications
				/base_domain (created during the configuration of WebLogic Server)
			/domains
				/base_domain (created during the configuration of WebLogic Server)
			/nodemanagers
				/base_domain (created during the configuration of WebLogic Server)

To install WebLogic (that uses JRockit as the Java Virtual Machine) we can use the following script

#!/bin/bash

SCRIPT=$(readlink -f $0)
SCRIPT_PATH=$(dirname $SCRIPT)

. ${SCRIPT_PATH}/SetEnvironmentVariables.sh

create_silent_install_files() {
	echo 'CREATING SILENT INSTALL FILES'
	echo '<?xml version="1.0" encoding="UTF-8" ?>
<domain-template-descriptor>
	<input-fields>
		<!-- Installation directory -->
		<data-value name="USER_INSTALL_DIR" value="'${JAVA_HOME}'"/>
		<!-- Optional installation of Demos and Samples -->
		<data-value name="INSTALL_DEMOS_AND_SAMPLES" value="false"/>
		<!-- Optional installation of Source Code -->
		<data-value name="INSTALL_SOURCE_CODE" value="false"/>
		<!-- Optional installation of Public JRE -->
		<data-value name="INSTALL_PUBLIC_JRE" value="false"/>
	</input-fields>
</domain-template-descriptor>' > ${SCRIPT_PATH}/silent-jrockit.xml

	echo '<?xml version="1.0" encoding="UTF-8"?>
<bea-installer>
	<input-fields>
		<!-- BEAHOME: The full path for the middleware home directory. -->
		<data-value name="BEAHOME" value="'${MIDDLEWARE_HOME}'"/>
		<!-- WLS_INSTALL_DIR: The full path for the directory where to install WebLogic Server. -->
		<data-value name="WLS_INSTALL_DIR" value="'${WEBLOGIC_HOME}'"/>
		<!-- OCP_INSTALL_DIR: The full path for the directory where to install Coherence. -->
		<data-value name="OCP_INSTALL_DIR" value="'${COHERENCE_HOME}'"/>
		<!-- COMPONENT_PATHS: Specify the components and subcomponents to install. -->
		<data-value name="COMPONENT_PATHS" value="WebLogic Server/Core Application Server|WebLogic Server/Administration Console|WebLogic Server/Configuration Wizard and Upgrade Framework|WebLogic Server/Web 2.0 HTTP Pub-Sub Server|WebLogic Server/WebLogic SCA|WebLogic Server/WebLogic JDBC Drivers|WebLogic Server/Third Party JDBC Drivers|WebLogic Server/WebLogic Server Clients|WebLogic Server/Xquery Support|Oracle Coherence/Coherence Product Files"/>
		<!-- INSTALL_NODE_MANAGER_SERVICE: Install Node Manager as a Windows service. -->
		<data-value name="INSTALL_NODE_MANAGER_SERVICE" value="no"/>
		<!-- LOCAL_JVMS: Select JVMs which are already installed. -->
		<data-value name="LOCAL_JVMS" value="'${JAVA_HOME}'"/>
		<!-- BEA_BUNDLED_JVMS: Option to select BEA bundled JVMS -->
                <data-value name="BEA_BUNDLED_JVMS" value=""/>
	</input-fields>
</bea-installer>' > ${SCRIPT_PATH}/silent-weblogic.xml
}

install_jrockit() {
	echo 'INSTALLING JAVA VIRTUAL MACHINE'
	${SOFTWARE_DIRECTORY}/${JVM_FILE_NAME} -mode=silent -silent_xml=${SCRIPT_PATH}/silent-jrockit.xml -log=${SCRIPT_PATH}/logs/jrockit-install.log

	echo 'ADJUST ENTROPY GATHERING DEVICE SETTINGS'
	sed '/securerandom/ s_file:/dev/urandom_file:/dev/./urandom_' ${JAVA_HOME}/jre/lib/security/java.security > ${SCRIPT_PATH}/java.security
	mv ${SCRIPT_PATH}/java.security ${JAVA_HOME}/jre/lib/security/java.security
}

install_weblogic() {
	echo 'INSTALLING WEBLOGIC SERVER'
	${JAVA_HOME}/bin/java -Xms512m -Xmx512m -jar ${SOFTWARE_DIRECTORY}/${WEBLOGIC_FILE_NAME} -mode=silent -silent_xml=${SCRIPT_PATH}/silent-weblogic.xml -log=${SCRIPT_PATH}/logs/weblogic-install.log
}

copy_endorse_jars() {
	echo 'COPY ENDORSE JARS'
	mkdir -p ${JAVA_HOME}/jre/lib/endorsed
	cp ${MIDDLEWARE_HOME}/wlserver_12.1/endorsed/*.jar ${JAVA_HOME}/jre/lib/endorsed
}

create_silent_install_files

install_jrockit

install_weblogic

copy_endorse_jars

Note that the ‘copy endorse jars’ is necessary in the case of JRockit as this is based on JDK6 and not JDK7. When running on multiple machines the script has to be executed on every machine where WebLogic is going to run. In this case it is beneficiary to use a shared storage as a place to keep the software that has to be installed (such as the jrockit-jdk1.6.0_29-R28.2.2-4.1.0-linux-x64.bin file and the wls1211_generic.jar file) In the script above we set the essential variables, such as MIDDLEWARE_HOME, in a file called SetEnvironmentVariables.sh which in our case has the following contents

#!/bin/sh

# Directory where the software to be installed is located
SOFTWARE_DIRECTORY="/home/weblogic/temp/install_files"
export SOFTWARE_DIRECTORY

# Name of JVM file
JVM_FILE_NAME="jrockit-jdk1.6.0_29-R28.2.2-4.1.0-linux-x64.bin"
export JVM_FILE_NAME

# Name of the WebLogic file
WEBLOGIC_FILE_NAME="wls1211_generic.jar"
export WEBLOGIC_FILE_NAME

# Directory base that will be used for the JVM and WebLogic
BASE_DIRECTORY="/home/weblogic"
export BASE_DIRECTORY

# Directory where the JVM will be installed
JAVA_HOME="${BASE_DIRECTORY}/jrockit-jdk1.6.0_29"
export JAVA_HOME

# Directory where WebLogic will be installed
MIDDLEWARE_HOME="${BASE_DIRECTORY}/weblogic12.1.1/installation"
export MIDDLEWARE_HOME

# Depending on the WebLogic version to be installed, edit the wlserver_major.minor version
WEBLOGIC_HOME="${MIDDLEWARE_HOME}/wlserver_12.1"
export WEBLOGIC_HOME

# Depending on the Coherence version to be installed, edit the coherence_major.minor version
COHERENCE_HOME="${MIDDLEWARE_HOME}/coherence_3.7"
export COHERENCE_HOME

Note that these settings are used to create response files, which are used by the JRockit and WebLogic installers (and reflect our directory structure presented above).

[weblogic@middleware-magic setup]$ ./InstallSoftwareService.sh
CREATING SILENT INSTALL FILES
INSTALLING JAVA VIRTUAL MACHINE
Extracting 0%....................................................................................................100%
ADJUST ENTROPY GATHERING DEVICE SETTINGS
INSTALLING WEBLOGIC SERVER
Extracting 0%....................................................................................................100%
COPY ENDORSE JARS

Once the software is installed we continue with creating a domain. We split the creation of the domain in two phases. The first phase creates a basic domain (with an Admin Server) and sets up the node manager on the machine where the Admin Server is running. The second phase creates the deployment environment, such as clusters, machines, managed servers, messaging resource etcetera. In this manner we create different building blocks to set-up different domains. To set-up a basic domain (Node Manager plus AdminServer) we can use the following WLST script

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;

def createFile(directory_name, file_name, content):
	dedirectory = java.io.File(directory_name);
	defile = java.io.File(directory_name + '/' + file_name);

	writer = None;
	try:
		dedirectory.mkdirs();
		defile.createNewFile();
		writer = java.io.FileWriter(defile);
		writer.write(content);
	finally:
		try:
			print 'WRITING FILE ' + file_name;
			if writer != None:
				writer.flush();
				writer.close();
		except java.io.IOException, e:
			e.printStackTrace();

print 'CREATE DOMAIN';
readTemplate(weblogic_template);
setOption('DomainName', domain_name);
setOption('OverwriteDomain', 'true');
setOption('JavaHome', jvm_directory);
setOption('ServerStartMode', 'prod');
cd('/Security/base_domain/User/weblogic');
cmo.setName(admin_username);
cmo.setUserPassword(admin_password);
cd('/');

print "SAVE DOMAIN";
writeDomain(domain_home);
closeTemplate();

print 'READ DOMAIN';
readDomain(domain_home);

print "SET NODE MANAGER CREDENTIALS";
cd("/SecurityConfiguration/" + domain_name);
cmo.setNodeManagerUsername(node_manager_username);
cmo.setNodeManagerPasswordEncrypted(node_manager_password);

print "DISABLE HOSTNAME VERIFICATION";
cd('/Server/AdminServer');
create('AdminServer','SSL');
cd('SSL/AdminServer');
cmo.setHostnameVerificationIgnored(true);
cmo.setHostnameVerifier(None);
cmo.setTwoWaySSLEnabled(false);
cmo.setClientCertificateEnforced(false);

print 'SAVE CHANGES';
updateDomain();
closeDomain();

print 'CREATE FILES';
directory_name = domain_home + '/servers/AdminServer/security';
file_name = 'boot.properties';
content = 'username=' + admin_username + '\npassword=' + admin_password;
createFile(directory_name, file_name, content);

directory_name = domain_application_home;
file_name = 'readme.txt';
content = 'This directory contains deployment files and deployment plans.\nTo set-up a deployment, create a directory with the name of the application.\nSubsequently, create two sub-directories called app and plan.\nThe app directory contains the deployment artifact.\nThe plan directory contains the deployment plan.';
createFile(directory_name, file_name, content);

directory_name = node_manager_home;
file_name = 'nodemanager.properties';
content='DomainsFile=' + node_manager_home + '/nodemanager.domains\nLogLimit=0\nPropertiesVersion=10.3\nDomainsDirRemoteSharingEnabled=false\njavaHome=' + jvm_directory + '\nAuthenticationEnabled=true\nNodeManagerHome=' + node_manager_home + '\nJavaHome=' + jvm_directory + '/jre\nLogLevel=INFO\nDomainsFileEnabled=true\nStartScriptName=startWebLogic.sh \nListenAddress=\nNativeVersionEnabled=true\nListenPort=5556\nLogToStderr=true\nSecureListener=true\nLogCount=1\nDomainRegistrationEnabled=false\nStopScriptEnabled=false\nQuitEnabled=false\nLogAppend=true\nStateCheckInterval=500\nCrashRecoveryEnabled=false\nStartScriptEnabled=true\nLogFile=' + node_manager_home + '/nodemanager.log\nLogFormatter=weblogic.nodemanager.server.LogFormatter\nListenBacklog=50';
createFile(directory_name, file_name, content);

To enroll the node manager we can use

import socket;
admin_server_listen_address = socket.gethostname();
admin_server_url = 't3://' + admin_server_listen_address + ':' + admin_server_listen_port;

print 'START ADMIN SERVER';
startServer(admin_server_name, domain_name, admin_server_url, admin_username, admin_password, domain_home);

print 'CONNECT TO ADMIN SERVER';
connect(admin_username, admin_password, admin_server_url);

print 'ENROLL NODE MANAGER AND CREATE NODEMANAGER.DOMAINS';
nmEnroll(domain_home,node_manager_home);

print 'SHUTDOWN ADMIN SERVER';
shutdown(admin_server_name,'Server','true',1000,'true');

Now, we can use the start and stop scripts presented in the post WLST Starting and Stopping a WebLogic Environment, in order to test the set-up, i.e., start the AdminServer by using the Node Manager.

To set-up our deployment environment (cluster, machines, managed servers, data source, and JMS) we can use something like

import socket;

cluster_name='cluster';
machine_listen_addresses=['middleware-magic.com'];
machine_user_id='weblogic';
machine_group_id='weblogic';
number_of_managed_servers_per_machine=2;
managed_server_listen_port_start=9001;
jvm_parameters='-jrockit -Xms1024m -Xmx1024m -Xgc:throughput';

sub_deployment_name='SubDeployment';
connection_factory_name='ConnectionFactory';
connection_factory_jndi_name='jms/ConnectionFactory';
distributed_queue_name='DistributedQueue';
distributed_queue_jndi_name='jms/CompanyQueue';

data_source_name='DataSource';
data_source_jndi_name='jdbc/exampleDS';
data_source_url='jdbc:oracle:thin:@192.168.1.60:1521:orcl11';
data_source_driver='oracle.jdbc.OracleDriver';
data_source_user='example';
data_source_password='example';
data_source_test='SQL SELECT 1 FROM DUAL';

def connect_to_admin_server():
	print 'CONNECT TO ADMIN SERVER';
	admin_server_listen_address = socket.gethostname();
	admin_server_url = 't3://' + admin_server_listen_address + ':' + admin_server_listen_port;
	connect(admin_username, admin_password, admin_server_url);

def create_cluster():
	print 'CREATE CLUSTER';
	cluster = cmo.createCluster(cluster_name);
	cluster.setClusterMessagingMode('unicast');
	return cluster;

def create_machines_and_servers(cluster):
	print 'CREATE MACHINES AND SERVERS';
	for i in range(len(machine_listen_addresses)):
		machine = cmo.createUnixMachine('machine_' + machine_listen_addresses[i]);
		machine.setPostBindUIDEnabled(java.lang.Boolean('true'));
		machine.setPostBindUID(machine_user_id);
		machine.setPostBindGIDEnabled(java.lang.Boolean('true'));
		machine.setPostBindGID(machine_group_id);
		machine.getNodeManager().setListenAddress(machine_listen_addresses[i]);
		machine.getNodeManager().setNMType(node_manager_mode);
		for j in range(number_of_managed_servers_per_machine):
			managed_server_listen_port = managed_server_listen_port_start + j;
			managed_server_server_name = 'server_' + machine_listen_addresses[i] + '_' + repr(managed_server_listen_port);
			server = cmo.createServer(managed_server_server_name);
			server.setListenPort(managed_server_listen_port);
			server.setListenAddress(machine_listen_addresses[i]);
			server.getServerStart().setJavaHome(jvm_directory);
			server.getServerStart().setJavaVendor(jvm_vendor);
			server.getServerStart().setArguments(jvm_parameters);
			server.setCluster(cluster);
			server.setMachine(machine);	

def create_messaging_resources(targets):
	print 'CREATE JMS SYSTEM MODULE';
	module = cmo.createJMSSystemResource('SystemModule');
	module_targets = module.getTargets();
	module_targets.append(targets);
	module.setTargets(module_targets);
	module.createSubDeployment('SubDeployment');
	resource = module.getJMSResource();

	print 'CREATE CONNECTION FACTORY';
	resource.createConnectionFactory(connection_factory_name);
	connection_factory = resource.lookupConnectionFactory(connection_factory_name);
	connection_factory.setJNDIName(connection_factory_jndi_name);
	connection_factory.setDefaultTargetingEnabled(true);
	connection_factory.getTransactionParams().setTransactionTimeout(3600);
	connection_factory.getTransactionParams().setXAConnectionFactoryEnabled(true);

	print 'CREATE UNIFORM DISTRIBUTED QUEUE';
	resource.createUniformDistributedQueue(distributed_queue_name);
	distributed_queue = resource.lookupUniformDistributedQueue(distributed_queue_name);
	distributed_queue.setJNDIName(distributed_queue_jndi_name);
	distributed_queue.setLoadBalancingPolicy('Round-Robin');
	distributed_queue.setSubDeploymentName(sub_deployment_name);

	print 'CREATE FILE STORES AND JMS SERVERS';
	servers = cmo.getServers();
	sub_deployment_targets = [];
	for server in servers:
		if (server.getName() != admin_server_name):
			file_store = cmo.createFileStore('filestore_' + server.getName());
			file_store.setDirectory(domain_application_home);
			singleton_target = file_store.getTargets();
			singleton_target.append(server);
			file_store.setTargets(singleton_target);
			jms_server = cmo.createJMSServer('jmsserver_' + server.getName());
			jms_server.setPersistentStore(file_store);
			jms_server.setTargets(singleton_target);
			sub_deployment_targets.append(ObjectName(repr(jms_server.getObjectName())));

	cd('/JMSSystemResources/SystemModule/SubDeployments/' + sub_deployment_name);
	set('Targets', jarray.array(sub_deployment_targets, ObjectName));
	cd('/');

def create_data_source(targets):
	print 'CREATE DATA SOURCE';
	data_source = cmo.createJDBCSystemResource(data_source_name);
	data_source_targets = data_source.getTargets();
	data_source_targets.append(targets);
	data_source.setTargets(data_source_targets);

	jdbc_resource = data_source.getJDBCResource();
	jdbc_resource.setName(data_source_name);

	data_source_params = jdbc_resource.getJDBCDataSourceParams();
	names = [data_source_jndi_name];
	data_source_params.setJNDINames(names);
	data_source_params.setGlobalTransactionsProtocol('EmulateTwoPhaseCommit');

	driver_params = jdbc_resource.getJDBCDriverParams();
	driver_params.setUrl(data_source_url);
	driver_params.setDriverName(data_source_driver);
	driver_params.setPassword(data_source_password);
	driver_properties = driver_params.getProperties();
	driver_properties.createProperty('user');
	user_property = driver_properties.lookupProperty('user');
	user_property.setValue(data_source_user);

	connection_pool_params = jdbc_resource.getJDBCConnectionPoolParams();
	connection_pool_params.setTestTableName(data_source_test);
	connection_pool_params.setConnectionCreationRetryFrequencySeconds(3600);

def start_edit_mode():
	print 'START EDIT MODE';
	edit();
	startEdit();

def save_and_active_changes():
	print 'SAVE AND ACTIVATE CHANGES';
	save();
	activate(block='true');

connect_to_admin_server();

start_edit_mode();

cluster = create_cluster();

create_machines_and_servers(cluster);

save_and_active_changes();

start_edit_mode();

create_messaging_resources(cluster);

create_data_source(cluster);

save_and_active_changes();

print 'DISCONNECT FROM THE ADMIN SERVER';
disconnect();

Here, the array containing the listen addresses determines how many machines will be created. Every machine will have a number of managed servers per machine set by the number_of_managed_servers_per_machine parameter (in the example above two managed servers are created for each machine). To run the script, we can use

#!/bin/sh

SCRIPT=$(readlink -f $0)
SCRIPT_PATH=$(dirname $SCRIPT)

. ${SCRIPT_PATH}/SetEnvironmentVariables.sh

${WEBLOGIC_HOME}/common/bin/wlst.sh -loadProperties ${SCRIPT_PATH}/environment.properties ${SCRIPT_PATH}/create_deployment_environment.py

in which environment.properties has the following contents

jvm_directory=/home/weblogic/temp/jrockit-jdk1.6.0_29
jvm_vendor=Oracle
weblogic_template=/home/weblogic/temp/weblogic12.1.1/installation/wlserver_12.1/common/templates/domains/wls.jar
domain_name=some_domain
domain_home=/home/weblogic/temp/weblogic12.1.1/configuration/domains/some_domain
domain_application_home=/home/weblogic/temp/weblogic12.1.1/configuration/applications/some_domain
node_manager_username=nodemanager
node_manager_password=magic12c
node_manager_home=/home/weblogic/temp/weblogic12.1.1/configuration/nodemanagers/some_domain
node_manager_listen_port=5556
node_manager_mode=ssl
admin_server_name=AdminServer
admin_username=weblogic
admin_password=magic12c
admin_server_listen_port=7001

When the create_deployment_environment script is run, the following output is observed

[weblogic@middleware-magic setup]$ ./CreateDeploymentEnvironmentService.sh 

CLASSPATH=/home/weblogic/temp/weblogic12.1.1/installation/patch_wls1211/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/weblogic/temp/weblogic12.1.1/installation/patch_ocp371/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/home/weblogic/temp/jrockit-jdk1.6.0_29/lib/tools.jar:/home/weblogic/temp/weblogic12.1.1/installation/wlserver_12.1/server/lib/weblogic_sp.jar:/home/weblogic/temp/weblogic12.1.1/installation/wlserver_12.1/server/lib/weblogic.jar:/home/weblogic/temp/weblogic12.1.1/installation/modules/features/weblogic.server.modules_12.1.1.0.jar:/home/weblogic/temp/weblogic12.1.1/installation/wlserver_12.1/server/lib/webservices.jar:/home/weblogic/temp/weblogic12.1.1/installation/modules/org.apache.ant_1.7.1/lib/ant-all.jar:/home/weblogic/temp/weblogic12.1.1/installation/modules/net.sf.antcontrib_1.1.0.0_1-0b2/lib/ant-contrib.jar::/home/weblogic/temp/weblogic12.1.1/installation/utils/config/10.3/config-launch.jar::/home/weblogic/temp/weblogic12.1.1/installation/wlserver_12.1/common/derby/lib/derbynet.jar:/home/weblogic/temp/weblogic12.1.1/installation/wlserver_12.1/common/derby/lib/derbyclient.jar:/home/weblogic/temp/weblogic12.1.1/installation/wlserver_12.1/common/derby/lib/derbytools.jar::

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

CONNECT TO ADMIN SERVER
Connecting to t3://middleware-magic.com:7001 with userid weblogic ...
Successfully connected to Admin Server 'AdminServer' that belongs to domain 'some_domain'.

Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.

START EDIT MODE
Location changed to edit tree. This is a writable tree with
DomainMBean as the root. To make changes you will need to start
an edit session via startEdit(). 

For more help, use help(edit)

Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
CREATE CLUSTER
CREATE MACHINES AND SERVERS
SAVE AND ACTIVATE CHANGES
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed
START EDIT MODE
Already in Edit Tree

Starting an edit session ...
Started edit session, please be sure to save and activate your
changes once you are done.
CREATE JMS SYSTEM MODULE
CREATE CONNECTION FACTORY
CREATE UNIFORM DISTRIBUTED QUEUE
CREATE FILE STORES AND JMS SERVERS
CREATE DATA SOURCE
SAVE AND ACTIVATE CHANGES
Saving all your changes ...
Saved all your changes successfully.
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released
once the activation is completed.
Activation completed
DISCONNECT FROM THE ADMIN SERVER
Disconnected from weblogic server: AdminServer

References

[1] WebLogic Scripting Tool Command Reference.
[2] WebLogic Server MBean Reference.
[3] WebLogic Scripting Tool.


Setting-up a High Available Tuned Java EE environment using JBoss EAP6

In this post we show a step-by-step example of how to set-up a high available tuned Java EE environment. We start with tuning the operating system. Next, we install the Java Virtual Machine and JBoss EAP6. We continue with configuring a domain and tune the Java Virtual Machine. Next, we show the steps involved in setting up a cluster. Subsequently, we show how to create resources needed for Java messaging and database communication. Once the resources are configured, we deploy a Spring Hibernate application that uses these resources.

Operating System Tuning

We start by adding a user under which we will install the necessary software

[root@machine1 ~]# groupadd javainstall -g 500
[root@machine1 ~]# useradd -g javainstall jboss
[root@machine1 ~]# passwd jboss
Changing password for user jboss.
New password: jbosseap6
Retype new password: jbosseap6
passwd: all authentication tokens updated successfully.

Some operating system tweaks are worth considering when we do not want to run against system restrictions:

  • Packet loss minimization – The operating system buffers must be large enough to handle incoming network traffic while the application is paused during garbage collection. Usually UDP (User Datagram Protocol) is used in order to transmit multicast messages to server instances in a cluster; to limit the need to retransmit UDP messages the size of the operating system buffers must be set appropriately to avoid excessive UDP datagram loss.
  • TCP/IP – On some systems the default value for the time wait interval is too high and needs to be adjusted. When the number approaches the maximum number of file descriptors per process, the application’s throughput will degrade, i.e., new connections have to wait for a free space in the application’s file descriptor table.
  • Swapping – Swapping, also known as paging, is the use of secondary storage to store and retrieve data for use in RAM. Swapping is automatically performed by the operating system and typically occurs when the available RAM memory is depleted. Swapping can have a significant impact on the performance and should thus be avoided.
  • Network interface card (NIC) – Configure the network card at it’s maximum link speed and at full duplex.
  • Maximum number of open file descriptors – Most operating systems handle sockets as a form of file access and use file descriptors to keep track of which sockets are open. To contain the resources per process, the operating system restricts the number of file descriptors per process. Linux limits the number of open file descriptors per process, by default this is equal to 1024. It could be that the 1024 limit does not offer optimal performance.
  • Large pages – Large pages are essentially blocks of contiguous physical memory addresses that are reserved for a process. Large pages improve performance of applications that access memory frequently. When large pages are used the application uses the translation look-aside buffer (TLB) in the processor more effectively. The TLB is a cache of recently used virtual-to-physical address space translations stored in the processor memory. To obtain data from memory, the processor looks up the TLB to find out the physical addresses (RAM or hard disk) that hold the required data. In the case of large pages, a single entry in the TLB could represent a large contiguous address space and thereby potentially reducing the TLB look-up frequency and avoiding frequent look-ups in the hierarchical page table stored in-memory.

The contents of /etc/sysctl.conf look as follows

# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges.
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0

# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

# increase TCP max buffer size (depending on the type of NIC and the round-trip time these values can be changed)
# Maximum TCP Receive Window
net.core.rmem_max = 8388608
net.core.rmem_default = 8388608
# Maximum TCP Send Window
net.core.wmem_max = 8388608
net.core.wmem_default = 8388608
#  memory reserved for TCP receive buffers (vector of 3 integers: [min, default, max])
net.ipv4.tcp_rmem = 4096 87380 8388608
# memory reserved for TCP send buffers (vector of 3 integers: [min, default, max])
net.ipv4.tcp_wmem = 4096 87380 8388608

# increase the length of the processor input queue
net.core.netdev_max_backlog = 30000
# maximum amount of memory buffers (could be set equal to net.core.rmem_max and net.core.wmem_max)
net.core.optmem_max = 20480
# socket of the listen backlog
net.core.somaxconn = 1024

# tcp selective acknowledgements (disable them on high-speed networks)
net.ipv4.tcp_sack = 1
net.ipv4.tcp_dsack = 1
# Timestamps add 12 bytes to the TCP header
net.ipv4.tcp_timestamps = 1
# Support for large TCP Windows - Needs to be set to 1 if the Max TCP Window is over 65535
net.ipv4.tcp_window_scaling = 1
# The interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe
net.ipv4.tcp_keepalive_time = 1800
# The interval between subsequential keepalive probes, regardless of what the connection has exchanged in the meantime
net.ipv4.tcp_keepalive_intvl = 30
# The number of unacknowledged probes to send before considering the connection dead and notifying the application layer
net.ipv4.tcp_keepalive_probes = 5
# The time that must elapse before TCP/IP can release a closed connection and reuse its resources.
net.ipv4.tcp_fin_timeout = 30
# Size of the backlog connections queue.
net.ipv4.tcp_max_syn_backlog=4096
# The tcp_tw_reuse setting is particularly useful in environments where numerous short connections are open and left in TIME_WAIT state, such as web servers.
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1

# The percentage of how aggressively memory pages are swapped to disk
vm.swappiness = 0
# The percentage of main memory the pdflush daemon should write data out to the disk.
vm.dirty_background_ratio=25
# The percentage of main memory the actual disk writes will take place.
vm.dirty_ratio=20

# set the number of huge pages based on the Hugepagesize, i.e., 2048kB
# when we want to reserve 1GB in huge pages we have to set the number of huge pages to:
# (1024*1024*1024*1)/(1024*1024*2) = 1073741824/2097152 = 512
vm.nr_hugepages = 512

# give permission to the group that runs the process to access the shared memory segment
# to this end open the /etc/group file and retrieve the group-id (javainstall:x:500:)
vm.hugetlb_shm_group = 500

The contents of /etc/security/limits.conf look as follows

# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain>        <type>  <item>  <value>
#
#Where:
#<domain> can be:
#        - an user name
#        - a group name, with @group syntax
#        - the wildcard *, for default entry
#        - the wildcard %, can be also used with %group syntax,
#                 for maxlogin limit
#
#<type> can have the two values:
#        - "soft" for enforcing the soft limits
#        - "hard" for enforcing hard limits
#
#<item> can be one of the following:
#        - core - limits the core file size (KB)
#        - data - max data size (KB)
#        - fsize - maximum filesize (KB)
#        - memlock - max locked-in-memory address space (KB)
#        - nofile - max number of open files
#        - rss - max resident set size (KB)
#        - stack - max stack size (KB)
#        - cpu - max CPU time (MIN)
#        - nproc - max number of processes
#        - as - address space limit (KB)
#        - maxlogins - max number of logins for this user
#        - maxsyslogins - max number of logins on the system
#        - priority - the priority to run user process with
#        - locks - max number of file locks the user can hold
#        - sigpending - max number of pending signals
#        - msgqueue - max memory used by POSIX message queues (bytes)
#        - nice - max nice priority allowed to raise to values: [-20, 19]
#        - rtprio - max realtime priority
#
#<domain>      <type>  <item>         <value>
#

#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4

# open file descriptors
@javainstall soft nofile 8192
@javainstall hard nofile 8192

# memlock - maximum locked in-memory address space (kB), we set this equal to:
# number_of_huge_pages * huge_page_size = 512 * 2048 = 1048576
@javainstall soft memlock 1048576
@javainstall hard memlock 1048576
# End of file

Configure networking

To set-up a static ip-address we can follow these steps. Edit /etc/sysconfig/network, the following gives an example

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=machine1.com

To have a static ip address we edit /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.1.155
NETMASK=255.255.255.0
TYPE=Ethernet
GATEWAY=192.168.1.1
IPV6INIT=no
USERCTL=no
DNS1=192.168.1.1

When one or more DNS servers are available, enter DN2, DNS3 etcetera. To see if the servers are resolved check the /etc/resolv.conf file

# Generated by NetworkManager
search com
nameserver 192.168.1.1

Note that the settings can be changed by using system-config-network. Finally, map the hostname to the IP-address. To this end, edit the /etc/hosts, for example,

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.155    machine1.com machine1

Restart the network service and check the configuration

[root@machine1 ~]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/2
                                                           [  OK  ]
[root@machine1 ~]# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:0C:29:9D:E0:3B
          inet addr:192.168.1.155  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe9d:e03b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1665 errors:0 dropped:0 overruns:0 frame:0
          TX packets:963 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1826803 (1.7 MiB)  TX bytes:72314 (70.6 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:960 (960.0 b)  TX bytes:960 (960.0 b)

Verify the static ip configuration by using, for example,

[root@machine1 ~]# ping -c 3 -M do -s 1468 192.168.1.60
PING 192.168.1.60 (192.168.1.60) 1468(1496) bytes of data.
1476 bytes from 192.168.1.60: icmp_seq=1 ttl=128 time=0.412 ms
1476 bytes from 192.168.1.60: icmp_seq=2 ttl=128 time=0.426 ms
1476 bytes from 192.168.1.60: icmp_seq=3 ttl=128 time=0.558 ms

--- 192.168.1.60 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.412/0.465/0.558/0.068 ms

Install the Java Virtual Machine

Before we start with the installation we first define our directory structure

/home/jboss
	/deploy
		/springhibernate
			/app
			/config
			/modules
	/eap/jboss-eap-6.0 (${JBOSS_HOME})
		/bin (contains scripts to run the domain controller and command-line interface)
		/domain/configuration
			domain.xml (domain configuration file)
			host.xml (host configuration file)
			mgmt-users.properties (this file contains the admin user and host users)
		/modules
			/com/oracle/database/main
			/org/springframework/main
	/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64 (${JAVA_HOME})
	/scripts (contains script to start the environment)

We are going to use openjdk. To install openjdk, we can use yum install java-1.7.0-openjdk-devel. Unfortunately, this is installed in the /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.version.x86_64 directory. As we want to control the location (and update process) we are going to tar the mentioned directory, and extract it in our preferred location. When the openjdk distribution has been extracted to the preferred location, edit the bash profile (vi ~/.bash_profile) and set the JAVA_HOME and PATH variable

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

JBOSS_HOME="/home/jboss/eap/jboss-eap-6.0"
export JBOSS_HOME

APACHE_HOME="/home/jboss/apache"
export APACHE_HOME

JAVA_HOME="/home/jboss/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64"
export JAVA_HOME

PATH=$JAVA_HOME/bin:$JBOSS_HOME/bin:$PATH:$HOME/bin
export PATH

Log out and in again to make the changes effective.

Install JBoss EAP

To install JBoss EAP run the following command java -Xms512m -Xmx512m -jar jboss-eap-6.0.1-installer.jar. This opens the graphical installer

  • Choose your language, for example, English and click ok
  • Accept the licence agreement, and click next
  • Select the installation path, for example, /home/jboss/eap and click next (click ok in the pop-up)
  • Create an admin user, for example, admin with password jbosseap6! and click next
  • We choose not to install quickstarts and click next
  • Select all the packages (default) and click next
  • Choose default as the socket binding set-up and click next
  • Choose not to start the server and click next
  • Click next on the installation summary
  • Click next twice and choose not to create shortcuts and click next
  • Generate an automatic install file and click done

The automatic install file has the following contents

<AutomatedInstallation langpack="eng">
	<com.izforge.izpack.panels.HTMLLicencePanel id="HTMLLicencePanel"/>
	<com.izforge.izpack.panels.TargetPanel id="DirectoryPanel">
		<installpath>/home/jboss/eap</installpath>
	</com.izforge.izpack.panels.TargetPanel>
	<com.izforge.izpack.panels.UserInputPanel id="Userinputpanel.0">
		<userInput>
			<entry key="adminPassword" value="4f0d0c202a4aadd1b8c25276f18be512"/>
			<entry key="adminUser" value="admin"/>
		</userInput>
	</com.izforge.izpack.panels.UserInputPanel>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.1">
		<userInput>
			<entry key="installQuickStarts" value="false"/>
		</userInput>
	</com.izforge.izpack.panels.UserInputPanel>
	<com.izforge.izpack.panels.JDKCheckPanel id="JDKCheckPanel"/>
	<com.izforge.izpack.panels.MavenRepoCheckPanel id="MavenRepoCheckPanel"/>
	<com.izforge.izpack.panels.TreePacksPanel id="TreePacksPanel">
		<pack index="0" name="eap-core" selected="true"/>
		<pack index="1" name="JBossEAP AppClient" selected="true"/>
		<pack index="2" name="JBossEAP Bin" selected="true"/>
		<pack index="3" name="JBossEAP Bundles" selected="true"/>
		<pack index="4" name="JBossEAP Docs" selected="true"/>
		<pack index="5" name="JBossEAP Domain" selected="true"/>
		<pack index="6" name="JBossAS Domain Shell Scripts" selected="true"/>
		<pack index="7" name="JBossEAP Modules" selected="true"/>
		<pack index="8" name="JBossEAP Standalone" selected="true"/>
		<pack index="9" name="JBossAS Standalone Shell Scripts" selected="true"/>
		<pack index="10" name="JBossEAP Welcome Content" selected="true"/>
		<pack index="11" name="JBossEAP Quickstarts" selected="false"/>
		<pack index="12" name="icons" selected="true"/>
		<pack index="13" name="Native Zips" selected="true"/>
		<pack index="14" name="Native RHEL6-x86_64" selected="true"/>
		<pack index="15" name="Native Utils RHEL6-x86_64" selected="true"/>
		<pack index="16" name="Native Webserver RHEL6-x86_64" selected="true"/>
	</com.izforge.izpack.panels.TreePacksPanel>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.2">
		<userInput>
			<entry key="portDecision" value="off"/>
		</userInput>
	</com.izforge.izpack.panels.UserInputPanel>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.3"/>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.4"/>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.5"/>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.6"/>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.7"/>
	<com.izforge.izpack.panels.UserInputPanel id="UserInputPanel.8">
		<userInput>
			<entry key="serverStartup" value="none"/>
		</userInput>
	</com.izforge.izpack.panels.UserInputPanel>
	<com.izforge.izpack.panels.SummaryPanel id="SummaryPanel"/>
	<com.izforge.izpack.panels.InstallPanel id="InstallPanel"/>
	<com.izforge.izpack.panels.ProcessPanel id="ProcessPanel"/>
	<com.izforge.izpack.panels.ShortcutPanel id="ShortcutPanel"/>
	<com.izforge.izpack.panels.FinishPanel id="FinishPanel"/>
</AutomatedInstallation>

To install JBoss on other machines we can use

[jboss@machine2 temp]$ java -Xms512m -Xmx512m -jar jboss-eap-6.0.1-installer.jar installscript.xml
[ Starting automated installation ]
Read pack list from xml definition.
Try to add to selection [Name: eap-core and Index: 0]
Try to add to selection [Name: JBossEAP AppClient and Index: 1]
Try to add to selection [Name: JBossEAP Bin and Index: 2]
Try to add to selection [Name: JBossEAP Bundles and Index: 3]
Try to add to selection [Name: JBossEAP Docs and Index: 4]
Try to add to selection [Name: JBossEAP Domain and Index: 5]
Try to add to selection [Name: JBossAS Domain Shell Scripts and Index: 6]
Try to add to selection [Name: JBossEAP Modules and Index: 7]
Try to add to selection [Name: JBossEAP Standalone and Index: 8]
Try to add to selection [Name: JBossAS Standalone Shell Scripts and Index: 9]
Try to add to selection [Name: JBossEAP Welcome Content and Index: 10]
Try to remove from selection [Name: JBossEAP Quickstarts and Index: 11]
Try to add to selection [Name: icons and Index: 12]
Try to add to selection [Name: Native Zips and Index: 13]
Try to add to selection [Name: Native RHEL6-x86_64 and Index: 14]
Try to add to selection [Name: Native Utils RHEL6-x86_64 and Index: 15]
Try to add to selection [Name: Native Webserver RHEL6-x86_64 and Index: 16]
Modify pack selection.
Pack [Name: JBossEAP Quickstarts and Index: 11] must be installed because it is required!
[ Starting to unpack ]
[ Processing package: eap-core (1/17) ]
[ Processing package: JBossEAP AppClient (2/17) ]
[ Processing package: JBossEAP Bin (3/17) ]
[ Processing package: JBossEAP Bundles (4/17) ]
[ Processing package: JBossEAP Docs (5/17) ]
[ Processing package: JBossEAP Domain (6/17) ]
[ Processing package: JBossAS Domain Shell Scripts (7/17) ]
[ Processing package: JBossEAP Modules (8/17) ]
[ Processing package: JBossEAP Standalone (9/17) ]
[ Processing package: JBossAS Standalone Shell Scripts (10/17) ]
[ Processing package: JBossEAP Welcome Content (11/17) ]
[ Processing package: icons (13/17) ]
[ Processing package: Native Zips (14/17) ]
[ Processing package: Native RHEL6-x86_64 (15/17) ]
[ Processing package: Native Utils RHEL6-x86_64 (16/17) ]
[ Processing package: Native Webserver RHEL6-x86_64 (17/17) ]
[ Unpacking finished ]
[ Starting processing ]
Starting process Running Password Script (1/2)
Starting process Unpacking natives (2/2)
[ Processing finished ]
[ Creating shortcuts  done. ]
[ Add shortcuts to uninstaller  done. ]
[ Writing the uninstaller data ... ]
[ Automated installation done ]

Test the installation by running domain.sh (located in ${JBOSS_HOME}/bin/).

JBoss Configuration

To configure the domain we can use the following

<domain xmlns="urn:jboss:domain:1.3">

    <extensions>
        <extension module="org.jboss.as.clustering.infinispan"/>
        <extension module="org.jboss.as.clustering.jgroups"/>
        <extension module="org.jboss.as.cmp"/>
        <extension module="org.jboss.as.configadmin"/>
        <extension module="org.jboss.as.connector"/>
        <extension module="org.jboss.as.ee"/>
        <extension module="org.jboss.as.ejb3"/>
        <extension module="org.jboss.as.jacorb"/>
        <extension module="org.jboss.as.jaxr"/>
        <extension module="org.jboss.as.jaxrs"/>
        <extension module="org.jboss.as.jdr"/>
        <extension module="org.jboss.as.jmx"/>
        <extension module="org.jboss.as.jpa"/>
        <extension module="org.jboss.as.jsr77"/>
        <extension module="org.jboss.as.logging"/>
        <extension module="org.jboss.as.mail"/>
        <extension module="org.jboss.as.messaging"/>
        <extension module="org.jboss.as.modcluster"/>
        <extension module="org.jboss.as.naming"/>
        <extension module="org.jboss.as.osgi"/>
        <extension module="org.jboss.as.pojo"/>
        <extension module="org.jboss.as.remoting"/>
        <extension module="org.jboss.as.sar"/>
        <extension module="org.jboss.as.security"/>
        <extension module="org.jboss.as.threads"/>
        <extension module="org.jboss.as.transactions"/>
        <extension module="org.jboss.as.web"/>
        <extension module="org.jboss.as.webservices"/>
        <extension module="org.jboss.as.weld"/>
    </extensions>

    <system-properties>
        <property name="java.net.preferIPv4Stack" value="true"/>
    </system-properties>

    <profiles>
        <profile name="cluster">
            <subsystem xmlns="urn:jboss:domain:logging:1.1">...</subsystem>
			...
            <subsystem xmlns="urn:jboss:domain:datasources:1.1">
                <datasources>
                    <datasource jta="true" jndi-name="java:/jdbc/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true" use-ccm="true">
                        <connection-url>jdbc:oracle:thin:@192.168.1.60:1521:orcl11</connection-url>
                        <driver>oracle</driver>
                        <pool>
                            <min-pool-size>1</min-pool-size>
                            <max-pool-size>15</max-pool-size>
                            <prefill>true</prefill>
                            <use-strict-min>true</use-strict-min>
                        </pool>
                        <security>
                            <user-name>example</user-name>
                            <password>example</password>
                        </security>
                        <timeout>
                            <idle-timeout-minutes>0</idle-timeout-minutes>
                            <query-timeout>600</query-timeout>
                        </timeout>
                        <statement>
                            <prepared-statement-cache-size>10</prepared-statement-cache-size>
                        </statement>
                    </datasource>
                    <drivers>
                        <driver name="oracle" module="com.oracle.database">
                            <driver-class>oracle.jdbc.OracleDriver</driver-class>
                            <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                        </driver>
                    </drivers>
                </datasources>
            </subsystem>
			...
            <subsystem xmlns="urn:jboss:domain:messaging:1.2">
                <hornetq-server>
                    <persistence-enabled>true</persistence-enabled>
                    <security-enabled>false</security-enabled>
                    <create-journal-dir>true</create-journal-dir>
                    <journal-type>ASYNCIO</journal-type>
                    <journal-buffer-timeout>500000</journal-buffer-timeout>
                    <journal-buffer-size>1048576</journal-buffer-size>
                    <journal-sync-transactional>true</journal-sync-transactional>
                    <journal-sync-non-transactional>true</journal-sync-non-transactional>
                    <journal-file-size>10485760</journal-file-size>
                    <journal-min-files>2</journal-min-files>
                    <journal-compact-min-files>10</journal-compact-min-files>
                    <journal-compact-percentage>30</journal-compact-percentage>
                    <journal-max-io>1024</journal-max-io>

                    <connectors>
                        <netty-connector name="netty" socket-binding="messaging"/>
                        <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
                            <param key="batch-delay" value="50"/>
                        </netty-connector>
                        <in-vm-connector name="in-vm" server-id="0"/>
                    </connectors>

                    <acceptors>
                        <netty-acceptor name="netty" socket-binding="messaging"/>
                        <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
                            <param key="batch-delay" value="50"/>
                            <param key="direct-deliver" value="false"/>
                        </netty-acceptor>
                        <in-vm-acceptor name="in-vm" server-id="0"/>
                    </acceptors>

                    <broadcast-groups>
                        <broadcast-group name="bg-group1">
                            <socket-binding>messaging-group</socket-binding>
                            <broadcast-period>5000</broadcast-period>
                            <connector-ref>
                                netty
                            </connector-ref>
                        </broadcast-group>
                    </broadcast-groups>

                    <discovery-groups>
                        <discovery-group name="dg-group1">
                            <socket-binding>messaging-group</socket-binding>
                            <refresh-timeout>10000</refresh-timeout>
                        </discovery-group>
                    </discovery-groups>

                    <cluster-connections>
                        <cluster-connection name="my-cluster">
                            <address>jms</address>
                            <connector-ref>netty</connector-ref>
                            <discovery-group-ref discovery-group-name="dg-group1"/>
                        </cluster-connection>
                    </cluster-connections>

                    <security-settings>
                        <security-setting match="#">
                            <permission type="send" roles="guest"/>
                            <permission type="consume" roles="guest"/>
                            <permission type="createNonDurableQueue" roles="guest"/>
                            <permission type="deleteNonDurableQueue" roles="guest"/>
                        </security-setting>
                    </security-settings>

                    <address-settings>
                        <address-setting match="#">
                            <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                            <expiry-address>jms.queue.ExpiryQueue</expiry-address>
                            <redelivery-delay>0</redelivery-delay>
                            <max-size-bytes>10485760</max-size-bytes>
                            <address-full-policy>BLOCK</address-full-policy>
                            <message-counter-history-day-limit>10</message-counter-history-day-limit>
                            <redistribution-delay>1000</redistribution-delay>
                        </address-setting>
                        <address-setting match="jms.queue.testQueue">
                            <dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address>
                            <expiry-address>jms.queue.expiryQueue</expiry-address>
                            <redelivery-delay>5000</redelivery-delay>
                            <max-delivery-attempts>3</max-delivery-attempts>
                            <max-size-bytes>104857600</max-size-bytes>
                            <address-full-policy>BLOCK</address-full-policy>
                            <last-value-queue>true</last-value-queue>
                            <redistribution-delay>0</redistribution-delay>
                            <send-to-dla-on-no-route>true</send-to-dla-on-no-route>
                        </address-setting>
                    </address-settings>

                    <jms-connection-factories>
                        <connection-factory name="InVmConnectionFactory">
                            <connectors>
                                <connector-ref connector-name="in-vm"/>
                            </connectors>
                            <entries>
                                <entry name="java:/ConnectionFactory"/>
                            </entries>
                        </connection-factory>
                        <connection-factory name="RemoteConnectionFactory">
                            <connectors>
                                <connector-ref connector-name="netty"/>
                            </connectors>
                            <entries>
                                <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                            </entries>
                        </connection-factory>
                        <pooled-connection-factory name="hornetq-ra">
                            <transaction mode="xa"/>
                            <connectors>
                                <connector-ref connector-name="in-vm"/>
                            </connectors>
                            <entries>
                                <entry name="java:/JmsXA"/>
                            </entries>
                        </pooled-connection-factory>
                    </jms-connection-factories>

                    <jms-destinations>
                        <jms-queue name="testQueue">
                            <entry name="java:/queue/test"/>
                            <entry name="java:jboss/exported/jms/queue/test"/>
                        </jms-queue>
                        <jms-queue name="deadLetterQueue">
                            <entry name="java:/queue/deadLetterQueue"/>
                            <entry name="java:jboss/exported/jms/queue/deadLetterQueue"/>
                            <durable>false</durable>
                        </jms-queue>
                        <jms-queue name="expiryQueue">
                            <entry name="java:/queue/expiryQueue"/>
                            <entry name="java:jboss/exported/jms/queue/expiryQueue"/>
                            <durable>false</durable>
                        </jms-queue>
                        <jms-topic name="testTopic">
                            <entry name="java:/topic/test"/>
                            <entry name="java:jboss/exported/jms/topic/test"/>
                        </jms-topic>
                    </jms-destinations>
                </hornetq-server>
            </subsystem>
			...
            <subsystem xmlns="urn:jboss:domain:weld:1.0"/>
        </profile>
    </profiles>

    <interfaces>
        <interface name="management"/>
        <interface name="public"/>
        <interface name="unsecure"/>
    </interfaces>

    <socket-binding-groups>
        <socket-binding-group name="cluster-sockets" default-interface="public">
            <socket-binding name="ajp" port="8009"/>
            <socket-binding name="http" port="8080"/>
            <socket-binding name="https" port="8443"/>
            <socket-binding name="jacorb" interface="unsecure" port="3528"/>
            <socket-binding name="jacorb-ssl" interface="unsecure" port="3529"/>
            <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45700"/>
            <socket-binding name="jgroups-tcp" port="7600"/>
            <socket-binding name="jgroups-tcp-fd" port="57600"/>
            <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
            <socket-binding name="jgroups-udp-fd" port="54200"/>
            <socket-binding name="messaging" port="5445"/>
            <socket-binding name="messaging-group" port="0" multicast-address="${jboss.messaging.group.address:231.7.7.7}" multicast-port="${jboss.messaging.group.port:9876}"/>
            <socket-binding name="messaging-throughput" port="5455"/>
            <socket-binding name="modcluster" port="0" multicast-address="224.0.1.105" multicast-port="23364"/>
            <socket-binding name="osgi-http" interface="management" port="8090"/>
            <socket-binding name="remoting" port="4447"/>
            <socket-binding name="txn-recovery-environment" port="4712"/>
            <socket-binding name="txn-status-manager" port="4713"/>
            <outbound-socket-binding name="mail-smtp">
                <remote-destination host="localhost" port="25"/>
            </outbound-socket-binding>
        </socket-binding-group>
    </socket-binding-groups>

    <server-groups>
        <server-group name="cluster-group" profile="cluster">
            <jvm name="default"/>
            <socket-binding-group ref="cluster-sockets"/>
        </server-group>
    </server-groups>

</domain>

In the example above, we have configured one profile (cluster), and a socket-binding-group. Finally, we have defined a server-group, that uses the profile and socket-binding-group. Note that the configuration above is default except for the messaging and the data-source. When using the Linux firewall (disabled in our case), we must configure the iptables appropriately. The servers that belong to the server-group, will be defined in the host configuration below.

Host Configuration

First, we create two management users called machine1 and machine2. To this end run the add-user.sh script located in the ${JBOSS_HOME}/bin directory. Next, we create host.xml files for each host, i.e., on machine1 we have

<host name="machine1" xmlns="urn:jboss:domain:1.3">

    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
				<!-- Needs to be added to hosts that are not the domain controller -->
				<!--server-identities>
					<secret value="amJvc3NlYXA2IQ==" />
				</server-identities-->
                <authentication>
                    <local default-user="$local" />
                    <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*" />
                    <properties path="application-users.properties" relative-to="jboss.domain.config.dir" />
                </authentication>
                <authorization>
                    <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
        </security-realms>
        <management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.native.port:9999}"/>
            </native-interface>
            <http-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.http.port:9990}"/>
            </http-interface>
        </management-interfaces>
    </management>

    <domain-controller>
       <local/>
    </domain-controller>

    <interfaces>
        <interface name="management">
            <nic name="eth1"/>
        </interface>
        <interface name="public">
            <nic name="eth1"/>
        </interface>
        <interface name="unsecure">
            <inet-address value="127.0.0.1"/>
        </interface>
    </interfaces>

    <jvms>
    	<jvm name="default">
            <heap size="512m" max-size="512m"/>
            <permgen size="256m" max-size="256m"/>
            <jvm-options>
                <option value="-server"/>
                <option value="-XX:NewRatio=2"/>
				<option value="-XX:SurvivorRatio=128"/>
				<option value="-XX:MaxTenuringThreshold=0"/>
                <option value="-XX:+UseParallelGC"/>
                <option value="-XX:ParallelGCThreads=2"/>
                <option value="-XX:MaxGCPauseMillis=200"/>
                <option value="-XX:GCTimeRatio=19"/>
                <option value="-XX:+UseParallelOldGC"/>
                <option value="-XX:+UseTLAB"/>
                <option value="-XX:LargePageSizeInBytes=2048k"/>
                <option value="-XX:+UseLargePages"/>
            </jvm-options>
        </jvm>
    </jvms>

    <servers>
        <server name="cluster-server1" group="cluster-group" auto-start="false"/>
        <server name="cluster-server2" group="cluster-group" auto-start="false">
            <socket-bindings port-offset="1"/>
        </server>
    </servers>
</host>

Note the local for the domain controller, this means that machine1 will act as our domain controller. We have used the following JVM parameters

  • -server – select the JIT compiler.
  • -Xms – initial heap size.
  • -Xmx – maximum heap size.
  • -XX:PermSize and -XX:MaxPermSize – size of the permanent generation.
  • -XX:NewRatio=N – sets the young generation to heap size / (1 + N).
  • -XX:SurvivorRatio – ratio of eden/survivor space size.
  • -XX:MaxTenuringThreshold – sets the maximum tenuring threshold (above we assume that objects that are not collected in the eden space are objects that will live for a long time).
  • -XX:+UseParallelGC – select the parallel collector.
  • -XX:ParallelGCThreads – sets the number of garbage collector threads, i.e., the number of CPUs to be used.
  • -XX:MaxGCPauseMillis – sets the maximum pause time goal.
  • -XX:GCTimeRatio=N – sets the throughput goal that is measured in terms of the time spent doing garbage collection versus the time spent outside of garbage collection. In the case above with N=19, the garbage collection time to application time is set to 1 / (1+N) = 1 / 20, i.e., 5% of the total time is spent in garbage collection.
  • -XX:-UseParallelOldGC – selects the parallel collector for major collections.
  • -XX:+UseTLAB – enables thread-local object allocation. More information on thread local allocation can be found in the ‘Compaction and Thread Local Area’ section of the Tune the JVM that runs Coherence post.
  • -XX:LargePageSizeInBytes – sets the large page size used for the Java heap. We set this equal to the operating system parameter: Hugepagesize, which in our case is 2048kB
  • -XX:+UseLargePages – use large page memory. The steps involved on how to configure large pages in the operating system can be found in the ‘Call profiling and large pages’ section of the Tune the JVM that runs Coherence post.

On the machine2 host we use the following host.xml file

<host name="machine2" xmlns="urn:jboss:domain:1.3">

    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
                <server-identities>
					<secret value="amJvc3NlYXA2IQ=="/>
                </server-identities>
                <authentication>
                    <local default-user="$local" />
                    <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*" />
                    <properties path="application-users.properties" relative-to="jboss.domain.config.dir" />
                </authentication>
                <authorization>
                    <properties path="application-roles.properties" relative-to="jboss.domain.config.dir"/>
                </authorization>
            </security-realm>
        </security-realms>
        <management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.native.port:9999}"/>
            </native-interface>
            <http-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.http.port:9990}"/>
            </http-interface>
        </management-interfaces>
    </management>

    <domain-controller>
       <remote host="machine1.com" port="9999" security-realm="ManagementRealm"/>
    </domain-controller>

    <interfaces>
        <interface name="management">
            <nic name="eth2"/>
        </interface>
        <interface name="public">
            <nic name="eth2"/>
        </interface>
        <interface name="unsecure">
            <inet-address value="127.0.0.1"/>
        </interface>
    </interfaces>

    <jvms>
    	<jvm name="default">
            <heap size="512m" max-size="512m"/>
            <permgen size="256m" max-size="256m"/>
            <jvm-options>
                <option value="-server"/>
                <option value="-XX:NewRatio=2"/>
				<option value="-XX:SurvivorRatio=128"/>
				<option value="-XX:MaxTenuringThreshold=0"/>
                <option value="-XX:+UseParallelGC"/>
                <option value="-XX:ParallelGCThreads=2"/>
                <option value="-XX:MaxGCPauseMillis=200"/>
                <option value="-XX:GCTimeRatio=19"/>
                <option value="-XX:+UseParallelOldGC"/>
                <option value="-XX:+UseTLAB"/>
                <option value="-XX:LargePageSizeInBytes=2048k"/>
                <option value="-XX:+UseLargePages"/>
            </jvm-options>
        </jvm>
    </jvms>

    <servers>
        <server name="cluster-server3" group="cluster-group" auto-start="false"/>
        <server name="cluster-server4" group="cluster-group" auto-start="false">
            <socket-bindings port-offset="1"/>
        </server>
    </servers>
</host>

The choice of the name of the host is very important, as a corresponding user name must be present in the mgmt-users.properties file on the host where the domain controller runs. Note that we tell this host where to find the domain controller, by using the remote element.

To test the set-up, we first start the domain controller on machine1

[jboss@machine1 bin]$ ./domain.sh
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /home/jboss/eap/jboss-eap-6.0

  JAVA: /home/jboss/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin/java

  JAVA_OPTS: -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.domain.default.config=domain.xml -Djboss.host.default.config=host.xml

=========================================================================

10:03:24,645 INFO  [org.jboss.modules] (main) JBoss Modules version 1.1.3.GA-redhat-1
10:03:24,784 INFO  [org.jboss.as.process.Host Controller.status] (main) JBAS012017: Starting process 'Host Controller'
[Host Controller] 10:03:25,189 INFO  [org.jboss.modules] (main) JBoss Modules version 1.1.3.GA-redhat-1
[Host Controller] 10:03:25,364 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.2.GA-redhat-2
[Host Controller] 10:03:25,455 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015899: JBoss EAP 6.0.1.GA (AS 7.1.3.Final-redhat-4) starting
[Host Controller] 10:03:25,979 INFO  [org.xnio] (MSC service thread 1-2) XNIO Version 3.0.7.GA-redhat-1
[Host Controller] 10:03:25,984 INFO  [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
[Host Controller] 10:03:25,990 INFO  [org.jboss.as] (Controller Boot Thread) JBAS010902: Creating http management service using network interface (management) port (9990) securePort (-1)
[Host Controller] 10:03:26,012 INFO  [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 3.2.14.GA-redhat-1
[Host Controller] 10:03:26,084 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on 192.168.1.155:9999
[Host Controller] 10:03:27,326 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://192.168.1.155:9990/management
[Host Controller] 10:03:27,328 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://192.168.1.155:9990
[Host Controller] 10:03:27,331 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.0.1.GA (AS 7.1.3.Final-redhat-4) (Host Controller) started in 2457ms - Started 11 of 11 services (0 services are passive or on-demand)
[Host Controller] 10:04:07,114 INFO  [org.jboss.as.domain] (slave-request-threads - 1) JBAS010918: Registered remote slave host "machine2", JBoss EAP 6.0.1.GA (AS 7.1.3.Final-redhat-4)

Next, we start the domain controller on machine2 (note the last log line above that the host has been registered)

[jboss@machine2 bin]$ ./domain.sh
=========================================================================

  JBoss Bootstrap Environment

  JBOSS_HOME: /home/jboss/eap/jboss-eap-6.0

  JAVA: /home/jboss/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/bin/java

  JAVA_OPTS: -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.domain.default.config=domain.xml -Djboss.host.default.config=host.xml

=========================================================================

10:03:55,491 INFO  [org.jboss.modules] (main) JBoss Modules version 1.1.3.GA-redhat-1
10:03:56,433 INFO  [org.jboss.as.process.Host Controller.status] (main) JBAS012017: Starting process 'Host Controller'
[Host Controller] 10:03:58,033 INFO  [org.jboss.modules] (main) JBoss Modules version 1.1.3.GA-redhat-1
[Host Controller] 10:03:58,431 INFO  [org.jboss.msc] (main) JBoss MSC version 1.0.2.GA-redhat-2
[Host Controller] 10:03:58,874 INFO  [org.jboss.as] (MSC service thread 1-1) JBAS015899: JBoss EAP 6.0.1.GA (AS 7.1.3.Final-redhat-4) starting
[Host Controller] 10:04:00,638 INFO  [org.xnio] (MSC service thread 1-3) XNIO Version 3.0.7.GA-redhat-1
[Host Controller] 10:04:00,655 INFO  [org.jboss.as] (Controller Boot Thread) JBAS010902: Creating http management service using network interface (management) port (9990) securePort (-1)
[Host Controller] 10:04:00,656 INFO  [org.xnio.nio] (MSC service thread 1-3) XNIO NIO Implementation Version 3.0.7.GA-redhat-1
[Host Controller] 10:04:00,727 INFO  [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 3.2.14.GA-redhat-1
[Host Controller] 10:04:00,957 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on 192.168.1.160:9999
[Host Controller] 10:04:07,563 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://192.168.1.160:9990/management
[Host Controller] 10:04:07,565 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015954: Admin console is not enabled
[Host Controller] 10:04:07,567 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.0.1.GA (AS 7.1.3.Final-redhat-4) (Host Controller) started in 10950ms - Started 11 of 11 services (0 services are passive or on-demand)

Deployment

The application to be deployed, uses Spring and Hibernate (details can be found in the Spring and Hibernate4 post). To deploy the application we are going to use a custom module, i.e.,

${JBOSS_HOME}/modules
	/org/springframework
		/main
			aopalliance-1.0.jar
			cglib-2.2.2.jar
			commons-logging-1.0.4.jar
			module.xml
			org.springframework.aop-3.1.2.RELEASE.jar
			org.springframework.asm-3.1.2.RELEASE.jar
			org.springframework.beans-3.1.2.RELEASE.jar
			org.springframework.context-3.1.2.RELEASE.jar
			org.springframework.core-3.1.2.RELEASE.jar
			org.springframework.expression-3.1.2.RELEASE.jar
			org.springframework.jdbc-3.1.2.RELEASE.jar
			org.springframework.jms-3.1.2.RELEASE.jar
			org.springframework.orm-3.1.2.RELEASE.jar
			org.springframework.transaction-3.1.2.RELEASE.jar
			org.springframework.web-3.1.2.RELEASE.jar

where module.xml has the following contents

<module xmlns="urn:jboss:module:1.1" name="org.springframework">
    <resources>
		<resource-root path="aopalliance-1.0.jar"/>
		<resource-root path="cglib-2.2.2.jar"/>
		<resource-root path="commons-logging-1.0.4.jar"/>
		<resource-root path="org.springframework.aop-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.asm-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.beans-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.context-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.core-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.expression-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.jdbc-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.jms-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.orm-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.transaction-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.web-3.1.2.RELEASE.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api" export="true"/>
        <module name="org.apache.log4j" export="true"/>
        <module name="org.antlr" export="true"/>
        <module name="org.dom4j" export="true"/>
        <module name="org.hibernate" export="true"/>
        <module name="javax.persistence.api" export="true"/>
		<module name="javax.servlet.api" export="true"/>
        <module name="org.javassist" export="true"/>
        <module name="org.jboss.logging" export="true"/>
        <module name="javax.transaction.api" export="true"/>
    </dependencies>
</module>

Note that we also have included a Hibernate dependency (as this is needed by Spring when using Hibernate with it). Next, we are going to start the servers by using the command-line interface

[jboss@machine1 ~]$ cd eap/jboss-eap-6.0/bin/
[jboss@machine1 bin]$ ./jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] connect machine1.com:9999
[domain@machine1.com:9999 /] /host=machine1/server-config=cluster-server1:start
{
    "outcome" => "success",
    "result" => "STARTING"
}
[domain@machine1.com:9999 /] /host=machine1/server-config=cluster-server2:start
{
    "outcome" => "success",
    "result" => "STARTING"
}
[domain@machine1.com:9999 /] /host=machine2/server-config=cluster-server3:start
{
    "outcome" => "success",
    "result" => "STARTING"
}
[domain@machine1.com:9999 /] /host=machine2/server-config=cluster-server4:start
{
    "outcome" => "success",
    "result" => "STARTING"
}
[domain@machine1.com:9999 /] deploy /home/jboss/deploy/springhibernate/SpringHibernate.war --server-groups=ccluster-group
[domain@machine1.com:9999 /]

Load balancing

We are going to use mod_cluster for the load balancing. First, we need to install the Apache HTTP server

  • Unpack the httpd-2.2.21.tar.gz file:
    • gzip -d httpd-2.2.21.tar.gz
    • tar xvf httpd-2.2.21.tar
    • cd httpd-2.2.21
  • The next step is to configure:
    • ./configure –with-mpm=worker –with-included-apr –prefix=/home/jboss/apache
  • Next, compile the various parts for the Apache HTTP Server by using:
    • make
  • To install the Apache HTTP Server we use:
    • make install
  • Open the httpd.conf (/home/jboss/apache/conf) file and adjust the following directives:
    • Listen 8888
    • ServerName machine1.com
  • To test the set-up, start the Apache HTTP Server:
    • Navigate to /home/jboss/apache/bin.
    • Run: ./apachectl -k start (To stop the Apache HTTP Server we can use: ./apachectl -k stop).
    • Open a browser en type the following URL: http://hostname:8888.

A mod_cluster distribution can be downloaded here. We will use mod_cluster 1.2.0.Final. Note that the binaries (for example, binaries linux2-x64) contain a full Apache distribution, while the dynamic libraries (for example, dynamic libraries linux2-x64) contain only the modules for mod_cluster (excluding mod_proxy.so, mod_proxy_ajp.so and mod_proxy_http.so). As we already have an Apache installed we will use the dynamic libraries distribution. To configure mod_cluster we first copy the libraries into ${APACHE_HOME}/modules, i.e.,

${APACHE_HOME}
	/conf
		httpd.conf
		jboss-workers.properties
		mod_jk.conf
		mod_cluster.conf
	/modules
		mod_advertise.so
		mod_jk.so
		mod_manager.so
		mod_proxy.so
		mod_proxy_ajp.so
		mod_proxy_http.so
		mod_proxy_cluster.so
		mod_slotmem.so

To configure mod_cluster, we create a mod_cluster configuration file, for example mod_cluster.conf. The configuration has the following contents

LoadModule proxy_module "/home/jboss/apache/modules/mod_proxy.so"
LoadModule proxy_ajp_module "/home/jboss/apache/modules/mod_proxy_ajp.so"
LoadModule proxy_http_module "/home/jboss/apache/modules/mod_proxy_http.so"
LoadModule slotmem_module "/home/jboss/apache/modules/mod_slotmem.so"
LoadModule manager_module "/home/jboss/apache/modules/mod_manager.so"
LoadModule proxy_cluster_module "/home/jboss/apache/modules/mod_proxy_cluster.so"
LoadModule advertise_module "/home/jboss/apache/modules/mod_advertise.so"

NameVirtualHost machine1.com:8888

<VirtualHost machine1.com:8888>
	EnableMCPMReceive
	ManagerBalancerName mycluster

	AllowDisplay On

	KeepAliveTimeout 60
	MaxKeepAliveRequests 0

	ServerAdvertise On
	AdvertiseGroup 224.0.1.105:23364
	AdvertiseFrequency 10

	<Directory />
		Order deny,allow
		Deny from all
	       Allow from 192.168.1.
	</Directory>

	<Location /mod_cluster-manager>
		SetHandler mod_cluster-manager
		Order deny,allow
   		Deny from all
   		Allow from 192.168.1.
	</Location>
</VirtualHost>

The used directives are explained here. Next, add the following Include directive to httpd.conf

# put it near the end of the file where all the other includes are present
# mod_cluster configuration
Include conf/mod_cluster.conf

The protocol used by mod_cluster to communicate with the servers in based on the connectors configured in domain.xml. When an AJP connector is configured it will be used, otherwise an HTTP connector will be used. While AJP is generally faster, an HTTP connector can optionally be secured via SSL.

<subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false">
	<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
	<connector name="ajp" protocol="AJP/1.3" scheme="http" socket-binding="ajp"/>
	<virtual-server name="default-host" enable-welcome-root="true">
		<alias name="localhost"/>
		<alias name="example.com"/>
	</virtual-server>
</subsystem>

Restart the Apache HTTP Server. By accessing the URL: http://hostname:8888/mod_cluster-manager, we get an overview of the configuration.

Start and stop scripts

First, we are going to set-up ssh, such that we can execute commands from machine1 on machine2. Make sure sshd is running on machine2. To this end execute the following commands on machine2

[jboss@machine2 ~]$ su - root
Password:
[root@machine2 ~]# yum install openssh-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.proserve.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
Setting up Install Process
Package openssh-server-5.3p1-84.1.el6.x86_64 already installed and latest version
Nothing to do
[root@machine2 ~]# yum install openssh-clients
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirror.proserve.nl
 * extras: ftp.nluug.nl
 * updates: ftp.nluug.nl
Setting up Install Process
Package openssh-clients-5.3p1-84.1.el6.x86_64 already installed and latest version
Nothing to do
[root@machine2 ~]# chkconfig sshd on
[root@machine2 ~]# service sshd start

When we want to execute commands from machine1 on machine2 without entering a password, we have to follow the steps below (these are executed on machine1)

[jboss@machine1 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jboss/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jboss/.ssh/id_rsa.
Your public key has been saved in /home/jboss/.ssh/id_rsa.pub.
The key fingerprint is:
03:58:ca:81:ad:0f:c6:45:2c:aa:ba:c1:d5:90:36:8b jboss@machine1.com
The key's randomart image is:
+--[ RSA 2048]----+
|   =o .          |
|  o.==           |
| o O+ .          |
|. B =  .         |
|.E = .  S        |
|o . .    .       |
|o.               |
|..               |
|..               |
+-----------------+
[jboss@machine1 ~]$ ssh jboss@machine2.com mkdir -p .ssh
jboss@machine2.com's password:
[jboss@machine1 ~]$ cat .ssh/id_rsa.pub | ssh jboss@machine2.com 'cat >> .ssh/authorized_keys'
jboss@machine2.com's password:
[jboss@machine1 ~]$ ssh jboss@machine2.com hostname
machine2.com

To start the environment we can use

#!/bin/bash

SCRIPT=$(readlink -f $0)
SCRIPT_PATH=$(dirname $SCRIPT)

. ${SCRIPT_PATH}/jboss-functions

start_all_domain_controllers

start_all_servers

start_apache

in which jboss-functions has the following contents

# -*-Shell-script-*-
#
# jboss-functions	This file contains functions to be used by shell scripts in the JBOSS_HOME/scripts directory
#

start_apache() {
	echo "starting Apache HTTP Server"
	${APACHE_HOME}/bin/apachectl -k start
}

stop_apache() {
	echo "stopping Apache HTTP Server"
	${APACHE_HOME}/bin/apachectl -k stop
}

# Starts the domain controller only on the machine where the script is run
start_domain_controller() {
	echo "starting process controller and host controller"
	${JBOSS_HOME}/bin/domain.sh >/dev/null 2>/dev/null &
}

# Stops the domain controller and servers only on the machine where the script is run
stop_domain_controller_and_local_servers() {
	echo "stopping process controller and host controler"
	${JBOSS_HOME}/bin/jboss-cli.sh --user=machine1 --password=jbosseap6! --file=${JBOSS_HOME}/scripts/stop-domain-controller-and-local-servers.cli
}

# This function starts domain controllers on multiple machines by using ssh
start_all_domain_controllers() {
	echo "starting process controller and host controller"
	${JBOSS_HOME}/bin/domain.sh >/dev/null 2>/dev/null &
	echo "waiting a little for the host controller to finish starting"
	sleep 15
	echo "starting process controller and host controller on other machines"
	ssh jboss@machine2.com ${JBOSS_HOME}/bin/domain.sh >/dev/null 2>/dev/null &
	echo "waiting a little for the host controller to finish starting"
	sleep 15
}

# When the start_all_domain_controllers has finished, this function can be called to start all the server
# Note that only the servers defined in start-all-server.cli are started
start_all_servers() {
	echo "starting servers"
	${JBOSS_HOME}/bin/jboss-cli.sh --file=${JBOSS_HOME}/scripts/start-all-servers.cli
}

# Based on what is defined in the stop-all-domain-controllers-and-servers.cli script, domain controllers and servers are stopped
stop_all_domain_controllers_and_servers() {
	echo "stopping JBoss processes"
	${JBOSS_HOME}/bin/jboss-cli.sh --file=${JBOSS_HOME}/scripts/stop-all-domain-controllers-and-servers.cli
}

The start-servers.cli script has the following contents

connect machine1.com:9999
/host=machine1/server-config=cluster-server1:start
/host=machine1/server-config=cluster-server2:start
/host=machine2/server-config=cluster-server3:start
/host=machine2/server-config=cluster-server4:start

When the script is executed the following is observed

[jboss@machine1 scripts]$ ./start-environment.sh
starting process controller and host controller
waiting a little for the host controller to finish starting
starting process controller and host controller on other machines
waiting a little for the host controller to finish starting
starting servers
{
    "outcome" => "success",
    "result" => "STARTING"
}
{
    "outcome" => "success",
    "result" => "STARTING"
}
{
    "outcome" => "success",
    "result" => "STARTING"
}
{
    "outcome" => "success",
    "result" => "STARTING"
}
starting Apache HTTP Server

To stop the environment, we can use

#!/bin/bash

SCRIPT=$(readlink -f $0)
SCRIPT_PATH=$(dirname $SCRIPT)

. ${SCRIPT_PATH}/jboss-functions

stop_apache

stop_all_domain_controllers_and_servers

in which stop-servers.cli has the following contents

connect machine1.com:9999
/host=machine1/server-config=cluster-server1:stop
/host=machine1/server-config=cluster-server2:stop
/host=machine2/server-config=cluster-server3:stop
/host=machine2/server-config=cluster-server4:stop
/host=machine2:shutdown
/host=machine1:shutdown

When the script is run the following is observed

[jboss@machine1 scripts]$ ./stop-environment.sh
stopping Apache HTTP Server
stopping JBoss processes
{
    "outcome" => "success",
    "result" => "STOPPING"
}
{
    "outcome" => "success",
    "result" => "STOPPING"
}
{
    "outcome" => "success",
    "result" => "STOPPING"
}
{
    "outcome" => "success",
    "result" => "STOPPING"
}
{
    "outcome" => "success",
    "result" => undefined
}
{"outcome" => "success"}

In general, it is recommended to start the domain controller when the machine boots. In this case, we need to know where to put our custom commands that will be called when the system boots. Note that Linux has a /etc/rc.d/rc.local file, that can be used to put custom commands in. Let us do it in the recommended script-based way. Note that Unix-based systems specify so-called run levels, and that for each run level, scripts can be defined that start a certain service. These scripts are located in the /etc/rc.d/init.d directory. This allows for services to be started when the system boots or to be stopped on system shutdown. The different run levels are specified by a specific directory in the /etc/rc.d directory, i.e.,

  • rc0.d – contains scripts that are executed on system shutdown.
  • rc1.d – contains scripts for single-user mode.
  • rc2.d – contains scripts for multi-user mode.
  • rc3.d – contains scripts for multi-user mode and networking.
  • rc4.d – not used.
  • rc5.d – same as rc3.d plus some graphical stuff.
  • rc6.d – contains scripts that are executed on system reboot.

The boot sequence is as follows: in the /etc/inittab file the starting runlevel is defined, the script /etc/rc.d/rc.sysinit is called and /etc/rc.d/rc is run. The rc script looks in the /etc/rc.d/rc<start-runlevel>.d to execute the K**<script-name> scripts with the stop option. After this the S**<script-name> scripts are executed with the start option. Note that scripts are started in numerical order, i.e., the S10network script is executed before the S80sendmail script.

To create a domain controller ‘service’, we can use the following script

#!/bin/sh
#
# chkconfig: 235 91 35
# description: starts and stops the jboss domain controller
#
#
. /etc/rc.d/init.d/functions

RETVAL=0
SERVICE="jboss-domain-controller"

start() {
	echo "Starting JBoss Domain Controller"
	su - jboss -c "/home/jboss/scripts/start-domain-controller.sh" >/dev/null 2>&1
	RETVAL=$?
	[ $RETVAL -eq 0 ] && success || failure
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/${SERVICE}
	return $RETVAL
} 

stop() {
	echo "Stopping JBoss Domain Controller and Local JBoss Server Instances"
	su - jboss -c "/home/jboss/scripts/stop-domain-controller-and-local-servers.sh" >/dev/null 2>&1
	RETVAL=$?
	[ $RETVAL -eq 0 ] && success || failure
	echo
	[ $RETVAL -eq 0 ] && rm -r /var/lock/subsys/${SERVICE}
	return $RETVAL
} 

restart() {
	stop
	start
} 

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		restart
		;;
	*)
		echo $"Usage: $0 {start|stop|restart}"
		exit 1
esac 

exit $?

Place this script in the /etc/rc.d/init.d directory. By using the chkconfig command we can update the runlevel information for system services, for example, chkconfig --add jbossdomaincontroller. To test the set-up shut the system down and start it again. To check if the domain controller is running we can use ps -ef|grep java.

Next, we can start the configured servers, for example, by using

connect machine1.com:9999
/host=machine1/server-config=cluster-server1:start
/host=machine1/server-config=cluster-server2:start
/host=machine2/server-config=cluster-server3:start
/host=machine2/server-config=cluster-server4:start

To shutdown the environment we create host specific cli file, i.e., on machine1 we have

connect machine1.com:9999
/host=machine1/server-config=cluster-server1:stop
/host=machine1/server-config=cluster-server2:stop
/host=machine1:shutdown

and on machine2 we have

connect machine1.com:9999
/host=machine2/server-config=cluster-server3:stop
/host=machine2/server-config=cluster-server4:stop
/host=machine2:shutdown

The last set-up with the domain controllers starting when the servers boot, is the preferred way (as we can now bring down a specific host, start JBoss servers instances in a more controlled manner and we do not need ssh).

References

[1] Install Guide.
[2] Administration and Configuration Guide.
[3] JBoss Enterprise Application Platform Documentation.


Free JBoss AS7 (EAP 6) Course

In the vain of its creator (Red Hat): “… we gain the most when we share. It is core to our business and our development models.” As a result, we are bringing you a free course on JBoss AS 7 (EAP 6). In the course you will learn the following:

  • Introduction
    • JBoss Application Server architecture (standalone, process controller, host controller, domain)
    • JBoss Application Server internal architecture (listen threads, threads pools, containers)
    • Standalone configuration
    • Command-line utility
    • Admin console
  • JVM Tuning
    • Code generation
    • Memory management
    • Garbage collection performance
    • JConsole and JVisualVM
  • Deployment
    • Packaging applications recommendations
    • Deployment descriptors
    • Server logging
    • Front-end configuration using the Apache HTTP Server and mod_jk
  • Class Loading
    • Modules
  • Security
    • JAAS introduction
    • Role-based security
    • Secure communications (SSL and TLS)
  • Configure Resources
    • Domain configuration
    • Configure data sources
    • Monitoring resources
    • Configure JMS environment
  • Clustering
    • Unicast or multicast?
    • Denial of service configuration
    • Vertical and horizontal scaling
    • Caching
    • Apache HTTP Server and mod_cluster
    • Load balancing
    • Load testing

Note that this is a course you can do at your own pace. The exercises lead you step-by-step through the process of installing, configuring, deploying etcetera. The material consists of the following:

Have fun!


Bridging JMS HornetQ to JBossAS7

In this post we are going to set-up a (JMS) bridge in order to forward messages from a stand-alone HornetQ Server to JBoss AS7. We end the post by looking at the performance, such as Operating System and JVM tuning, and make a suggestion in chosing a Java Virtual Machine when dealing with very large heaps (> 100GB).

Set-up HornetQ

HornetQ distributions can be obtained here. In the examples we will work with the 2.2.14.Final distribution. To install HornetQ just unzip the downloaded distribution. Let us start with a basic HornetQ set-up and create a connection factory and a queue. Open the hornetq-jms.xml (located in the ${HORNETQ_HOME}/config/stand-alone/non-clustered directory) and add the following

<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
	<connection-factory name="SomeConnectionFactory">
		<xa>false</xa>
		<connectors>
			<connector-ref connector-name="netty"/>
		</connectors>
		<entries>
			<entry name="jms/SomeConnectionFactory"/>
		</entries>
	</connection-factory>

	<queue name="SomeQueue">
		<entry name="jms/queue/SomeQueue"/>
	</queue>
</configuration>

The connectors are defined in the hornetq-configuration.xml file, i.e.,

<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

	<security-enabled>false</security-enabled>
	<cluster-user>employee</cluster-user>
	<cluster-password>welcome1</cluster-password>

	<connectors>
		<connector name="netty">
			<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
			<param key="host"  value="${hornetq.remoting.netty.host:middleware-magic.com}"/>
			<param key="port"  value="${hornetq.remoting.netty.port:4445}"/>
		</connector>
		<connector name="netty-throughput">
			<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
			<param key="host"  value="${hornetq.remoting.netty.host:middleware-magic.com}"/>
			<param key="port"  value="${hornetq.remoting.netty.batch.port:4455}"/>
			<param key="batch-delay" value="50"/>
		</connector>
	</connectors>

	<acceptors>
		<acceptor name="netty">
			<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
			<param key="host"  value="${hornetq.remoting.netty.host:middleware-magic.com}"/>
			<param key="port"  value="${hornetq.remoting.netty.port:4445}"/>
		</acceptor>
		<acceptor name="netty-throughput">
			<factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
			<param key="host"  value="${hornetq.remoting.netty.host:middleware-magic.com}"/>
			<param key="port"  value="${hornetq.remoting.netty.batch.port:4455}"/>
			<param key="batch-delay" value="50"/>
			<param key="direct-deliver" value="false"/>
		</acceptor>
	</acceptors>

	<security-settings>
		<security-setting match="#">
			<permission type="createNonDurableQueue" roles="guest"/>
			<permission type="deleteNonDurableQueue" roles="guest"/>
			<permission type="consume" roles="guest"/>
			<permission type="send" roles="guest"/>
		</security-setting>
	</security-settings>

	<address-settings>
		<address-setting match="#">
			<dead-letter-address>jms.queue.DLQ</dead-letter-address>
			<expiry-address>jms.queue.ExpiryQueue</expiry-address>
			<redelivery-delay>0</redelivery-delay>
			<max-size-bytes>10485760</max-size-bytes>
			<message-counter-history-day-limit>10</message-counter-history-day-limit>
			<address-full-policy>BLOCK</address-full-policy>
		</address-setting>
	</address-settings>

</configuration>

Apart from the addition of the security-enabled, cluster-user and cluster-password elements and the host and port settings, all is present by default. Next, we are going to define a different user. In order to do this open the hornetq-user.xml and add the following

<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-users.xsd">
	<!-- the default user.  this is used where username is null-->
	<defaultuser name="employee" password="welcome1">
		<role name="guest"/>
	</defaultuser>
</configuration>

Start the HornetQ Server by running run.sh (located in the ${HORNETQ_HOME}/bin directory. Before we can execute run.sh, we have to make sure it points to the right JAVA_HOME, for example, open run.sh and add the following lines

#!/bin/sh

export JAVA_HOME=/home/jboss/jdk1.6.0_31
export PATH=${JAVA_HOME}/bin:${PATH}

With everything in place we can start the HornetQ Server

[jboss@middleware-magic bin]$ ./run.sh
***********************************************************************************
java  -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=../config/stand-alone/non-clustered -Djava.util.logging.config.file=../config/stand-alone/non-clustered/logging.properties -Djava.library.path=. -classpath ../lib/twitter4j-core.jar:../lib/netty.jar:../lib/log4j.jar:../lib/jnpserver.jar:../lib/jnp-client.jar:../lib/jbossts-common.jar:../lib/jboss-mc.jar:../lib/jbossjta.jar:../lib/jboss-jms-api.jar:../lib/jboss-javaee.jar:../lib/jboss-client-7.1.0.Final.jar:../lib/hornetq-twitter-integration.jar:../lib/hornetq-spring-integration.jar:../lib/hornetq-logging.jar:../lib/hornetq-jms.jar:../lib/hornetq-jms-client-java5.jar:../lib/hornetq-jms-client.jar:../lib/hornetq-jboss-as-integration.jar:../lib/hornetq-core.jar:../lib/hornetq-core-client-java5.jar:../lib/hornetq-core-client.jar:../lib/hornetq-bootstrap.jar:../lib/commons-logging.jar:../config/stand-alone/non-clustered:../schemas/ org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml
***********************************************************************************
* [main] 28-Nov 11:7:50,967 INFO [HornetQBootstrapServer]  Starting HornetQ Server
* [main] 28-Nov 11:7:51,753 INFO [HornetQServerImpl]  live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=../data/journal,bindingsDirectory=../data/bindings,largeMessagesDirectory=../data/large-messages,pagingDirectory=../data/paging)
* [main] 28-Nov 11:7:51,753 INFO [HornetQServerImpl]  Waiting to obtain live lock
* [main] 28-Nov 11:7:51,774 INFO [JournalStorageManager]  Using AIO Journal
* [main] 28-Nov 11:7:51,937 INFO [AIOFileLockNodeManager]  Waiting to obtain live lock
* [main] 28-Nov 11:7:51,937 INFO [AIOFileLockNodeManager]  Live Server Obtained live lock
* [main] 28-Nov 11:7:54,350 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.DLQ
* [main] 28-Nov 11:7:54,369 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.ExpiryQueue
* [main] 28-Nov 11:7:54,374 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.SomeQueue
* [main] 28-Nov 11:7:54,476 INFO [NettyAcceptor]  Started Netty Acceptor version 3.2.5.Final-a96d88c middleware-magic.com:4455 for CORE protocol
* [main] 28-Nov 11:7:54,477 INFO [NettyAcceptor]  Started Netty Acceptor version 3.2.5.Final-a96d88c middleware-magic.com:4445 for CORE protocol
* [main] 28-Nov 11:7:54,478 INFO [HornetQServerImpl]  Server is now live
* [main] 28-Nov 11:7:54,478 INFO [HornetQServerImpl]  HornetQ Server version 2.2.11.Final (HQ_2_2_11_FINAL_AS7, 122) [0ba4fa8d-3895-11e2-a23c-01d224a63402]) started

In order to test our set-up, we can use the following

package model.test;

import javax.jms.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;

public class HornetQTest {

    public static void main(String[] args) {
        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
        properties.put(Context.PROVIDER_URL, "jnp://192.168.1.150:1099");
        properties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
        properties.put(Context.SECURITY_PRINCIPAL, "employee");
        properties.put(Context.SECURITY_CREDENTIALS, "welcome1");

        ConnectionFactory connectionFactory = null;
        Destination destination = null;

        try {
            Context context = new InitialContext(properties);
            connectionFactory = (ConnectionFactory) context.lookup("jms/SomeConnectionFactory");
            destination = (Destination) context.lookup("jms/queue/SomeQueue");

            System.out.println(connectionFactory);
            System.out.println(destination);

            sendMessage(connectionFactory, destination);
            receiveMessage(connectionFactory, destination);
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }

    private static void sendMessage(ConnectionFactory connectionFactory, Destination destination) {
        Connection connection = null;
        Session session = null;
        MessageProducer messageProducer = null;

        try {
            connection = connectionFactory.createConnection("guest", "guest");
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            messageProducer = session.createProducer(destination);

            TextMessage text = session.createTextMessage();
            text.setText("Send some useful message");
            messageProducer.send(text);
        } catch (JMSException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
                } catch (JMSException f) {
                    f.printStackTrace();
                }
            }
        }
    }

    private static void receiveMessage(ConnectionFactory connectionFactory, Destination destination) {
        Connection connection = null;
        Session session = null;
        MessageConsumer messageConsumer = null;

        try {
            connection = connectionFactory.createConnection("guest", "guest");
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            messageConsumer = session.createConsumer(destination);

            connection.start();

            Message message = messageConsumer.receive(1000);
            System.out.println(message.getJMSDestination() + ", " + message);
            if (message instanceof TextMessage) {
                TextMessage text = (TextMessage) message;
                System.out.println(text.getText());
            }

            connection.stop();
        } catch (JMSException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
                } catch (JMSException f) {
                    f.printStackTrace();
                }
            }
        }
    }
}

To run this, we need jnpserver.jar on the class path. This jar can be obtained from the HornetQ distribution (${HORNETQ_HOME}/lib). The following output is observed when the program is run

HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=4445&host=middleware-magic-com], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]
HornetQQueue[SomeQueue]
HornetQQueue[SomeQueue], HornetQMessage[ID:e5d0ecc8-3944-11e2-b6cb-005056c00001]:PERSISTENT
Send some useful message

Make sure the host returned in this case middleware-magic-com can be resolved to the right IP address. More information can be found in the Spring and JBoss AS7 JMS post.

Set-up JBoss AS7

Next, we set-up the JBoss environment. To this end, we add the following to the domain.xml (located in the ${JBOSS_HOME}/domain/configuration directory)

<domain xmlns="urn:jboss:domain:1.1">
    <extensions>...</extensions>
    <system-properties>...</system-properties>
    <profiles>
        <profile name="standalone">...</profile>
        <profile name="cluster">
		    ...
            <subsystem xmlns="urn:jboss:domain:messaging:1.1">
                <hornetq-server>
                    <security-enabled>false</security-enabled>
                    <persistence-enabled>true</persistence-enabled>
                    <create-journal-dir>true</create-journal-dir>
                    <journal-type>ASYNCIO</journal-type>
                    <journal-buffer-timeout>500000</journal-buffer-timeout>
                    <journal-buffer-size>1048576</journal-buffer-size>
                    <journal-sync-transactional>true</journal-sync-transactional>
                    <journal-sync-non-transactional>true</journal-sync-non-transactional>
                    <journal-file-size>10485760</journal-file-size>
                    <journal-min-files>2</journal-min-files>
                    <journal-compact-min-files>10</journal-compact-min-files>
                    <journal-compact-percentage>30</journal-compact-percentage>
                    <journal-max-io>1024</journal-max-io>
                    <journal-directory path="data/messaging" relative-to="messaging.journal.base.directory"/>

                    <cluster-user>employee</cluster-user>
                    <cluster-password>welcome1</cluster-password>

                    <connectors>
                        <netty-connector name="netty" socket-binding="messaging"/>
                        <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
                            <param key="batch-delay" value="50"/>
                        </netty-connector>
                        <in-vm-connector name="in-vm" server-id="0"/>
                    </connectors>

                    <acceptors>
                        <netty-acceptor name="netty" socket-binding="messaging"/>
                        <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
                            <param key="batch-delay" value="50"/>
                            <param key="direct-deliver" value="false"/>
                        </netty-acceptor>
                        <in-vm-acceptor name="in-vm" server-id="0"/>
                    </acceptors>

                    <security-settings>
                        <security-setting match="#">
                            <permission type="send" roles="guest"/>
                            <permission type="consume" roles="guest"/>
                            <permission type="createNonDurableQueue" roles="guest"/>
                            <permission type="deleteNonDurableQueue" roles="guest"/>
                        </security-setting>
                    </security-settings>

                    <address-settings>
                        <address-setting match="#">
                            <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                            <expiry-address>jms.queue.EQ</expiry-address>
                            <redelivery-delay>0</redelivery-delay>
                            <max-size-bytes>10485760</max-size-bytes>
                            <address-full-policy>BLOCK</address-full-policy>
                            <message-counter-history-day-limit>10</message-counter-history-day-limit>
                        </address-setting>
                        <address-setting match="jms.queue.testQueue">
                            <dead-letter-address>jms.queue.deadLetterQueue</dead-letter-address>
                            <expiry-address>jms.queue.expiryQueue</expiry-address>
                            <redelivery-delay>5000</redelivery-delay>
                            <max-delivery-attempts>3</max-delivery-attempts>
                            <max-size-bytes>104857600</max-size-bytes>
                            <address-full-policy>BLOCK</address-full-policy>
                            <last-value-queue>true</last-value-queue>
                            <redistribution-delay>0</redistribution-delay>
                            <send-to-dla-on-no-route>true</send-to-dla-on-no-route>
                        </address-setting>
                    </address-settings>

                    <jms-connection-factories>
                        <connection-factory name="InVmConnectionFactory">
                            <connectors>
                                <connector-ref connector-name="in-vm"/>
                            </connectors>
                            <entries>
                                <entry name="java:/ConnectionFactory"/>
                            </entries>
                        </connection-factory>
                        <connection-factory name="RemoteConnectionFactory">
                            <connectors>
                                <connector-ref connector-name="netty"/>
                            </connectors>
                            <entries>
                                <entry name="RemoteConnectionFactory"/>
                                <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                            </entries>
                        </connection-factory>
                        <pooled-connection-factory name="hornetq-ra">
                            <transaction mode="xa"/>
                            <connectors>
                                <connector-ref connector-name="in-vm"/>
                            </connectors>
                            <entries>
                                <entry name="java:/JmsXA"/>
                            </entries>
                        </pooled-connection-factory>
                    </jms-connection-factories>

                    <jms-destinations>
                        <jms-queue name="testQueue">
                            <entry name="java:/queue/test"/>
                            <entry name="java:jboss/exported/jms/queue/test"/>
                        </jms-queue>
                        <jms-queue name="deadLetterQueue">
                            <entry name="java:/queue/deadLetterQueue"/>
                            <entry name="java:jboss/exported/jms/queue/deadLetterQueue"/>
                            <durable>false</durable>
                        </jms-queue>
                        <jms-queue name="expiryQueue">
                            <entry name="java:/queue/expiryQueue"/>
                            <entry name="java:jboss/exported/jms/queue/expiryQueue"/>
                            <durable>false</durable>
                        </jms-queue>
                        <jms-topic name="testTopic">
                            <entry name="java:/topic/test"/>
                            <entry name="java:jboss/exported/jms/topic/test"/>
                        </jms-topic>
                    </jms-destinations>
                </hornetq-server>
            </subsystem>
			...
        </profile>
    </profiles>
    <interfaces>...</interfaces>
    <socket-binding-groups>...</socket-binding-groups>
    <deployments>
        <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear">
            <content sha1="161f51dde7f085c822cc4c68b306d57f1bee902d"/>
        </deployment>
        <deployment name="SpringHibernate.war" runtime-name="SpringHibernate.war">
            <content sha1="7d11daad8702ecc31321f41089b32ded945c6d7f"/>
        </deployment>
    </deployments>
    <server-groups>
        <server-group name="standalone-group" profile="standalone">
            <jvm name="default"/>
            <socket-binding-group ref="standalone-sockets"/>
        </server-group>
        <server-group name="cluster-group" profile="cluster">
            <jvm name="default"/>
            <socket-binding-group ref="cluster-sockets"/>
            <deployments>
                <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear" enabled="false"/>
                <deployment name="SpringHibernate.war" runtime-name="SpringHibernate.war"/>
            </deployments>
        </server-group>
    </server-groups>
</domain>

In the host.xml we have the following

<host name="jboss" xmlns="urn:jboss:domain:1.1">
    <management>...</management>
    <domain-controller><local/></domain-controller>
    <interfaces>...</interfaces>
    <jvms>
    	<jvm name="default">
            <heap size="512m" max-size="512m"/>
            <permgen size="256m" max-size="256m"/>
            <jvm-options>
                <option value="-server"/>
                <option value="-XX:NewRatio=2"/>
                <option value="-XX:+UseParallelGC"/>
                <option value="-XX:ParallelGCThreads=2"/>
                <option value="-XX:MaxGCPauseMillis=200"/>
                <option value="-XX:GCTimeRatio=19"/>
                <option value="-XX:+UseParallelOldGC"/>
                <option value="-XX:+UseTLAB"/>
                <option value="-XX:LargePageSizeInBytes=2048k"/>
                <option value="-XX:+UseLargePages"/>
            </jvm-options>
        </jvm>
    </jvms>
    <servers>
        <server name="standalone-server" group="standalone-group" auto-start="false"/>
        <server name="cluster-server1" group="cluster-group" auto-start="false">
            <paths>
                <path name="messaging.journal.base.directory" path="/home/jboss/temp/cluster-server1"/>
            </paths>
        </server>
        <server name="cluster-server2" group="cluster-group" auto-start="false">
            <socket-bindings port-offset="1"/>
            <paths>
                <path name="messaging.journal.base.directory" path="/home/jboss/temp/cluster-server2"/>
            </paths>
        </server>
    </servers>
</host>

Note that we have also configured the messaging journal in the domain.xml

  • journal-directory – This is the directory in which the message journal lives. For the best performance, it is recommended that the journal is located on its own physical volume in order to minimise disk head movement. If the journal is on a volume which is shared with other processes which might be writing other files (e.g. bindings journal, database, or transaction coordinator) then the disk head may well be moving rapidly between these files as it writes them, thus drastically reducing performance. When the message journal is stored on a SAN it is recommended that each journal instance that is stored on the SAN is given its own LUN (logical unit).
  • create-journal-dir – If this is set to true then the journal directory will be automatically created at the location specified in journal-directory if it does not already exist.
  • journal-type – Valid values are NIO or ASYNCIO. The NIO option uses the Java NOI Journal. The ASYNCIO option uses the Linux asynchronous IO journal. If we choose ASYNCIO and are not running Linux or do not have libaio installed then HornetQ will detect this and automatically fall back to using NIO. The ASYNCIO option uses a thin native code wrapper to talk to the Linux asynchronous IO library (AIO). With AIO, HornetQ will be called back when the data has made it to disk, allowing HornetQ to avoid explicit syncs altogether and simply send back confirmation of completion when AIO informs HornetQ that the data has been persisted. Using AIO will typically provide better performance than using Java NIO.
  • journal-sync-transactional – If this is set to true then HornetQ will make sure all transaction data is flushed to disk on transaction boundaries (commit, prepare and rollback).
  • journal-sync-non-transactional – If this is set to true then HornetQ will make sure non transactional message data (sends and acknowledgements) are flushed to disk each time.
  • journal-file-size – The size of each journal file in bytes.
  • journal-min-files – The minimum number of files the journal will maintain. When HornetQ starts and there is no initial message data, HornetQ will pre-create journal-min-files number of files. Creating journal files and filling them with padding is a fairly expensive operation and we want to minimise doing this at run-time as files get filled. By precreating files, as one is filled the journal can immediately resume with the next one without pausing to create it. Depending on how much data we expect our queues to contain at steady state we should tune this number of files to match that total amount of data.
  • journal-max-io – Write requests are queued up before being submitted to the system for execution. This parameter controls the maximum number of write requests that can be in the IO queue at any one time. If the queue becomes full then writes will block until space is freed up. When using NIO, this value should always be equal to 1. When using ASYNCIO, the default value is 500. The maximum value of ASYNCIO can not be higher than the value configured in the operating system (i.e., /proc/sys/fs/aio-max-nr).
  • journal-buffer-timeout – Instead of flushing on every write that requires a flush, HornetQ maintains an internal buffer, and flush the entire buffer either when it is full, or when a timeout expires. This allows the system to scale better with many concurrent writes that require flushing. Note that The second implementation uses a thin native code wrapper to talk to the Linux asynchronous IO library (AIO). With AIO, HornetQ will be called back when the data has made it to disk, allowing us to avoid explicit syncs altogether and simply send back confirmation of completion when AIO informs us that the data has been persisted. Note that ASYNCIO can cope with a higher flush rate than NIO (the default values are 3333333 nanoseconds (300 times per second) for NOI and 500000 nanoseconds (2000 times per second) for ASYNCIO.
  • journal-buffer-size – The size of the buffer.
  • journal-compact-min-files – The minimal number of files before HornetQ can consider compacting the journal. The compacting algorithm will not start until there are at least journal-compact-min-files.
  • journal-compact-percentage – The threshold to start compacting. When less than this percentage is considered live data, HornetQ starts compacting.

For the testQueue we have also specified address settings

  • max-delivery-attempts – defines how many times a cancelled message can be redelivered before sending to the dead-letter-address.
  • redelivery-delay – defines how long to wait before attempting redelivery of a cancelled message.
  • expiry-address defines where to send a message that has expired (the time is set by using a time-to-live).
  • last-value-queue – defines whether a queue only uses last values or not. Last-Value queues are special queues which discard any messages when a newer message with the same value for a well-defined Last-Value property is put in the queue.
  • redistribution-delay – defines how long to wait when the last consumer is closed on a queue before redistributing any messages. Server side message load balancing round robins messages across the cluster. If forward-when-no-consumers is false, then messages will not be forwarded to nodes which do not have matching consumers, this is great and ensures that messages do not arrive on a queue which has no consumers to consume them, however there is a situation it does not solve: What happens if the consumers on a queue close after the messages have been sent to the node? If there are no consumers on the queue the message will not get consumed and we have a starvation situation. This is where message redistribution comes in. With message redistribution HornetQ can be configured to automatically redistribute messages from queues which have no consumers back to other nodes in the cluster which do have matching consumers. Message redistribution can be configured to kick in immediately after the last consumer on a queue is closed, or to wait a configurable delay after the last consumer on a queue is closed before redistributing.
  • send-to-dla-on-no-route – if a message is sent to an address, but the server does not route it to any queues, for example, there might be no queues bound to that address, or none of the queues have filters that match, then normally that message would be discarded. However if this parameter is set to true for that address, if the message is not routed to any queues it will instead be sent to the dead letter address for that address, if it exists.
  • address-full-policy – this attribute can have one of the following values: PAGE, DROP or BLOCK and determines what happens when an address where max-size-bytes is specified becomes full. If the value is PAGE then further messages will be paged to disk. If the value is DROP then further messages will be silently dropped. If the value is BLOCK then client message producers will block when they try and send further messages.

To test the JBoss side, we can use

package model.test;

import javax.jms.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;

public class JNDITest {
    public static void main(String[] args) {
        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
        properties.put(Context.PROVIDER_URL, "remote://192.168.1.150:4447");
        properties.put(Context.SECURITY_PRINCIPAL, "employee");
        properties.put(Context.SECURITY_CREDENTIALS, "welcome1");

        ConnectionFactory connectionFactory = null;
        Destination destination = null;

        try {
            Context context = new InitialContext(properties);
            connectionFactory = (ConnectionFactory) context.lookup("jms/RemoteConnectionFactory");
            destination = (Destination) context.lookup("jms/queue/test");

            System.out.println(connectionFactory);
            System.out.println(destination);

            sendMessage(connectionFactory, destination);
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }

    private static void sendMessage(ConnectionFactory connectionFactory, Destination destination) {
        Connection connection = null;
        Session session = null;
        MessageProducer messageProducer = null;

        try {
            connection = connectionFactory.createConnection("employee", "welcome1");
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            messageProducer = session.createProducer(destination);

            TextMessage text = session.createTextMessage();
            text.setText("Send some useful message");
            messageProducer.send(text);
        } catch (JMSException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
                } catch (JMSException f) {
                    f.printStackTrace();
                }
            }
        }
    }
}

To run this we need jboss-client-7.1.0.Final.jar in the class path. When the program is run the following is observed on the client side

Nov 28, 2012 1:48:05 PM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.3.GA
Nov 28, 2012 1:48:05 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.3.GA
Nov 28, 2012 1:48:05 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.2.GA
HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=middleware-magic-com], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]
HornetQQueue[testQueue]

On the server side (in the JBoss logging) the following is observed

13:48:07,450 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED TEXT MESSAGE Send some useful message
13:48:07,502 INFO  [org.jboss.as.naming] (Remoting "jboss:cluster-server1" task-4) JBAS011806: Channel end notification received, closing channel Channel ID 3df88b53 (inbound) of Remoting connection 08fa0f67 to null

The message is picked-up by the Spring/Hibernate application introduced in the Spring and Hibernate4 post.

Monitoring

HermesJMS is an extensible console that helps you interact with JMS providers making it simple to publish and edit messages, browse or seach queues and topics, copy messages around and delete them. By using HermesJMS we are able to browse destinations:

  • Edit the file hermes.sh located in the directory <HermesJMS-Home>/bin.
  • Make sure the variable JAVA_HOME points to a valid JDK installation directory.
  • Run the file hermes.sh.
  • Click in the menu on options, configuration.
  • Click on the providers tab at the bottom.
  • Right click on classpath groups and select add group.
  • Enter a name, for example JBossAS7.
  • Click on the + to expand the JBossAS7 tree, right click library and select add jar(s).
  • Browse to ${JBOSS_HOME}/bin/client and select jboss-client-7.1.0.jar.
  • Click do not scan and click ok.
  • Right click sessions and select new, new session.
  • In the connection factory section enter the following parameters:
    • class: hermes.JNDIConnectionFactory
    • loader: JBossAS7 (this is the provider we create above)
  • Subsequently, add some properties (right click under property and choose from the drop-down-box)
    • securityCredentials: welcome1 (password of an application user with guest as role)
    • initialContextFactory: org.jboss.naming.remote.client.InitialContextFactory
    • securityPrincipal: employee (username of an application user with guest as role)
    • binding: jms/RemoteConnectionFactory (a connection factory configured on the server, which has a prefix java:jboss/exported)
    • providerURL: remote://192.168.1.150:4447 (url to the server)
    • urlPkgPrefixes: org.jboss.naming.remote.client
  • Add the destination that we want to monitor in the destinations section (right click and choose add)
    • name: JNDI name of the destination, for example, jms/queue/test
  • Click ok.
  • Double click the MiddlewareMagic session to browse the destination.

In hermes-config.xml the following has been added

...
<classpathGroup id="jbossas7">
	<library factories="org.hornetq.jms.client.HornetQJMSConnectionFactory,org.hornetq.jms.client.HornetQQueueConnectionFactory,org.hornetq.jms.client.HornetQTopicConnectionFactory,org.hornetq.jms.client.HornetQXAConnectionFactory,org.hornetq.jms.client.HornetQXAQueueConnectionFactory,org.hornetq.jms.client.HornetQXATopicConnectionFactory" noFactories="false" jar="/home/jboss/jboss-as-7.1.0.Final/bin/client/jboss-client-7.1.0.Final.jar"/>
</classpathGroup>
...
<factory classpathId="jbossas7">
	<provider className="hermes.JNDIConnectionFactory">
		<properties>
			<property value="jms/RemoteConnectionFactory" name="binding"/>
			<property value="org.jboss.naming.remote.client.InitialContextFactory" name="initialContextFactory"/>
			<property value="remote://192.168.1.150:4447" name="providerURL"/>
			<property value="welcome1" name="securityCredentials"/>
			<property value="employee" name="securityPrincipal"/>
			<property value="org.jboss.naming.remote.client" name="urlPkgPrefixes"/>
		</properties>
	</provider>
	<connection connectionPerThread="false" clientID="">
		<session useConsumerForQueueBrowse="false" audit="false" transacted="true" reconnects="0" id="&lt;new&gt;"/>
	</connection>
	<destination durable="false" domain="1" name="jms/queue/test"/>
	<extension className="hermes.ext.DefaultHermesAdminFactory">
		<properties/>
	</extension>
</factory>
...

An example output after sending a message

Create the Bridge

Our next goal is to forward messages put into the HornetQ queue (by, for example, the client introduced above) by using a HornetQ bridge. The HornetQ bridge will forward the messages to the JBoss Server. To configure the bridge we can use the following in the hornetq-configuration.xml file

<configuration ...>
	...
	<connectors>
		...
		<connector name="remote-connector">
			<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
			<param key="host"  value="${hornetq.remoting.netty.host:middleware-magic.com}"/>
			<param key="port"  value="${hornetq.remoting.netty.batch.port:5445}"/>
		</connector>
	</connectors>
	<acceptors>...</acceptors>
	<queues>
		<queue name="jms.queue.SomeQueue">
			<address>jms.queue.SomeQueue</address>
		</queue>
	</queues>
	<bridges>
		<bridge name="SomeBridge">
			<queue-name>jms.queue.SomeQueue</queue-name>
			<forwarding-address>jms.queue.testQueue</forwarding-address>
			<reconnect-attempts>-1</reconnect-attempts>
			<static-connectors>
				<connector-ref>remote-connector</connector-ref>
			</static-connectors>
		</bridge>
	</bridges>
	<security-settings>...</security-settings>
	<address-settings>...</address-settings>
</configuration>

As we are connecting to a JBoss Server we need some extra classes in the class path of the HornetQ Server that are contained in the jboss-client-7.1.0.Final.jar file. With the configuration in place start the HornetQ Server

[jboss@middleware-magic bin]$ ./run.sh
***********************************************************************************
java  -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=../config/stand-alone/non-clustered -Djava.util.logging.config.file=../config/stand-alone/non-clustered/logging.properties -Djava.library.path=. -classpath ../lib/twitter4j-core.jar:../lib/netty.jar:../lib/jnpserver.jar:../lib/jnp-client.jar:../lib/jboss-mc.jar:../lib/jboss-jms-api.jar:../lib/jboss-client-7.1.0.Final.jar:../lib/hornetq-twitter-integration.jar:../lib/hornetq-spring-integration.jar:../lib/hornetq-logging.jar:../lib/hornetq-jms.jar:../lib/hornetq-jms-client-java5.jar:../lib/hornetq-jms-client.jar:../lib/hornetq-jboss-as-integration.jar:../lib/hornetq-core.jar:../lib/hornetq-core-client-java5.jar:../lib/hornetq-core-client.jar:../lib/hornetq-bootstrap.jar:../config/stand-alone/non-clustered:../schemas/ org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml
***********************************************************************************
* [main] 28-Nov 14:2:49,29 INFO [HornetQBootstrapServer]  Starting HornetQ Server
* [main] 28-Nov 14:2:50,964 INFO [HornetQServerImpl]  live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=../data/journal,bindingsDirectory=../data/bindings,largeMessagesDirectory=../data/large-messages,pagingDirectory=../data/paging)
* [main] 28-Nov 14:2:50,964 INFO [HornetQServerImpl]  Waiting to obtain live lock
* [main] 28-Nov 14:2:50,985 INFO [JournalStorageManager]  Using AIO Journal
* [main] 28-Nov 14:2:51,173 INFO [AIOFileLockNodeManager]  Waiting to obtain live lock
* [main] 28-Nov 14:2:51,173 INFO [AIOFileLockNodeManager]  Live Server Obtained live lock
* [main] 28-Nov 14:2:53,787 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.SomeQueue
* [main] 28-Nov 14:2:53,851 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.DLQ
* [main] 28-Nov 14:2:53,871 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.ExpiryQueue
* [main] 28-Nov 14:2:53,876 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.SomeQueue
* [main] 28-Nov 14:2:54,57 INFO [NettyAcceptor]  Started Netty Acceptor version 3.2.5.Final-a96d88c middleware-magic.com:4455 for CORE protocol
* [main] 28-Nov 14:2:54,59 INFO [NettyAcceptor]  Started Netty Acceptor version 3.2.5.Final-a96d88c middleware-magic.com:4445 for CORE protocol
* [main] 28-Nov 14:2:54,343 INFO [HornetQServerImpl]  Server is now live
* [main] 28-Nov 14:2:54,344 INFO [HornetQServerImpl]  HornetQ Server version 2.2.11.Final (HQ_2_2_11_FINAL_AS7, 122) [0ba4fa8d-3895-11e2-a23c-01d224a63402]) started

* [Thread-3 (HornetQ-server-HornetQServerImpl::serverUUID=0ba4fa8d-3895-11e2-a23c-01d224a63402-1332226643)] 28-Nov 14:2:58,112 INFO [BridgeImpl]  Bridge BridgeImpl@7b712193 [name=SomeBridge, queue=QueueImpl[name=jms.queue.SomeQueue, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=0ba4fa8d-3895-11e2-a23c-01d224a63402]]@40537935 targetConnector=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=middleware-magic-com], discoveryGroupConfiguration=null]] is connected

* [Thread-1 (HornetQ-client-global-threads-851009394)] 28-Nov 15:35:13,698 WARNING [RemotingConnectionImpl]  Connection failure has been detected: The connection was disconnected because of server shutdown [code=4]
* [Thread-1 (HornetQ-client-global-threads-851009394)] 28-Nov 15:35:13,699 WARNING [BridgeImpl]  BridgeImpl@7b712193 [name=SomeBridge, queue=QueueImpl[name=jms.queue.SomeQueue, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=0ba4fa8d-3895-11e2-a23c-01d224a63402]]@40537935 targetConnector=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=middleware-magic-com], discoveryGroupConfiguration=null]]::Connection failed with failedOver=false-HornetQException[errorCode=4 message=The connection was disconnected because of server shutdown]
HornetQException[errorCode=4 message=The connection was disconnected because of server shutdown]
	at org.hornetq.core.client.impl.ClientSessionFactoryImpl$Channel0Handler$1.run(ClientSessionFactoryImpl.java:1467)
	at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)

* [Thread-29 (HornetQ-server-HornetQServerImpl::serverUUID=0ba4fa8d-3895-11e2-a23c-01d224a63402-1332226643)] 28-Nov 15:36:17,997 INFO [BridgeImpl]  Bridge BridgeImpl@7b712193 [name=SomeBridge, queue=QueueImpl[name=jms.queue.SomeQueue, postOffice=PostOfficeImpl [server=HornetQServerImpl::serverUUID=0ba4fa8d-3895-11e2-a23c-01d224a63402]]@40537935 targetConnector=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=middleware-magic-com], discoveryGroupConfiguration=null]] is connected

As the last logging line indicates, we are connected. Note that the logging also shows what happens when the JBoss servers are shutdown and started (disconnect and connect). Running the client a few times leads to in the JBoss Server log.

14:04:06,384 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED TEXT MESSAGE Send some useful message
14:04:11,950 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED TEXT MESSAGE Send some useful message
14:04:17,943 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED TEXT MESSAGE Send some useful message
14:04:20,462 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED TEXT MESSAGE Send some useful message

Performance

When running a JMS system some performance tweaks could be necessary, such as

When dealing with large message flows, it is beneficial to put as many messages in the JVM heap as possible. Or better yet, just put them all in the JVM heap, sometimes this leads to creating very large heaps (with of course garbage collection as a very potential bottleneck). Usually, when using the common JVMs, such as HotSpot, garbage collection becomes a bottleneck. When dealing with very large heaps it shows beneficial to use the Zing JVM (created by Azul Systems) instead.

References

[1] HornetQ User Manual.
[2] Performance Tuning.


Spring and Hibernate4

In this post we put Spring and Hibernate 4 together. We start out by creating a Java client to see what is needed to make things work. Next, we create a Web application (by adding a servlet) and deploy the application to JBoss AS7 (and use the native Hibernate API). Here, we show what needs to be done in order to make Spring and the native Hibernate API work together on the JBoss Application Server, i.e., we create an extra module (org.springframework) and make sure this is loaded by the deployed Web module. Finally, we show how to include messaging as well. More information on how the JBoss environment is set-up can be found in the post Building a Coherence Cluster with Multiple Application Servers. We also show how the environment can be migrated from JBoss to WebLogic (or vice versa). More information about the WebLogic environment can be found in the post Deploy WebLogic12c to Multiple Machines.

Client

Let us start by creating a Java client, just to get a feeling of what needs to be done and not have the complexity of a Java EE Server (such as, for example, JBoss AS7) along with it. To this end we can use the following Spring configuration

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
    <bean id="company" class="model.logic.CompanyBean">
        <property name="sessionFactory" ref="sessionfactory"/>
    </bean>
    <bean id="sessionfactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="datasource"/>
        <!--property name="jtaTransactionManager" ref="transactionManager"/-->
        <property name="mappingResources">
            <list>
                <value>model/entities/person.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <!--prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop-->
                <prop key="hibernate.listeners.envers.autoRegister">${hibernate.listeners.envers.autoRegister}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
            </props>
        </property>
    </bean>
    <!--jee:jndi-lookup id="datasource" jndi-name="java:/jdbc/OracleDS" resource-ref="false"/-->
    <bean id="datasource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
        <property name="driverType" value="${jdbc.driverClassName}"/>
        <property name="URL" value="${jdbc.url}"/>
        <property name="user" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean>
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:spring.properties</value>
            </list>
        </property>
    </bean>
    <!--bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/-->
    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionfactory"/>
    </bean>
    <tx:annotation-driven transaction-manager="transactionManager"/>
</beans>

Note that we did not set the hibernate.current_session_context_class property. We should never use that property when combining Hibernate with Spring as it destroys proper session and transaction management when using the HibernateTransactionManager. On the other hand, when on a Java EE Server and using the JtaTransactionManager, set the property to the value thread. Another thing to note is that the EnversIntegrator is always detected by default while initializing the ServiceRegistry using the Native Hibernate API causing a MappingException even when Envers is not used when deployed on JBoss AS7. That is why we have set the value of the hibernate.listeners.envers.autoRegister property to false.

The contents of the referred spring.properties look as follows

jdbc.driverClassName=oracle.jdbc.OracleDriver
jdbc.url=jdbc:oracle:thin:@192.168.1.60:1521:orcl11
jdbc.username=example
jdbc.password=example

hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.current_session_context_class=thread
hibernate.listeners.envers.autoRegister=false
hibernate.show_sql=false
hibernate.format_sql=false

The CompanyBean class looks as follows

package model.logic;

import model.entities.Person;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public class CompanyBean implements Company {

    private SessionFactory sessionFactory;

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    public void insertPerson(Person person) {
        Person temporaryPerson = findPerson(person.getSofinummer());
        if (temporaryPerson == null) {
            System.out.println("INSERT " + person);
            getCurrentSession().save(person);
        } else {
            updatePerson(person);
        }
    }

    public void removePerson(Integer sofinummer) {
        Person temporaryPerson = findPerson(sofinummer);
        if (temporaryPerson != null) {
            System.out.println("REMOVE " + temporaryPerson);
            getCurrentSession().delete(temporaryPerson);
        }
    }

    public void updatePerson(Person person) {
        System.out.println("UPDATE " + person);
        getCurrentSession().merge(person);
    }

    private Person findPerson(Integer sofinummer) {
        return (Person) getCurrentSession().get(Person.class, sofinummer);
    }

    private final Session getCurrentSession(){
      return getSessionFactory().getCurrentSession();
   }
}

To test the set-up, we can use something like

package model.test;

import model.entities.Person;
import model.logic.Company;
import model.utils.SpringUtilities;

import java.util.Random;

public class Test {

    private Random generator = new Random();

    public static void main(String[] args) {
        Test test = new Test();

        Company company = SpringUtilities.getCompany();

        for (int i = 0; i &lt; 100; i++) {
            Person person = test.createPerson();
            if (test.generator.nextDouble() &lt; 0.01) {
                company.removePerson(person.getSofinummer());
            } else {
                company.insertPerson(person);
            }
        }
    }

    private Person createPerson() {
        Person person = new Person();
        person.setNaam(Long.toString(Math.abs(generator.nextLong()), 36));
        person.setSofinummer(generator.nextInt(10000));
        return person;
    }
}

When the test is run something like the following output is observed

Aug 14, 2012 2:59:35 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@145d068: startup date [Tue Aug 14 14:59:35 CEST 2012]; root of context hierarchy
Aug 14, 2012 2:59:35 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-config.xml]
Aug 14, 2012 2:59:36 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from class path resource [spring.properties]
Aug 14, 2012 2:59:36 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1faba46: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchy
Aug 14, 2012 2:59:36 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Aug 14, 2012 2:59:36 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.2.Final}
Aug 14, 2012 2:59:36 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Aug 14, 2012 2:59:36 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Aug 14, 2012 2:59:36 PM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Aug 14, 2012 2:59:36 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
Aug 14, 2012 2:59:36 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Aug 14, 2012 2:59:36 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Aug 14, 2012 2:59:36 PM org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 4.3.0.Final
Aug 14, 2012 2:59:36 PM org.springframework.orm.hibernate4.HibernateTransactionManager afterPropertiesSet
INFO: Using DataSource [oracle.jdbc.pool.OracleDataSource@161f39e] of Hibernate SessionFactory for HibernateTransactionManager
UPDATE 179arxyy6tshk 6176
INSERT 1sf4e5oz89uhi 2402
UPDATE t9pjpfnqxc4k 8413
UPDATE 1ckym7ttz46mf 5246
UPDATE 1u7litwyaigu4 1211
INSERT 74ra63w7aql6 2238
INSERT 5v48tzzk75qo 5902
INSERT mh5zpr30rjkd 2082
UPDATE 13xzu6r3g0ruz 5877
UPDATE 1jeqjhlfjwv81 9332
INSERT 19zb01tagisqq 6022
INSERT q5v1re6g6svp 3071
INSERT 12t5tsoyld5nl 9991
INSERT m7dhwiwvx7oi 9089
INSERT 1hz8k3rq1cngf 5596
UPDATE 14hhycu8lxban 4169
INSERT 4hh6749zjr67 2970
INSERT 143ofpk3kupmn 8769
UPDATE 16cfhq1shjzu7 8439
UPDATE scijv0dgh6m4 4234

Server

When we want to run the application on a Java EE Server, such as JBoss AS7, we can use the JtaTransactionManager instead of the HibernateTransactionManager. We also get a reference to a datasource by looking it up in JNDI, i.e.,

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
    <bean id="company" class="model.logic.CompanyBean">
        <property name="sessionFactory" ref="sessionfactory"/>
    </bean>
    <bean id="sessionfactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="datasource"/>
        <property name="jtaTransactionManager" ref="transactionManager"/>
        <property name="mappingResources">
            <list>
                <value>model/entities/person.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>
                <prop key="hibernate.listeners.envers.autoRegister">${hibernate.listeners.envers.autoRegister}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
            </props>
        </property>
    </bean>
    <jee:jndi-lookup id="datasource" jndi-name="java:/jdbc/OracleDS" resource-ref="false"/>
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:spring.properties</value>
            </list>
        </property>
    </bean>
    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
    <tx:annotation-driven transaction-manager="transactionManager"/>
</beans>

To test the configuration we can use the following servlet

package userinterface.servlets;

import model.entities.Person;
import model.logic.Company;
import model.utils.SpringUtilities;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Random;

@WebServlet(name = "TestServlet", urlPatterns = "/testservlet")
public class TestServlet extends HttpServlet {

    private Random generator = null;
    private Company company = null;

    @Override
    public void init() throws ServletException {
        generator = new Random();
        company = SpringUtilities.getCompany();
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Person person = createPerson();

        if (generator.nextDouble() &lt; 0.01) {
            company.removePerson(person.getSofinummer());
        } else {
            company.insertPerson(person);
        }
    }

    @Override
    public void destroy() {
        generator = null;
        company = null;
    }

    private Person createPerson() {
        Person person = new Person();
        person.setNaam(Long.toString(Math.abs(generator.nextLong()), 36));
        person.setSofinummer(generator.nextInt(10000));
        return person;
    }
}

One thing to note is that when we need to develop a servlet (by using an IDE) we have to make sure the right classes are on the classpath. Usually, when developing a Java EE application the javaee-api-6.0.jar would suffice. One thing to note is that if we were to run our Test class again we would run into the following: Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation. To resolve this we need the full implementation of the bean-validator.jar on the classpath and make sure that it is loaded before the javaee-api-6.0.jar.

Before, we can deploy the application we have to make sure the Spring classes are picked up by the Web module. To this end, we create the following module on JBoss AS7. First, create a directory structure that includes the necessary jars and a module.xml file as follows

${JBOSS_HOME}/modules
	/org/springframework
		/main
			aopalliance-1.0.jar
			cglib-2.2.2.jar
			commons-logging-1.0.4.jar
			module.xml
			org.springframework.aop-3.1.2.RELEASE.jar
			org.springframework.asm-3.1.2.RELEASE.jar
			org.springframework.beans-3.1.2.RELEASE.jar
			org.springframework.context-3.1.2.RELEASE.jar
			org.springframework.core-3.1.2.RELEASE.jar
			org.springframework.expression-3.1.2.RELEASE.jar
			org.springframework.jdbc-3.1.2.RELEASE.jar
			org.springframework.jms-3.1.2.RELEASE.jar
			org.springframework.orm-3.1.2.RELEASE.jar
			org.springframework.transaction-3.1.2.RELEASE.jar
			org.springframework.web-3.1.2.RELEASE.jar

where module.xml has the following contents

<module xmlns="urn:jboss:module:1.1" name="org.springframework">
    <resources>
		<resource-root path="aopalliance-1.0.jar"/>
		<resource-root path="cglib-2.2.2.jar"/>
		<resource-root path="commons-logging-1.0.4.jar"/>
		<resource-root path="org.springframework.aop-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.asm-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.beans-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.context-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.core-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.expression-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.jdbc-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.jms-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.orm-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.transaction-3.1.2.RELEASE.jar"/>
		<resource-root path="org.springframework.web-3.1.2.RELEASE.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api" export="true"/>
        <module name="org.apache.log4j" export="true"/>
        <module name="org.antlr" export="true"/>
        <module name="org.dom4j" export="true"/>
        <module name="org.hibernate" export="true"/>
        <module name="javax.persistence.api" export="true"/>
        <module name="org.javassist" export="true"/>
        <module name="org.jboss.logging" export="true"/>
        <module name="javax.transaction.api" export="true"/>
    </dependencies>
</module>

Note that we also have included a Hibernate dependency (as this is needed by Spring when using Hibernate with it). To make sure we have all the required files, we can check a Hibernate 4 distribution and look in the ${HIBERNATE_HOME}/lib/required directory. That is, we need the following jars:

antlr-2.7.7.jar (loaded by adding the module org.antlr)
dom4j-1.6.1.jar (loaded by adding the module org.dom4j)
hibernate-commons-annotations-4.0.1.Final.jar (loaded by adding the module org.hibernate)
hibernate-core-4.0.1.Final.jar (loaded by adding the module org.hibernate)
hibernate-jpa-2.0-api-1.0.1.Final.jar (loaded by adding the module javax.persistence.api)
javassist-3.15.0-GA.jar (loaded by adding the module org.javassist)
jboss-logging-3.1.0.GA.jar (loaded by adding the module org.jboss.logging)
jboss-transaction-api_1.1_spec-1.0.0.Final.jar (loaded by adding the module javax.transaction.api)

Another important module that Spring depends on is the javax.api, as Spring needs XML related classes, such as parsers. Note that JBoss AS7 does not make javax packages, that are present in rt.jar, available. To make this happen we need to include the javax.api module. One important thing to note is that the javax.api module does not include a reference to javax.xml.parsers. To this end, edit the module.xml (located in the ${JBOSS_HOME}/modules/javax/api/main directory) and make sure that it does, i.e.,

<module xmlns="urn:jboss:module:1.1" name="javax.api">
    <dependencies>
        <system export="true">
            <paths>
				...
				<!-- To resolve java.lang.ClassNotFoundException: javax.xml.parsers.ParserConfigurationException from [Module "org.springframework:main" from local module loader @2393385d (roots: /home/jboss/jboss-as-7.1.0.Final/modules)] we have to add -->
                <path name="javax/xml/parsers"/>
				...
				<!-- java.lang.ClassNotFoundException: org.xml.sax.EntityResolver from [Module "org.springframework:main" from local module loader @2393385d (roots: /home/jboss/jboss-as-7.1.0.Final/modules)] is the first ClassNotFoundException we run into if the javax.api module is not added as a dependency to the org.springframework module -->
                <path name="org/xml/sax"/>
                <path name="org/xml/sax/ext"/>
                <path name="org/xml/sax/helpers"/>
            </paths>
        </system>
    </dependencies>
</module>

With the modules in place, restart the servers to make sure the modules are loaded

[jboss@axis-into-ict ~]$ cd jboss-as-7.1.0.Final/bin/

[jboss@axis-into-ict bin]$ ./jboss-cli.sh
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.

[disconnected /] connect 192.168.1.150:9999

[domain@192.168.1.150:9999 /] /host=jboss/server-config=cluster-server1:restart
{
    "outcome" => "success",
    "result" => "STARTING"
}
[domain@192.168.1.150:9999 /] /host=jboss/server-config=cluster-server2:restart
{
    "outcome" => "success",
    "result" => "STARTING"
}

As we are dealing with a .war deployment, we have to add the jboss-deployment-structure.xml file to the WEB-INF directory, such that the org.springframework module can be accessed by the Web module. The contents of jboss-deployment-structure.xml look as follows

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.springframework">
				<imports>
					<include path="META-INF**"/>
					<include path="org**"/>
				</imports>
			</module>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

The imports element above is critical for the proper functioning of the Spring custom name-space capabilities. Applications that use custom name-spaces and wish to use a shared Spring module must use the JBoss deployment structure descriptors with the imports above. To deploy the application we can use

[domain@192.168.1.150:9999 /] deploy /home/jboss/jboss-as-7.1.0.Final/deploy/springhibernate/SpringHibernate.war --server-groups=cluster-group
[domain@192.168.1.150:9999 /] undeploy SpringHibernate.war --server-groups=cluster-group

which also shows how to undeploy it. The application can be reached at http://192.168.1.150:8888/SpringHibernate/testservlet. After doing a few requests the following is observed in the logging:

# LOGGING CLUSTER_SERVER1
12:52:50,289 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp--192.168.1.150-9080-3) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@876e4b8: startup date [Tue Aug 14 12:52:50 CEST 2012]; root of context hierarchy
12:52:50,294 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp--192.168.1.150-9080-3) Loading XML bean definitions from class path resource [spring-config.xml]
12:52:50,345 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp--192.168.1.150-9080-3) Loading properties file from class path resource [spring.properties]
12:52:50,348 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp--192.168.1.150-9080-3) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6ddb6b07: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchy
12:52:50,366 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-3) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@2cc821ef
12:52:50,367 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-3) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@500b3f4c
12:52:50,368 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-3) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@26b58796
12:52:50,374 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp--192.168.1.150-9080-3) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
12:52:50,425 INFO  [org.hibernate.dialect.Dialect] (ajp--192.168.1.150-9080-3) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
12:52:50,428 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp--192.168.1.150-9080-3) HHH000397: Using ASTQueryTranslatorFactory
12:52:50,605 INFO  [stdout] (ajp--192.168.1.150-9080-3) UPDATE meh9qfr1uqch 5938
13:03:16,102 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE wegp27iyxw0j 2846
13:03:16,648 INFO  [stdout] (ajp--192.168.1.150-9080-4) INSERT 1xddpcvtis10e 5966
13:03:16,754 INFO  [stdout] (ajp--192.168.1.150-9080-7) INSERT mhvagbqaxgsd 7337
13:03:16,792 INFO  [stdout] (ajp--192.168.1.150-9080-7) UPDATE 34fxu4haa4q5 9804
13:03:16,866 INFO  [stdout] (ajp--192.168.1.150-9080-3) UPDATE 5amkxlyuzyp8 8927
13:03:16,942 INFO  [stdout] (ajp--192.168.1.150-9080-3) UPDATE 11ykc13m0r10b 4393
13:03:17,611 INFO  [stdout] (ajp--192.168.1.150-9080-3) INSERT 1fkms210dthwr 488
13:03:18,198 INFO  [stdout] (ajp--192.168.1.150-9080-3) INSERT cfp1i5sy4bpt 3455
13:03:18,223 INFO  [stdout] (ajp--192.168.1.150-9080-7) UPDATE p9jqdlnpv5d8 1074
13:03:18,246 INFO  [stdout] (ajp--192.168.1.150-9080-4) INSERT fnu0r03mgas0 2027
13:03:18,263 INFO  [stdout] (ajp--192.168.1.150-9080-3) UPDATE dgh5ib56gze7 1215
13:03:18,296 INFO  [stdout] (ajp--192.168.1.150-9080-7) INSERT 1n4x67w9aufr 7767
13:03:18,297 INFO  [stdout] (ajp--192.168.1.150-9080-9) UPDATE 8xy8prwm00yy 8807
13:03:18,326 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 1jkvwulhwqksx 6280
13:03:18,334 INFO  [stdout] (ajp--192.168.1.150-9080-8) INSERT 1lrmb4dyxurp2 5249
13:03:18,339 INFO  [stdout] (ajp--192.168.1.150-9080-3) UPDATE mo1vpdb5v0sm 5048
13:03:18,345 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE qb6e3wq3ok05 7163
13:03:18,357 INFO  [stdout] (ajp--192.168.1.150-9080-3) INSERT wlxcjpediiml 961
13:03:18,358 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT fr6ji76ohzsi 842
13:03:18,365 INFO  [stdout] (ajp--192.168.1.150-9080-7) INSERT 1otburj6mb9er 7645
13:03:18,372 INFO  [stdout] (ajp--192.168.1.150-9080-9) INSERT 198eulbfrkd0b 6503
# LOGGING CLUSTER_SERVER2
13:03:16,786 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp--192.168.1.150-9081-2) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@652130d1: startup date [Tue Aug 14 13:03:16 CEST 2012]; root of context hierarchy
13:03:16,830 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp--192.168.1.150-9081-2) Loading XML bean definitions from class path resource [spring-config.xml]
13:03:17,107 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp--192.168.1.150-9081-2) Loading properties file from class path resource [spring.properties]
13:03:17,127 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp--192.168.1.150-9081-2) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@5c594008: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor]; root of factory hierarchy
13:03:17,191 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9081-2) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@6ebfc8d0
13:03:17,192 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9081-2) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@3839029b
13:03:17,193 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9081-2) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@33ec79b6
13:03:17,286 INFO  [org.hibernate.annotations.common.Version] (ajp--192.168.1.150-9081-2) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
13:03:17,291 INFO  [org.hibernate.Version] (ajp--192.168.1.150-9081-2) HHH000412: Hibernate Core {4.0.1.Final}
13:03:17,293 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9081-2) HHH000206: hibernate.properties not found
13:03:17,295 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9081-2) HHH000021: Bytecode provider name : javassist
13:03:17,330 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp--192.168.1.150-9081-2) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
13:03:17,523 INFO  [org.hibernate.dialect.Dialect] (ajp--192.168.1.150-9081-2) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
13:03:17,543 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp--192.168.1.150-9081-2) HHH000397: Using ASTQueryTranslatorFactory
13:03:17,581 INFO  [org.hibernate.validator.util.Version] (ajp--192.168.1.150-9081-2) Hibernate Validator 4.2.0.Final
13:03:18,134 INFO  [stdout] (ajp--192.168.1.150-9081-4) INSERT 1fhk6fys4sd6j 9363
13:03:18,135 INFO  [stdout] (ajp--192.168.1.150-9081-8) INSERT re87jkorw73z 9832
13:03:18,141 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1ndgkrn77u2it 9820
13:03:18,142 INFO  [stdout] (ajp--192.168.1.150-9081-5) INSERT 1w2cp0u6lk89x 3356
13:03:18,143 INFO  [stdout] (ajp--192.168.1.150-9081-3) INSERT 17rjkpgd9eez9 5957
13:03:18,151 INFO  [stdout] (ajp--192.168.1.150-9081-9) UPDATE 1ke3x8flbzh2l 2468
13:03:18,152 INFO  [stdout] (ajp--192.168.1.150-9081-2) UPDATE b0hsnirgzegu 3428
13:03:18,208 INFO  [stdout] (ajp--192.168.1.150-9081-11) UPDATE 346ubsid1bcj 5107
13:03:18,217 INFO  [stdout] (ajp--192.168.1.150-9081-10) INSERT hhq72mspnlm6 3525
13:03:18,226 INFO  [stdout] (ajp--192.168.1.150-9081-3) INSERT 18z5vn487oq68 1145
13:03:18,229 INFO  [stdout] (ajp--192.168.1.150-9081-8) UPDATE 1g2v0qag7awbe 9292
13:03:18,241 INFO  [stdout] (ajp--192.168.1.150-9081-10) UPDATE 1iedrjwclb888 5015
13:03:18,244 INFO  [stdout] (ajp--192.168.1.150-9081-3) UPDATE h4nv7n4u4imi 431
13:03:18,256 INFO  [stdout] (ajp--192.168.1.150-9081-10) INSERT 146qoll1n1jpt 1994
13:03:18,265 INFO  [stdout] (ajp--192.168.1.150-9081-10) UPDATE sca0ze1e6a55 4618
13:03:18,273 INFO  [stdout] (ajp--192.168.1.150-9081-10) UPDATE neyi37tgskek 7683
13:03:18,331 INFO  [stdout] (ajp--192.168.1.150-9081-10) UPDATE 1itpm85ux9vu8 8101
13:03:18,344 INFO  [stdout] (ajp--192.168.1.150-9081-3) UPDATE 1hzxrlkqyxwvz 2642
13:03:18,350 INFO  [stdout] (ajp--192.168.1.150-9081-11) INSERT 1qsg68xingq39 5017
13:03:18,365 INFO  [stdout] (ajp--192.168.1.150-9081-8) INSERT 1a42lp62sxldw 6196
13:03:18,365 INFO  [stdout] (ajp--192.168.1.150-9081-10) UPDATE 1sd2tjmkikrwd 3633
13:03:18,368 INFO  [stdout] (ajp--192.168.1.150-9081-11) UPDATE 12326fhs1lgs6 1466
13:03:18,369 INFO  [stdout] (ajp--192.168.1.150-9081-3) INSERT 8z47zy6uo0lr 9042

JMS

Let us add some messaging as well. To this end, we add the following to the Spring configuration

<beans ...>
    <bean id="company" class="model.logic.CompanyBean">
        ...
        <property name="jmsTemplate" ref="jmstemplate"/>
    </bean>
	...
    <jee:jndi-lookup id="connectionfactory" jndi-name="java:/ConnectionFactory" resource-ref="false"/>
    <jee:jndi-lookup id="destination" jndi-name="java:/queue/test" resource-ref="false"/>
    <bean id="jmstemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="connectionfactory"/>
        <property name="defaultDestination" ref="destination"/>
    </bean>
    <bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
        <property name="connectionFactory" ref="connectionfactory"/>
        <property name="destination" ref="destination"/>
        <property name="messageListener" ref="companymdp"/>
    </bean>
    <bean id="companymdp" class="model.logic.CompanyMDP"/>
</beans>

To send messages we edit the CompanyBean class as follows, i.e., add a property called jmsTemplate, add a method sendMessage that is called from the insertPerson and removePerson methods

package model.logic;

import model.entities.Person;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;

@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public class CompanyBean implements Company {

    private SessionFactory sessionFactory;
	private JmsTemplate jmsTemplate;

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    public JmsTemplate getJmsTemplate() {
        return jmsTemplate;
    }

    public void setJmsTemplate(JmsTemplate jmsTemplate) {
        this.jmsTemplate = jmsTemplate;
    }

    public void insertPerson(Person person) {
        Person temporaryPerson = findPerson(person.getSofinummer());
        if (temporaryPerson == null) {
            System.out.println("INSERT " + person);
            getCurrentSession().save(person);
            sendMessage(person);
        } else {
            updatePerson(person);
        }
    }

    public void removePerson(Integer sofinummer) {
        Person temporaryPerson = findPerson(sofinummer);
        if (temporaryPerson != null) {
            System.out.println("REMOVE " + temporaryPerson);
            getCurrentSession().delete(temporaryPerson);
            sendMessage(temporaryPerson);
        }
    }

    public void updatePerson(Person person) {
        System.out.println("UPDATE " + person);
        getCurrentSession().merge(person);
    }

    private Person findPerson(Integer sofinummer) {
        return (Person) getCurrentSession().get(Person.class, sofinummer);
    }

    private final Session getCurrentSession() {
        return getSessionFactory().getCurrentSession();
    }

    private void sendMessage(final Person person) {
        getJmsTemplate().send(new MessageCreator(){
            public Message createMessage(javax.jms.Session session) throws JMSException {
                ObjectMessage message = session.createObjectMessage();
                message.setObject(person);
                return message;
            }
        });
    }
}

Before we can deploy the application, we have to make sure the javax.jms.api module is added to the org.springframework module, i.e.,

<module xmlns="urn:jboss:module:1.1" name="org.springframework">
    <resources>
	<resource-root path="aopalliance-1.0.jar"/>
	<resource-root path="cglib-2.2.2.jar"/>
	<resource-root path="commons-logging-1.0.4.jar"/>
	<resource-root path="org.springframework.aop-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.asm-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.beans-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.context-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.core-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.expression-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.jdbc-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.jms-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.orm-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.transaction-3.1.2.RELEASE.jar"/>
	<resource-root path="org.springframework.web-3.1.2.RELEASE.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api" export="true"/>
        <module name="org.apache.log4j" export="true"/>
        <module name="org.antlr" export="true"/>
        <module name="org.dom4j" export="true"/>
        <module name="org.hibernate" export="true"/>
        <module name="javax.persistence.api" export="true"/>
        <module name="org.javassist" export="true"/>
        <module name="org.jboss.logging" export="true"/>
        <module name="javax.transaction.api" export="true"/>
        <module name="javax.jms.api" export="true"/>
    </dependencies>
</module>

With the module in place, restart the servers and deploy the application, i.e.,

[domain@192.168.1.150:9999 /] undeploy SpringHibernate.war --server-groups=cluster-group
[domain@192.168.1.150:9999 /] /host=jboss/server-config=cluster-server2:restart
{
    "outcome" => "success",
    "result" => "STARTING"
}
[domain@192.168.1.150:9999 /] /host=jboss/server-config=cluster-server1:restart
{
    "outcome" => "success",
    "result" => "STARTING"
}
[domain@192.168.1.150:9999 /] deploy /home/jboss/jboss-as-7.1.0.Final/deploy/springhibernate/SpringHibernate.war --server-groups=cluster-group

The application can be reached at http://192.168.1.150:8888/SpringHibernate/testservlet. After doing a few requests the following is observed in the logging:

# LOGGING CLUSTER-SERVER1
15:45:13,723 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp--192.168.1.150-9080-5) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1b7fc253: startup date [Tue Aug 14 15:45:13 CEST 2012]; root of context hierarchy
15:45:13,760 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp--192.168.1.150-9080-5) Loading XML bean definitions from class path resource [spring-config.xml]
15:45:14,119 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp--192.168.1.150-9080-5) Loading properties file from class path resource [spring.properties]
15:45:14,141 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp--192.168.1.150-9080-5) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@411167f3: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.SimpleMessageListenerContainer#0,companymdp]; root of factory hierarchy
15:45:14,204 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-5) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@539546ee
15:45:14,204 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-5) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@3839029b
15:45:14,205 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-5) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@2818de48
15:45:14,291 INFO  [org.hibernate.annotations.common.Version] (ajp--192.168.1.150-9080-5) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
15:45:14,296 INFO  [org.hibernate.Version] (ajp--192.168.1.150-9080-5) HHH000412: Hibernate Core {4.0.1.Final}
15:45:14,297 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9080-5) HHH000206: hibernate.properties not found
15:45:14,299 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9080-5) HHH000021: Bytecode provider name : javassist
15:45:14,332 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp--192.168.1.150-9080-5) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
15:45:14,549 INFO  [org.hibernate.dialect.Dialect] (ajp--192.168.1.150-9080-5) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
15:45:14,567 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp--192.168.1.150-9080-5) HHH000397: Using ASTQueryTranslatorFactory
15:45:14,603 INFO  [org.hibernate.validator.util.Version] (ajp--192.168.1.150-9080-5) Hibernate Validator 4.2.0.Final
15:45:14,957 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp--192.168.1.150-9080-5) Starting beans in phase 2147483647
15:45:15,124 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT fe1g8llttlid 9594
15:45:15,185 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE fe1g8llttlid 9594
15:47:17,962 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1ruzaxp3ovrza 5434
15:47:18,507 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 13uem5a3s0tr0 4176
15:47:18,555 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 13uem5a3s0tr0 4176
15:47:18,573 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT o0on52y2q6rc 7154
15:47:18,581 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE o0on52y2q6rc 7154
15:47:18,686 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE ji9vigyqm6tn 1580
15:47:18,721 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT 501w5lrllrl1 6984
15:47:18,734 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 501w5lrllrl1 6984
15:47:18,795 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT q8i3p3v69ta9 9696
15:47:18,808 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE q8i3p3v69ta9 9696
15:47:18,870 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 187qlr278gvk2 7989
15:47:18,944 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT af0n7nhmhtn4 7354
15:47:18,954 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE af0n7nhmhtn4 7354
15:47:19,773 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT 1rki73vjyxick 4429
15:47:19,797 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 1rki73vjyxick 4429
15:47:19,805 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT 7t977akfo2gv 6383
15:47:19,813 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 7t977akfo2gv 6383
15:47:20,265 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 18nupcmjbywyz 9416
15:47:20,272 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 18nupcmjbywyz 9416
15:47:20,288 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE ul6rda8yg61u 1891
15:47:20,298 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 1fotcalk9shsq 1717
15:47:20,306 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT fz2zkhr4bw9g 4969
15:47:20,330 INFO  [stdout] (Thread-2 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE fz2zkhr4bw9g 4969
15:47:20,332 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT nqmx27r3vcoz 7686
15:47:20,357 INFO  [stdout] (ajp--192.168.1.150-9080-4) INSERT 14znb00a9jipx 363
15:47:20,374 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE nqmx27r3vcoz 7686
15:47:20,389 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 14znb00a9jipx 363
15:47:20,426 INFO  [stdout] (ajp--192.168.1.150-9080-9) INSERT 8ptga7h7jpeb 6888
15:47:20,428 INFO  [stdout] (ajp--192.168.1.150-9080-7) UPDATE cuy0x72tv27s 4669
15:47:20,447 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 8ptga7h7jpeb 6888
15:47:20,465 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 3mws48gl5lz8 4333
15:47:20,467 INFO  [stdout] (ajp--192.168.1.150-9080-4) INSERT tfcnb3v0zt7p 7984
15:47:20,477 INFO  [stdout] (ajp--192.168.1.150-9080-8) INSERT 1ahyu3xkspnxr 3201
15:47:20,496 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 3mws48gl5lz8 4333
15:47:20,497 INFO  [stdout] (ajp--192.168.1.150-9080-6) UPDATE 137a6srifr1gz 8905
15:47:20,501 INFO  [stdout] (ajp--192.168.1.150-9080-10) UPDATE 16epgzgkpuhyl 3052
15:47:20,528 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE x59b33fx74ec 2535
15:47:20,528 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE 1ahyu3xkspnxr 3201
15:47:20,531 INFO  [stdout] (ajp--192.168.1.150-9080-7) INSERT wkl0ag7vz56k 8274
15:47:20,537 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE tfcnb3v0zt7p 7984
15:47:20,543 INFO  [stdout] (Thread-4 (HornetQ-client-global-threads-1978193102)) RECEIVED OBJECT MESSAGE wkl0ag7vz56k 8274
# LOGGING CLUSTER-SERVER2
15:47:18,658 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@28b3cf4a: startup date [Tue Aug 14 15:47:18 CEST 2012]; root of context hierarchy
15:47:18,696 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Loading XML bean definitions from class path resource [spring-config.xml]
15:47:19,005 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Loading properties file from class path resource [spring.properties]
15:47:19,025 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3ff39e73: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.SimpleMessageListenerContainer#0,companymdp]; root of factory hierarchy
15:47:19,087 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@5935b50c
15:47:19,088 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@5b33a7af
15:47:19,090 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@54cf76c8
15:47:19,177 INFO  [org.hibernate.annotations.common.Version] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
15:47:19,182 INFO  [org.hibernate.Version] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) HHH000412: Hibernate Core {4.0.1.Final}
15:47:19,184 INFO  [org.hibernate.cfg.Environment] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) HHH000206: hibernate.properties not found
15:47:19,186 INFO  [org.hibernate.cfg.Environment] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) HHH000021: Bytecode provider name : javassist
15:47:19,221 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
15:47:19,433 INFO  [org.hibernate.dialect.Dialect] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
15:47:19,454 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) HHH000397: Using ASTQueryTranslatorFactory
15:47:19,486 INFO  [org.hibernate.validator.util.Version] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Hibernate Validator 4.2.0.Final
15:47:19,893 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) Starting beans in phase 2147483647
15:47:20,126 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-5) INSERT 1uygcxcowtu9a 331
15:47:20,127 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-6) INSERT mow4srfubly0 6092
15:47:20,180 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-4) INSERT 45ctomltbfnj 7350
15:47:20,182 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-3) INSERT 2bfcfctogwas 9945
15:47:20,186 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-2) INSERT 1ghndct2k38fq 7215
15:47:20,190 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-8) UPDATE 1q6wykxdwe57w 8885
15:47:20,191 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-9) UPDATE edte8od9xrou 4704
15:47:20,192 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-10) UPDATE 1adm2wi7sosp0 3801
15:47:20,194 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-11) INSERT 1cof2wpo05qux 8205
15:47:20,195 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-7) INSERT 1jq47i7b26tvp 609
15:47:20,307 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-7) INSERT 1qxeatjtlqzx5 3722
15:47:20,313 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-12) UPDATE cztialmryr6t 2306
15:47:20,323 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 45ctomltbfnj 7350
15:47:20,335 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-3) UPDATE s964r48d3sen 6153
15:47:20,343 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-8) UPDATE g9jng4dhqtha 8360
15:47:20,359 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-12) INSERT 1fs7d2l62ags4 9334
15:47:20,363 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1ghndct2k38fq 7215
15:47:20,372 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-8) UPDATE 1fac6z0zdhxfo 4796
15:47:20,377 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1jq47i7b26tvp 609
15:47:20,378 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-5) UPDATE 1vkso90xvg1kf 3038
15:47:20,381 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-3) INSERT b5jtmtrok3ay 9950
15:47:20,385 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-12) INSERT 1eob8au4ivjaq 7646
15:47:20,394 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1uygcxcowtu9a 331
15:47:20,400 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-5) INSERT g3tpmc15n1pw 7940
15:47:20,403 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1cof2wpo05qux 8205
15:47:20,412 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE mow4srfubly0 6092
15:47:20,419 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 2bfcfctogwas 9945
15:47:20,421 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-5) INSERT ub7uqkgxgvkn 7389
15:47:20,423 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1qxeatjtlqzx5 3722
15:47:20,433 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1fs7d2l62ags4 9334
15:47:20,437 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-12) INSERT 1o9uvk6v2q3yh 6427
15:47:20,445 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE b5jtmtrok3ay 9950
15:47:20,454 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1eob8au4ivjaq 7646
15:47:20,459 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-5) UPDATE ztxczcv9lczr 6350
15:47:20,467 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE g3tpmc15n1pw 7940
15:47:20,472 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-3) INSERT 1e50cqtnnx877 4627
15:47:20,492 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9081-12) INSERT gzgnffn3j4jv 7794
15:47:20,495 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE ub7uqkgxgvkn 7389
15:47:20,507 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1o9uvk6v2q3yh 6427
15:47:20,511 INFO  [stdout] (Thread-3 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE 1e50cqtnnx877 4627
15:47:20,520 INFO  [stdout] (Thread-1 (HornetQ-client-global-threads-699447810)) RECEIVED OBJECT MESSAGE gzgnffn3j4jv 7794

Transactions

In the example above we have used a SimpleMessageListenerContainer. A message listener container is used to receive messages from a JMS message queue and drive the MessageListener that is injected into it. The listener container is responsible for all threading of message reception and dispatches into the listener for processing. A message listener container is the intermediary between an MDP and a messaging provider, and takes care of registering to receive messages, participating in transactions, resource acquisition and release, exception conversion and suchlike. There are two standard JMS message listener containers packaged with Spring, each with its specialised feature set:

  • SimpleMessageListenerContainer – This message listener container is the simpler of the two standard flavors. It creates a fixed number of JMS sessions and consumers at startup, registers the listener using the standard JMS MessageConsumer.setMessageListener method, and leaves it up the JMS provider to perform listener callbacks. This variant does not allow for dynamic adaption to runtime demands or for participation in externally managed transactions. Compatibility-wise, it stays very close to the spirit of the standalone JMS specification – but is generally not compatible with Java EE’s JMS restrictions.
  • DefaultMessageListenerContainer – This message listener container is the one used in most cases. In contrast to SimpleMessageListenerContainer, this container variant does allow for dynamic adaption to runtime demands and is able to participate in externally managed transactions. Each received message is registered with an XA transaction when configured with a JtaTransactionManager; so processing may take advantage of XA transaction semantics. This listener container strikes a good balance between low requirements on the JMS provider, advanced functionality such as transaction participation, and compatibility with Java EE environments.

To use the second flavor in our set-up, we can change the Spring configuration to

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
    <bean id="company" class="model.logic.CompanyBean">
        <property name="sessionFactory" ref="sessionfactory"/>
        <property name="jmsTemplate" ref="jmstemplate"/>
    </bean>
	<!-- Hibernate SessionFactory config -->
    <bean id="sessionfactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="datasource"/>
        <property name="jtaTransactionManager" ref="transactionManager"/>
        <property name="mappingResources">
            <list>
                <value>model/entities/person.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>
                <prop key="hibernate.listeners.envers.autoRegister">${hibernate.listeners.envers.autoRegister}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
            </props>
        </property>
    </bean>
	<!-- Transaction config -->
	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
	<tx:annotation-driven transaction-manager="transactionManager"/>
	<!-- Resource look-ups -->
    <jee:jndi-lookup id="datasource" jndi-name="java:/jdbc/OracleDS" resource-ref="false"/>
    <jee:jndi-lookup id="connectionfactory" jndi-name="java:/JmsXA" resource-ref="false"/>
    <jee:jndi-lookup id="destination" jndi-name="java:/queue/test" resource-ref="false"/>
    <!-- JMS config -->
	<bean id="jmstemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="connectionfactory"/>
        <property name="defaultDestination" ref="destination"/>
    </bean>
    <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="connectionfactory"/>
        <property name="destination" ref="destination"/>
        <property name="transactionManager" ref="transactionManager"/>
        <property name="messageListener" ref="companymdp"/>
    </bean>
    <bean id="companymdp" class="model.logic.CompanyMDP"/>
	<!-- Extra -->
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:spring.properties</value>
            </list>
        </property>
    </bean>
</beans>

Note that code remains as it was. We have used the following JBoss configuration that shows how the used resources are configured

<domain xmlns="urn:jboss:domain:1.1">
	...
    <profiles>
        <profile name="cluster">
            <subsystem xmlns="urn:jboss:domain:datasources:1.0">
                <datasources>
                    <datasource jta="true" jndi-name="java:/jdbc/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true" use-ccm="true">
                        <connection-url>jdbc:oracle:thin:@192.168.1.60:1521:orcl11</connection-url>
                        <driver>oracle</driver>
                        <pool>
                            <min-pool-size>1</min-pool-size>
                            <max-pool-size>15</max-pool-size>
                            <prefill>true</prefill>
                            <use-strict-min>true</use-strict-min>
                        </pool>
                        <security>
                            <user-name>example</user-name>
                            <password>example</password>
                        </security>
                        <timeout>
                            <idle-timeout-minutes>0</idle-timeout-minutes>
                            <query-timeout>600</query-timeout>
                        </timeout>
                        <statement>
                            <prepared-statement-cache-size>10</prepared-statement-cache-size>
                        </statement>
                    </datasource>
                    <drivers>
                        <driver name="oracle" module="com.oracle.database">
                            <driver-class>oracle.jdbc.OracleDriver</driver-class>
                            <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
                        </driver>
                    </drivers>
                </datasources>
            </subsystem>
            <subsystem xmlns="urn:jboss:domain:messaging:1.1">
                <hornetq-server>
					...
                    <jms-connection-factories>
						...
                        <pooled-connection-factory name="hornetq-ra">
                            <transaction mode="xa"/>
                            <connectors>
                                <connector-ref connector-name="in-vm"/>
                            </connectors>
                            <entries>
                                <entry name="java:/JmsXA"/>
                            </entries>
                        </pooled-connection-factory>
                    </jms-connection-factories>
                    <jms-destinations>
                        <jms-queue name="testQueue">
                            <entry name="java:/queue/test"/>
                            <entry name="java:jboss/exported/jms/queue/test"/>
                        </jms-queue>
						...
                    </jms-destinations>
                </hornetq-server>
            </subsystem>
			...
        </profile>
    </profiles>
	...
    <deployments>
        <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear">
            <content sha1="161f51dde7f085c822cc4c68b306d57f1bee902d"/>
        </deployment>
        <deployment name="SpringHibernate.war" runtime-name="SpringHibernate.war">
            <content sha1="574d0617d92d8439844633557937be754a134370"/>
        </deployment>
    </deployments>
    <server-groups>
		...
        <server-group name="cluster-group" profile="cluster">
            <jvm name="default"/>
            <socket-binding-group ref="cluster-sockets"/>
            <deployments>
                <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear"/>
                <deployment name="SpringHibernate.war" runtime-name="SpringHibernate.war" enabled="false"/>
            </deployments>
        </server-group>
    </server-groups>
</domain>

Note that we have set the mode of the connection factory to XA (as is required when using the JtaTransactionManager and the DefaultMessageListenerContainer). One important thing to remember when using the DefaultMessageListenerContainer is that the default sessionAcknowledgeMode setting is AUTO_ACKNOWLEDGE (see here), so it not smart to use message.acknowledge in the MDP, otherwise we will run into

09:33:20,815 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@74359b24: startup date [Fri Aug 17 09:33:20 CEST 2012]; root of context hierarchy
09:33:20,945 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Loading XML bean definitions from class path resource [spring-config.xml]
09:33:21,415 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Loading properties file from class path resource [spring.properties]
09:33:21,441 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6c11e58: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.DefaultMessageListenerContainer#0,companymdp]; root of factory hierarchy
09:33:21,535 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@7e0cf590
09:33:21,536 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@4d50b06b
09:33:21,537 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@38d060ac
09:33:21,784 INFO  [org.hibernate.annotations.common.Version] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
09:33:21,792 INFO  [org.hibernate.Version] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000412: Hibernate Core {4.0.1.Final}
09:33:21,794 INFO  [org.hibernate.cfg.Environment] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000206: hibernate.properties not found
09:33:21,796 INFO  [org.hibernate.cfg.Environment] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000021: Bytecode provider name : javassist
09:33:21,907 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
09:33:22,517 INFO  [org.hibernate.dialect.Dialect] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
09:33:22,539 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) HHH000397: Using ASTQueryTranslatorFactory
09:33:22,652 INFO  [org.hibernate.validator.util.Version] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Hibernate Validator 4.2.0.Final
09:33:23,152 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) Starting beans in phase 2147483647
09:33:23,552 INFO  [stdout] (ajp-axis-into-ict.nl-192.168.1.150-9080-7) INSERT 1chrw6b78f2w9 9719
09:33:23,671 WARN  [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) Execution of JMS message listener failed, and no ErrorHandler has been set.: java.lang.RuntimeException: javax.jms.IllegalStateException: Non XA connection
    at model.logic.CompanyMDP.onMessage(CompanyMDP.java:16) [classes:]
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:326) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:244) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1071) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1063) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:960) [org.springframework.jms-3.1.2.RELEASE.jar:3.1.2.RELEASE]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
Caused by: javax.jms.IllegalStateException: Non XA connection
    at org.hornetq.ra.HornetQRASession.getSession(HornetQRASession.java:1246)
    at org.hornetq.ra.HornetQRAMessage.acknowledge(HornetQRAMessage.java:71)
    at model.logic.CompanyMDP.onMessage(CompanyMDP.java:13) [classes:]
    ... 9 more

Another thing worth mentioning is that within a JTA transaction, the parameters passed to create(Queue/Topic)Session(boolean transacted, int acknowledgeMode) method are not taken into account. Depending on the JavaEE transaction context, the container makes its own decisions on these values.

Let us deploy the application again and see what happens:

# LOGGING CLUSTER SERVER 1
14:03:01,180 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 32) JBAS015537: Activating WebServices Extension
14:03:01,242 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 36) JBAS013101: Activating Security Subsystem
14:03:01,245 INFO  [org.jboss.as.security] (MSC service thread 1-1) JBAS013100: Current PicketBox version=4.0.6.final
14:03:01,359 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 42) JBAS011800: Activating Naming Subsystem
14:03:01,420 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 41) JBAS011940: Activating OSGi Subsystem
14:03:01,491 INFO  [org.jboss.as.naming] (MSC service thread 1-3) JBAS011802: Starting Naming Service
14:03:01,508 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-3) JBAS015400: Bound mail session [java:jboss/mail/Default]
14:03:01,628 INFO  [org.jboss.as.clustering.jgroups] (ServerService Thread Pool -- 49) JBAS010260: Activating JGroups subsystem.
14:03:01,792 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 55) JBAS010280: Activating Infinispan subsystem.
14:03:01,813 INFO  [org.jboss.as.jacorb] (ServerService Thread Pool -- 54) JBAS016300: Activating JacORB Subsystem
14:03:01,883 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 58) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
14:03:01,894 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 59) JBAS016200: Activating ConfigAdmin Subsystem
14:03:01,913 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.1.GA
14:03:02,259 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 58) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)
14:03:02,275 INFO  [org.jboss.as.modcluster] (MSC service thread 1-2) JBAS011704: Mod_cluster uses default load balancer provider
14:03:02,389 INFO  [org.apache.coyote.http11.Http11AprProtocol] (MSC service thread 1-3) Starting Coyote HTTP/1.1 on http--192.168.1.150-8080
14:03:02,413 INFO  [org.jboss.modcluster.ModClusterService] (MSC service thread 1-2) Initializing mod_cluster 1.2.0.Final
14:03:02,471 INFO  [org.apache.coyote.ajp.AjpAprProtocol] (MSC service thread 1-4) Starting Coyote AJP/1.3 on ajp--192.168.1.150-9080
14:03:02,515 INFO  [org.jboss.as.connector] (MSC service thread 1-3) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
14:03:02,551 INFO  [org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl] (MSC service thread 1-2) Listening to proxy advertisements on 224.0.1.105:23364
14:03:02,700 INFO  [org.jboss.as.jaxr] (MSC service thread 1-1) Binding JAXR ConnectionFactory: java:jboss/jaxr/ConnectionFactory
14:03:03,010 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messagingjournal,bindingsDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messagingbindings,largeMessagesDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messaginglargemessages,pagingDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server1/data/messagingpaging)
14:03:03,012 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) Waiting to obtain live lock
14:03:03,064 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 55) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.
14:03:03,244 INFO  [org.hornetq.core.persistence.impl.journal.JournalStorageManager] (MSC service thread 1-1) Using AIO Journal
14:03:03,256 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 55) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.
14:03:03,673 INFO  [org.jboss.as.jacorb] (MSC service thread 1-3) JBAS016330: CORBA ORB Service started
14:03:03,741 INFO  [org.hornetq.core.server.impl.AIOFileLockNodeManager] (MSC service thread 1-1) Waiting to obtain live lock
14:03:03,742 INFO  [org.hornetq.core.server.impl.AIOFileLockNodeManager] (MSC service thread 1-1) Live Server Obtained live lock
14:03:04,099 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
14:03:04,107 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/jdbc/OracleDS]
14:03:04,133 INFO  [org.jboss.as.jacorb] (MSC service thread 1-3) JBAS016328: CORBA Naming Service started
14:03:04,698 INFO  [org.jboss.as.remoting] (MSC service thread 1-3) JBAS017100: Listening on axis-into-ict.nl/192.168.1.150:4447
14:03:05,157 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-1) Started Netty Acceptor version 3.2.5.Final-a96d88c axis-into-ict.nl:5445 for CORE protocol
14:03:05,158 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-1) Started Netty Acceptor version 3.2.5.Final-a96d88c axis-into-ict.nl:5455 for CORE protocol
14:03:05,159 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) Server is now live
14:03:05,160 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) HornetQ Server version 2.2.11.Final (HQ_2_2_11_FINAL_AS7, 122) [2e926cad-78e4-11e1-b1c7-000c2976c82d]) started
14:03:05,166 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) trying to deploy queue jms.queue.testQueue
14:03:05,180 INFO  [org.jboss.as.messaging] (MSC service thread 1-1) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/test
14:03:05,181 INFO  [org.jboss.as.messaging] (MSC service thread 1-1) JBAS011601: Bound messaging object to jndi name java:/queue/test
14:03:05,210 INFO  [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
14:03:05,211 INFO  [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
14:03:05,212 INFO  [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011601: Bound messaging object to jndi name java:/RemoteConnectionFactory
14:03:05,213 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.topic.testTopic
14:03:05,278 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/topic/test
14:03:05,281 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/topic/test
14:03:05,288 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-3) JBAS010406: Registered connection factory java:/JmsXA
14:03:05,297 INFO  [org.hornetq.ra.HornetQResourceAdapter] (MSC service thread 1-3) HornetQ resource adaptor started
14:03:05,298 INFO  [org.jboss.as.connector.services.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-3) IJ020002: Deployed: file://RaActivatorhornetq-ra
14:03:05,309 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-4) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]
14:03:05,397 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 7781ms - Started 169 of 292 services (121 services are passive or on-demand)
14:03:11,925 INFO  [org.jboss.modcluster.ModClusterService] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Engine [jboss.web] will use jvmRoute: 2c78c6e8-7325-3857-8bfc-d957f56114dc
14:04:34,838 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "SpringHibernate.war"
14:04:35,410 INFO  [org.jboss.web] (MSC service thread 1-3) JBAS018210: Registering web context: /SpringHibernate
14:04:35,621 INFO  [org.jboss.as.server] (host-controller-connection-threads - 1) JBAS018559: Deployed "SpringHibernate.war"
14:05:11,613 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp--192.168.1.150-9080-7) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4e24faf1: startup date [Wed Aug 22 14:05:11 CEST 2012]; root of context hierarchy
14:05:11,651 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp--192.168.1.150-9080-7) Loading XML bean definitions from class path resource [spring-config.xml]
14:05:11,912 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp--192.168.1.150-9080-7) Loading properties file from class path resource [spring.properties]
14:05:11,932 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp--192.168.1.150-9080-7) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@215a730d: defining beans [company,sessionfactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,datasource,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.DefaultMessageListenerContainer#0,companymdp,propertyConfigurer]; root of factory hierarchy
14:05:11,990 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-7) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@16360771
14:05:11,991 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-7) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@76efb90
14:05:11,992 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9080-7) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@500c8efc
14:05:12,080 INFO  [org.hibernate.annotations.common.Version] (ajp--192.168.1.150-9080-7) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
14:05:12,084 INFO  [org.hibernate.Version] (ajp--192.168.1.150-9080-7) HHH000412: Hibernate Core {4.0.1.Final}
14:05:12,086 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9080-7) HHH000206: hibernate.properties not found
14:05:12,088 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9080-7) HHH000021: Bytecode provider name : javassist
14:05:12,124 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp--192.168.1.150-9080-7) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
14:05:12,355 INFO  [org.hibernate.dialect.Dialect] (ajp--192.168.1.150-9080-7) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
14:05:12,376 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp--192.168.1.150-9080-7) HHH000397: Using ASTQueryTranslatorFactory
14:05:12,414 INFO  [org.hibernate.validator.util.Version] (ajp--192.168.1.150-9080-7) Hibernate Validator 4.2.0.Final
14:05:12,790 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp--192.168.1.150-9080-7) Starting beans in phase 2147483647
14:05:12,921 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE tdq5p6nrua78 881
14:05:13,111 INFO  [stdout] (ajp--192.168.1.150-9080-7) INSERT 3zbulkvppaht 1587
14:05:13,192 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 3zbulkvppaht 1587
14:05:19,838 INFO  [stdout] (ajp--192.168.1.150-9080-7) INSERT 3677kx0gg6p8 3335
14:05:19,878 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 3677kx0gg6p8 3335
14:05:20,597 INFO  [stdout] (ajp--192.168.1.150-9080-7) UPDATE qd3nfb51iltt 5472
14:05:21,157 INFO  [stdout] (ajp--192.168.1.150-9080-7) INSERT 170gdo1t8e5ko 3391
14:05:21,225 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 170gdo1t8e5ko 3391
14:05:21,242 INFO  [stdout] (ajp--192.168.1.150-9080-6) INSERT 1vaezfdq5d887 5839
14:05:21,294 INFO  [stdout] (ajp--192.168.1.150-9080-3) UPDATE jlha13ox3hwq 4651
14:05:21,321 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1vaezfdq5d887 5839
14:05:21,368 INFO  [stdout] (ajp--192.168.1.150-9080-4) UPDATE s84z6ya9j2w5 65
14:05:21,443 INFO  [stdout] (ajp--192.168.1.150-9080-4) INSERT zsnamkv7f31q 4
14:05:21,505 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE zsnamkv7f31q 4
14:05:21,515 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT 1f7y1xru7z3ol 1814
14:05:21,530 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1f7y1xru7z3ol 1814
14:05:21,589 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 35fccgwsvlo0 2309
14:05:21,663 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT u0sdivuxanqf 1574
14:05:21,680 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE u0sdivuxanqf 1574
14:05:21,740 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE h93lz8lmamwm 7188
14:05:21,811 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT z03kievlq3ec 9039
14:05:21,866 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE z03kievlq3ec 9039
14:05:21,893 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1xfiowipw18ie 6334
14:05:21,960 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT t12jyo6mydxp 8628
14:05:21,995 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE t12jyo6mydxp 8628
14:05:22,035 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1b7mtaj9ux4cf 6651
14:05:22,070 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1b7mtaj9ux4cf 6651
14:05:22,109 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1497gjpwnx06e 5835
14:05:22,124 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1497gjpwnx06e 5835
14:05:22,182 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE jusago26clrr 470
14:05:22,257 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE cl3qbhtfb7ul 7990
14:05:22,330 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1nvbqqb80m410 2000
14:05:22,377 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1nvbqqb80m410 2000
14:05:22,405 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT hfpwva5k7dgp 6255
14:05:22,439 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE hfpwva5k7dgp 6255
14:05:22,479 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE awkvfp0doliq 6581
14:05:22,553 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1xbh2guvpaeal 2005
14:05:22,627 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT bq62t89yksnl 7832
14:05:22,645 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE bq62t89yksnl 7832
14:05:22,701 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1v9cegaooyl7l 8801
14:05:22,778 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 5afihmfmz78m 8493
14:05:22,817 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 5afihmfmz78m 8493
14:05:22,886 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1u06cy6ymizsc 8529
14:05:22,961 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE cnj2vloagv7n 105
14:05:23,034 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 7knlbcrs35tv 4975
14:05:23,070 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 7knlbcrs35tv 4975
14:05:23,109 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE icaxkpdgtqix 8605
14:05:23,183 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT ib776bswgvgs 1069
14:05:23,199 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE ib776bswgvgs 1069
14:05:23,258 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE pfbjj6qrx0lk 4247
14:05:23,337 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1flpyivctw575 7035
14:05:23,354 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1flpyivctw575 7035
14:05:23,408 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE hlot1fnb068s 1172
14:05:23,479 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT sz4k5gzq3jop 5815
14:05:23,495 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE sz4k5gzq3jop 5815
14:05:23,560 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT ay53hxwhydvt 1006
14:05:23,577 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE ay53hxwhydvt 1006
14:05:23,628 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE p8izdhg3kqwl 20
14:05:23,702 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1cbvcvwojd9r1 4816
14:05:23,776 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT bdeoggzsp10b 3061
14:05:23,834 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE bdeoggzsp10b 3061
14:05:23,851 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE tpkz5b3l2qxg 3116
14:05:23,925 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 9egiwbb1zqtk 9439
14:05:24,002 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE pebum5s3v56r 7314
14:05:24,072 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 5tvfzpub30ea 1084
14:05:24,091 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 5tvfzpub30ea 1084
14:05:24,147 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1pf8pteh26ykp 3161
14:05:24,225 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 3ze6zl91gz7b 916
14:05:24,276 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 3ze6zl91gz7b 916
14:05:24,295 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE zu9klw0bi6wd 1375
14:05:24,369 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1wf30ovze2jtf 1643
14:05:24,443 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 3evnoqlt6oag 4807
14:05:24,464 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 3evnoqlt6oag 4807
14:05:24,517 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT jixj7dxjn3bp 6387
14:05:24,532 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE jixj7dxjn3bp 6387
14:05:24,592 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT a01r5mb9ldf4 6501
14:05:24,620 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE a01r5mb9ldf4 6501
14:05:24,665 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 18w9pp8mdk461 2853
14:05:24,740 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE devujxahhtzj 4128
14:05:24,814 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1i88goa3n83oh 4485
14:05:24,837 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1i88goa3n83oh 4485
14:05:24,888 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 43shzvb5wlak 4168
14:05:24,963 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT t6gc6fxquz4m 1388
14:05:24,986 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE t6gc6fxquz4m 1388
14:05:25,036 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE qklpn5ve0ozp 2928
14:05:25,111 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 1nrm8lmgk26hp 7968
14:05:25,184 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE pdby3n7ae41s 8360
14:05:25,259 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT leqaa72xl4gm 810
14:05:25,274 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE leqaa72xl4gm 810
14:05:25,332 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1xyro8op0a0f3 4288
14:05:25,349 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1xyro8op0a0f3 4288
14:05:25,407 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1c12hea4x2acw 7731
14:05:25,451 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1c12hea4x2acw 7731
14:05:25,481 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT rzlgra4tco9e 8689
14:05:25,541 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE rzlgra4tco9e 8689
14:05:25,555 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1j7f10xaqfmv5 298
14:05:25,598 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1j7f10xaqfmv5 298
14:05:25,629 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1nah1yqhlz161 9179
14:05:25,662 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1nah1yqhlz161 9179
14:05:25,703 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE r8txbotr8vav 8849
14:05:25,778 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1g6cybvqakdi9 9726
14:05:25,818 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1g6cybvqakdi9 9726
14:05:25,852 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 14plps4rq06yt 7683
14:05:25,926 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 203bvunibuxk 8672
14:05:26,000 INFO  [stdout] (ajp--192.168.1.150-9080-5) REMOVE 1r9iozlb7qu9r 2409
14:05:26,018 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1r9iozlb7qu9r 2409
14:05:26,074 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1ppcfzih1b7n1 2650
14:05:26,089 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1ppcfzih1b7n1 2650
14:05:26,149 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1txlmv2g46ejn 7653
14:05:26,165 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1txlmv2g46ejn 7653
14:05:26,223 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE 14htpvro4ua8b 6724
14:05:26,297 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT gko8x4cupkow 2930
14:05:26,312 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE gko8x4cupkow 2930
14:05:26,370 INFO  [stdout] (ajp--192.168.1.150-9080-5) UPDATE v1umqwkx1k66 2260
14:05:26,445 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT zgqo2m35w2rf 1036
14:05:26,462 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE zgqo2m35w2rf 1036
14:05:26,519 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 13wg0dr2yz95m 5299
14:05:26,573 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 13wg0dr2yz95m 5299
14:05:26,601 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT m0u74puq89vw 9140
14:05:26,668 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 1o73cgsnhxe1l 7199
14:05:26,690 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE m0u74puq89vw 9140
14:05:26,742 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE g3gvziu30w7f 2402
14:05:26,815 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE zjf2pdu9snm1 1587
14:05:26,889 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 615ovr9vnkzc 2066
14:05:26,964 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT jpwd49sr1cly 5427
14:05:26,992 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE jpwd49sr1cly 5427
14:05:27,038 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT 1s0qu81j9u4q 2307
14:05:27,057 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1s0qu81j9u4q 2307
14:05:27,111 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT 1s0apr8p9juh4 1542
14:05:27,146 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1s0apr8p9juh4 1542
14:05:27,186 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE gjs31ymrin87 4821
14:05:27,260 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 11vot9hvntfs8 35
14:05:27,334 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 1xo7mg9v65stg 1049
14:05:27,408 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT wktkiqe9pqns 4409
14:05:27,424 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE wktkiqe9pqns 4409
14:05:27,482 INFO  [stdout] (ajp--192.168.1.150-9080-2) INSERT tm5zdpk92har 7091
14:05:27,556 INFO  [stdout] (ajp--192.168.1.150-9080-5) INSERT 1bc5firf5fmpp 4603
14:05:27,581 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE tm5zdpk92har 7091
14:05:27,673 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 7wamgve30owb 4823
14:05:27,678 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1bc5firf5fmpp 4603
14:05:27,705 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE gdphs99168dv 3373
14:05:27,780 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE 1g9af1sb4cg8a 8509
14:05:27,853 INFO  [stdout] (ajp--192.168.1.150-9080-2) UPDATE nz1m577xzqs0 9061
# LOGGING CLUSTER SERVER 2
14:03:01,204 INFO  [org.jboss.as.webservices] (ServerService Thread Pool -- 32) JBAS015537: Activating WebServices Extension
14:03:01,288 INFO  [org.jboss.as.security] (ServerService Thread Pool -- 36) JBAS013101: Activating Security Subsystem
14:03:01,312 INFO  [org.jboss.as.security] (MSC service thread 1-2) JBAS013100: Current PicketBox version=4.0.6.final
14:03:01,367 INFO  [org.jboss.as.osgi] (ServerService Thread Pool -- 41) JBAS011940: Activating OSGi Subsystem
14:03:01,398 INFO  [org.jboss.as.naming] (ServerService Thread Pool -- 42) JBAS011800: Activating Naming Subsystem
14:03:01,538 INFO  [org.jboss.as.naming] (MSC service thread 1-2) JBAS011802: Starting Naming Service
14:03:01,575 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
14:03:01,635 INFO  [org.jboss.as.clustering.jgroups] (ServerService Thread Pool -- 49) JBAS010260: Activating JGroups subsystem.
14:03:01,706 INFO  [org.jboss.as.jacorb] (ServerService Thread Pool -- 54) JBAS016300: Activating JacORB Subsystem
14:03:01,716 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 55) JBAS010280: Activating Infinispan subsystem.
14:03:01,809 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 58) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
14:03:01,819 INFO  [org.jboss.as.configadmin] (ServerService Thread Pool -- 59) JBAS016200: Activating ConfigAdmin Subsystem
14:03:01,832 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-2) JBoss Web Services - Stack CXF Server 4.0.1.GA
14:03:02,005 INFO  [org.jboss.as.connector] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.7.Final)
14:03:02,190 INFO  [org.jboss.as.modcluster] (MSC service thread 1-2) JBAS011704: Mod_cluster uses default load balancer provider
14:03:02,253 INFO  [org.jboss.as.jaxr] (MSC service thread 1-1) Binding JAXR ConnectionFactory: java:jboss/jaxr/ConnectionFactory
14:03:02,340 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 58) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)
14:03:02,366 INFO  [org.jboss.modcluster.ModClusterService] (MSC service thread 1-2) Initializing mod_cluster 1.2.0.Final
14:03:02,417 INFO  [org.apache.coyote.ajp.AjpAprProtocol] (MSC service thread 1-4) Starting Coyote AJP/1.3 on ajp-axis-into-ict.nl-192.168.1.150-9081
14:03:02,475 INFO  [org.apache.coyote.http11.Http11AprProtocol] (MSC service thread 1-3) Starting Coyote HTTP/1.1 on http-axis-into-ict.nl-192.168.1.150-8081
14:03:02,479 INFO  [org.jboss.modcluster.advertise.impl.AdvertiseListenerImpl] (MSC service thread 1-2) Listening to proxy advertisements on 224.0.1.105:23364
14:03:02,647 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server2/data/messagingjournal,bindingsDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server2/data/messagingbindings,largeMessagesDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server2/data/messaginglargemessages,pagingDirectory=/home/jboss/jboss-as-7.1.0.Final/domain/servers/cluster-server2/data/messagingpaging)
14:03:02,651 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) Waiting to obtain live lock
14:03:02,858 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 55) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.
14:03:02,885 INFO  [org.hornetq.core.persistence.impl.journal.JournalStorageManager] (MSC service thread 1-1) Using AIO Journal
14:03:03,042 INFO  [org.infinispan.configuration.cache.EvictionConfigurationBuilder] (ServerService Thread Pool -- 55) ISPN000152: Passivation configured without an eviction policy being selected. Only manually evicted entities will be pasivated.
14:03:03,486 INFO  [org.jboss.as.jacorb] (MSC service thread 1-3) JBAS016330: CORBA ORB Service started
14:03:03,584 INFO  [org.hornetq.core.server.impl.AIOFileLockNodeManager] (MSC service thread 1-1) Waiting to obtain live lock
14:03:03,586 INFO  [org.hornetq.core.server.impl.AIOFileLockNodeManager] (MSC service thread 1-1) Live Server Obtained live lock
14:03:03,859 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
14:03:03,943 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:/jdbc/OracleDS]
14:03:04,191 INFO  [org.jboss.as.jacorb] (MSC service thread 1-3) JBAS016328: CORBA Naming Service started
14:03:04,825 INFO  [org.jboss.as.remoting] (MSC service thread 1-4) JBAS017100: Listening on axis-into-ict.nl/192.168.1.150:4448
14:03:05,139 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-1) Started Netty Acceptor version 3.2.5.Final-a96d88c axis-into-ict.nl:5446 for CORE protocol
14:03:05,141 INFO  [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-1) Started Netty Acceptor version 3.2.5.Final-a96d88c axis-into-ict.nl:5456 for CORE protocol
14:03:05,142 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) Server is now live
14:03:05,143 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) HornetQ Server version 2.2.11.Final (HQ_2_2_11_FINAL_AS7, 122) [3f00f7a1-78e4-11e1-800d-000c2976c82d]) started
14:03:05,163 INFO  [org.jboss.as.messaging] (MSC service thread 1-1) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory
14:03:05,165 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-2) trying to deploy queue jms.topic.testTopic
14:03:05,203 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:/topic/test
14:03:05,210 INFO  [org.jboss.as.messaging] (MSC service thread 1-2) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/topic/test
14:03:05,211 INFO  [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
14:03:05,212 INFO  [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011601: Bound messaging object to jndi name java:/RemoteConnectionFactory
14:03:05,214 INFO  [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-3) trying to deploy queue jms.queue.testQueue
14:03:05,224 INFO  [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/test
14:03:05,232 INFO  [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011601: Bound messaging object to jndi name java:/queue/test
14:03:05,261 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-1) JBAS010406: Registered connection factory java:/JmsXA
14:03:05,270 INFO  [org.hornetq.ra.HornetQResourceAdapter] (MSC service thread 1-1) HornetQ resource adaptor started
14:03:05,271 INFO  [org.jboss.as.connector.services.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-1) IJ020002: Deployed: file://RaActivatorhornetq-ra
14:03:05,274 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-2) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]
14:03:05,359 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 7666ms - Started 169 of 292 services (121 services are passive or on-demand)
14:03:11,983 INFO  [org.jboss.modcluster.ModClusterService] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Engine [jboss.web] will use jvmRoute: 4d87f106-10ff-342f-a6e6-eb2377d7c23f
14:04:34,835 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "SpringHibernate.war"
14:04:35,550 INFO  [org.jboss.web] (MSC service thread 1-2) JBAS018210: Registering web context: /SpringHibernate
14:04:35,621 INFO  [org.jboss.as.server] (host-controller-connection-threads - 2) JBAS018559: Deployed "SpringHibernate.war"
14:05:16,923 INFO  [org.springframework.context.support.ClassPathXmlApplicationContext] (ajp--192.168.1.150-9081-8) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@a58d300: startup date [Wed Aug 22 14:05:16 CEST 2012]; root of context hierarchy
14:05:16,960 INFO  [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ajp--192.168.1.150-9081-8) Loading XML bean definitions from class path resource [spring-config.xml]
14:05:17,216 INFO  [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer] (ajp--192.168.1.150-9081-8) Loading properties file from class path resource [spring.properties]
14:05:17,234 INFO  [org.springframework.beans.factory.support.DefaultListableBeanFactory] (ajp--192.168.1.150-9081-8) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@164163e1: defining beans [company,sessionfactory,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,datasource,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.DefaultMessageListenerContainer#0,companymdp,propertyConfigurer]; root of factory hierarchy
14:05:17,301 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9081-8) Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserTransaction@575887db
14:05:17,302 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9081-8) Using JTA TransactionManager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@445aa997
14:05:17,303 INFO  [org.springframework.transaction.jta.JtaTransactionManager] (ajp--192.168.1.150-9081-8) Using JTA TransactionSynchronizationRegistry: com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@1b1dd242
14:05:17,389 INFO  [org.hibernate.annotations.common.Version] (ajp--192.168.1.150-9081-8) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
14:05:17,394 INFO  [org.hibernate.Version] (ajp--192.168.1.150-9081-8) HHH000412: Hibernate Core {4.0.1.Final}
14:05:17,395 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9081-8) HHH000206: hibernate.properties not found
14:05:17,397 INFO  [org.hibernate.cfg.Environment] (ajp--192.168.1.150-9081-8) HHH000021: Bytecode provider name : javassist
14:05:17,435 WARN  [org.hibernate.internal.util.xml.DTDEntityResolver] (ajp--192.168.1.150-9081-8) HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
14:05:17,659 INFO  [org.hibernate.dialect.Dialect] (ajp--192.168.1.150-9081-8) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
14:05:17,678 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ajp--192.168.1.150-9081-8) HHH000397: Using ASTQueryTranslatorFactory
14:05:17,711 INFO  [org.hibernate.validator.util.Version] (ajp--192.168.1.150-9081-8) Hibernate Validator 4.2.0.Final
14:05:17,993 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (ajp--192.168.1.150-9081-8) Starting beans in phase 2147483647
14:05:18,212 INFO  [stdout] (ajp--192.168.1.150-9081-8) UPDATE 1nuxg993ownem 3052
14:05:21,115 INFO  [stdout] (ajp--192.168.1.150-9081-8) UPDATE afhvji2k8ft7 2716
14:05:21,185 INFO  [stdout] (ajp--192.168.1.150-9081-5) INSERT 1ihgf2p7aavvv 6429
14:05:21,328 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1ihgf2p7aavvv 6429
14:05:21,329 INFO  [stdout] (ajp--192.168.1.150-9081-3) UPDATE 1om511m6nzi22 4774
14:05:21,343 INFO  [stdout] (ajp--192.168.1.150-9081-4) INSERT 1hwkf2797ujf6 5149
14:05:21,404 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1hwkf2797ujf6 5149
14:05:21,441 INFO  [stdout] (ajp--192.168.1.150-9081-6) INSERT 1ezyhvfha3q2t 3836
14:05:21,478 INFO  [stdout] (ajp--192.168.1.150-9081-4) UPDATE 1ixbel89n7f5w 9298
14:05:21,502 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1ezyhvfha3q2t 3836
14:05:21,551 INFO  [stdout] (ajp--192.168.1.150-9081-6) INSERT 1us8n7k0bnqpo 5426
14:05:21,593 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1us8n7k0bnqpo 5426
14:05:21,627 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1ppw7krne465v 6792
14:05:21,701 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1prt2df94i5mk 2092
14:05:21,776 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 10gvhg82ztew9 2783
14:05:21,793 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 10gvhg82ztew9 2783
14:05:21,858 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1bd9yo40vzizt 1911
14:05:21,923 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 5n9h8rwq7q60 1343
14:05:21,997 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 8m9k1pr28gg 5547
14:05:22,013 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 8m9k1pr28gg 5547
14:05:22,071 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 17r9ee4bt0yxs 3649
14:05:22,150 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1gn2tjij0f1ob 1035
14:05:22,219 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT m6xox6axoz3b 3157
14:05:22,235 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE m6xox6axoz3b 3157
14:05:22,294 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 110r9484rvt73 294
14:05:22,310 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 110r9484rvt73 294
14:05:22,368 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1c9c6tb2agswh 9932
14:05:22,407 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1c9c6tb2agswh 9932
14:05:22,444 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 50ipwt1zajdx 2131
14:05:22,515 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 29h8tcc65j3 4548
14:05:22,533 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 29h8tcc65j3 4548
14:05:22,594 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT bhunhawsm27p 1700
14:05:22,611 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE bhunhawsm27p 1700
14:05:22,664 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 9bh7fa74xnrm 1225
14:05:22,738 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 19f4hj421s3fe 5128
14:05:22,815 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT ydgfqj2u2aax 8844
14:05:22,833 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE ydgfqj2u2aax 8844
14:05:22,849 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT mmw7kqjojuyq 1966
14:05:22,865 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE mmw7kqjojuyq 1966
14:05:22,923 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE qpbhdyvgftko 9965
14:05:22,997 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT m22f1xogzs2w 5940
14:05:23,013 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE m22f1xogzs2w 5940
14:05:23,075 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE q9lquj1fxj4m 4504
14:05:23,147 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE belkm98whjwh 7385
14:05:23,222 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1dq640hgxrqoe 496
14:05:23,239 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1dq640hgxrqoe 496
14:05:23,294 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1pevcvw6wa91q 8567
14:05:23,323 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1pevcvw6wa91q 8567
14:05:23,370 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 15bm9suyux8ui 1530
14:05:23,389 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 15bm9suyux8ui 1530
14:05:23,443 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1kmqno89copfp 7009
14:05:23,516 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1l8beowesem93 8780
14:05:23,547 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1l8beowesem93 8780
14:05:23,595 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1k9yrkaxqeizz 7066
14:05:23,665 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE p93n8ojg5gaf 8632
14:05:23,739 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1v9ix94fvw3s2 5428
14:05:23,813 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT eo8kvhum40m3 4855
14:05:23,849 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE eo8kvhum40m3 4855
14:05:23,887 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT ehuvh8mnrdor 7519
14:05:23,901 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE ehuvh8mnrdor 7519
14:05:23,962 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 42395k914sap 9967
14:05:23,988 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 42395k914sap 9967
14:05:24,035 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT y3s6i0iy5bxc 2600
14:05:24,051 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE y3s6i0iy5bxc 2600
14:05:24,111 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 3us32d2krjvq 4008
14:05:24,186 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 9rg1q23jbt1h 5890
14:05:24,208 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 9rg1q23jbt1h 5890
14:05:24,332 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1ayxc04tdei19 9978
14:05:24,348 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1ayxc04tdei19 9978
14:05:24,406 INFO  [stdout] (ajp--192.168.1.150-9081-7) REMOVE 1aczxa7rq66gc 7734
14:05:24,422 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1aczxa7rq66gc 7734
14:05:24,480 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1qxbi4c03ptl3 2096
14:05:24,494 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1qxbi4c03ptl3 2096
14:05:24,554 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE k2zwhkup05z6 8428
14:05:24,633 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT as7552dnufu 899
14:05:24,648 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE as7552dnufu 899
14:05:24,703 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT l5zi29x6gxno 5344
14:05:24,717 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE l5zi29x6gxno 5344
14:05:24,777 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE r311dyu91dym 1859
14:05:24,852 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1fxxn3gl91h8m 3280
14:05:24,925 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1xqnw0zd807wd 2425
14:05:24,975 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1xqnw0zd807wd 2425
14:05:25,001 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1md19po93vtqw 6630
14:05:25,073 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 2c9cplr913cz 1431
14:05:25,108 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 2c9cplr913cz 1431
14:05:25,147 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT v43yhet3xd1g 66
14:05:25,162 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE v43yhet3xd1g 66
14:05:25,221 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1f7m1o552i1ap 5103
14:05:25,296 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1vso63da2hxsz 4821
14:05:25,369 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT sz5f4p22ihxm 8460
14:05:25,418 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE sz5f4p22ihxm 8460
14:05:25,445 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 2a7fe1kbyn05 3485
14:05:25,496 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 2a7fe1kbyn05 3485
14:05:25,518 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT ydkzaajaai23 8793
14:05:25,585 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE ydkzaajaai23 8793
14:05:25,593 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1nazvx44fsryy 2224
14:05:25,610 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1nazvx44fsryy 2224
14:05:25,667 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT ckpdo13cbu3v 8647
14:05:25,681 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE ckpdo13cbu3v 8647
14:05:25,740 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT bnydn2bxk8wd 1831
14:05:25,755 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE bnydn2bxk8wd 1831
14:05:25,815 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE fl1lk4bscdoj 7360
14:05:25,889 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE r8s5rxlisovh 3498
14:05:25,963 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1o12rg3cdx2vk 1350
14:05:26,037 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1gr04agkc8l6 4563
14:05:26,111 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1c3ksedbtpaoq 3054
14:05:26,150 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1c3ksedbtpaoq 3054
14:05:26,185 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 17s438pq34yde 3952
14:05:26,219 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 17s438pq34yde 3952
14:05:26,259 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 14grcfgntxm7g 6624
14:05:26,274 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 14grcfgntxm7g 6624
14:05:26,333 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 9rlyy5ku91wv 257
14:05:26,348 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 9rlyy5ku91wv 257
14:05:26,407 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 5ek3d1123mwp 3383
14:05:26,451 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 5ek3d1123mwp 3383
14:05:26,481 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT xucmrjfo2tkr 3652
14:05:26,526 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE xucmrjfo2tkr 3652
14:05:26,556 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 13st8rbs16ek0 4776
14:05:26,586 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 13st8rbs16ek0 4776
14:05:26,631 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 21xvhp0ohbc0 6680
14:05:26,705 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT yyqn8d3edsvp 340
14:05:26,751 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE yyqn8d3edsvp 340
14:05:26,779 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 19qwovr0pstvu 3878
14:05:26,852 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 10lz3rhlhi1mn 8828
14:05:26,926 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 5m3i1gvcm0jx 4490
14:05:26,971 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 5m3i1gvcm0jx 4490
14:05:27,007 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 10x2dlavqagr7 1772
14:05:27,053 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 10x2dlavqagr7 1772
14:05:27,074 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1irlznr87cp7v 6876
14:05:27,149 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT jh9pj68vmhla 7165
14:05:27,196 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE jh9pj68vmhla 7165
14:05:27,222 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 2eibuwgmnyai 1734
14:05:27,297 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE cmh5uq6jfdh1 1425
14:05:27,371 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1by141cbe2jw2 3937
14:05:27,415 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1by141cbe2jw2 3937
14:05:27,446 INFO  [stdout] (ajp--192.168.1.150-9081-7) INSERT 1t1gansg3mryj 540
14:05:27,520 INFO  [stdout] (ajp--192.168.1.150-9081-6) INSERT b8uhwlgalst0 7532
14:05:27,544 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE b8uhwlgalst0 7532
14:05:27,584 INFO  [stdout] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) RECEIVED OBJECT MESSAGE 1t1gansg3mryj 540
14:05:27,594 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1ox069v1p4zue 7684
14:05:27,686 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 12obz6cvdizpk 4250
14:05:27,741 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE z7hc2gm1tko7 9967
14:05:27,819 INFO  [stdout] (ajp--192.168.1.150-9081-7) UPDATE 1sn0ranavpi7w 4442

Migration

Let us just deploy the application on WebLogic Server and see if we can get the Spring Hibernate application to work here as well. To this end, we create two shared libraries one for Spring 3.1.2 and one for Hibernate 4.1.2. The hibernate-4.1.war shared library has the following contents:

hibernate-4.1
	META-INF
		MANIFEST.MF
	WEB-INF
		lib
			antlr-2.7.7.jar
			dom4j-1.6.1.jar
			hibernate-commons-annotations-4.0.1.Final.jar
			hibernate-core-4.1.2.Final.jar
			hibernate-jpa-2.0-api-1.0.1.Final.jar
			javassist-3.15.0-GA.jar
			jboss-logging-3.1.0.GA.jar
			jboss-transaction-api_1.1_spec-1.0.0.Final.jar

in which the MANIFEST.MF contains:

Manifest-Version: 1.0
Created-By: 1.6.0_05 (BEA Systems, Inc.)
Extension-Name: hibernate
Specification-Title: Hibernate Library
Specification-Version: 4.1
Specification-Vendor: Middleware Magic
Implementation-Title: Hibernate Library
Implementation-Version: 4.1.2
Implementation-Vendor: Middleware Magic

The spring-3.1.war shared library has the following contents:

spring-3.1
	META-INF
		MANIFEST.MF
	WEB-INF
		lib
			aopalliance-1.0.jar
			cglib-2.2.2.jar
			commons-logging-1.0.4.jar
			org.springframework.aop-3.1.2.RELEASE.jar
			org.springframework.asm-3.1.2.RELEASE.jar
			org.springframework.beans-3.1.2.RELEASE.jar
			org.springframework.context-3.1.2.RELEASE.jar
			org.springframework.core-3.1.2.RELEASE.jar
			org.springframework.expression-3.1.2.RELEASE.jar
			org.springframework.jdbc-3.1.2.RELEASE.jar
			org.springframework.jms-3.1.2.RELEASE.jar
			org.springframework.orm-3.1.2.RELEASE.jar
			org.springframework.transaction-3.1.2.RELEASE.jar
			org.springframework.web-3.1.2.RELEASE.jar

in which the MANIFEST.MF contains:

Manifest-Version: 1.0
Created-By: 1.6.0_05 (BEA Systems, Inc.)
Extension-Name: spring
Specification-Title: Spring Library
Specification-Version: 3.1
Specification-Vendor: Middleware Magic
Implementation-Title: Spring Library
Implementation-Version: 3.1.2
Implementation-Vendor: Middleware Magic

We deploy the shared libraries to the WebLogic environment that is set-up as in the post Deploy WebLogic12c to Multiple Machines. The used Spring configuration looks as follows:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
    <bean id="company" class="model.logic.CompanyBean">
        <property name="sessionFactory" ref="sessionfactory"/>
        <property name="jmsTemplate" ref="jmstemplate"/>
    </bean>
	<!-- Hibernate SessionFactory config -->
    <bean id="sessionfactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="datasource"/>
        <property name="jtaTransactionManager" ref="transactionManager"/>
        <property name="mappingResources">
            <list>
                <value>model/entities/person.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>
                <prop key="hibernate.listeners.envers.autoRegister">${hibernate.listeners.envers.autoRegister}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
            </props>
        </property>
    </bean>
	<!-- Transaction config -->
	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"/>
	<tx:annotation-driven transaction-manager="transactionManager"/>
	<!-- Resource look-ups -->
    <jee:jndi-lookup id="datasource" jndi-name="jdbc/exampleDS" resource-ref="false"/>
    <jee:jndi-lookup id="connectionfactory" jndi-name="jms/ConnectionFactory" resource-ref="false"/>
	<jee:jndi-lookup id="destination" jndi-name="jms/CompanyQueue" resource-ref="false"/>
    <!-- JMS config -->
	<bean id="jmstemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="connectionfactory"/>
        <property name="defaultDestination" ref="destination"/>
    </bean>
    <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="connectionfactory"/>
        <property name="destination" ref="destination"/>
        <property name="transactionManager" ref="transactionManager"/>
        <property name="messageListener" ref="companymdp"/>
    </bean>
    <bean id="companymdp" class="model.logic.CompanyMDP"/>
	<!-- Extra -->
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:spring.properties</value>
            </list>
        </property>
    </bean>
</beans>

Note that the only things that are changed are the JNDI-names of the used resources (data source, connection factory and destination). In order to deploy the application to WebLogic we can use the following directory structure

/springhibernate
	/app
		SpringHibernate.war
	/plan
		/WEB-INF
			weblogic.xml
		plan.xml

in which weblogic.xml has the following contents

<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
	<container-descriptor>
		<prefer-application-packages>
			<package-name>antlr.*</package-name>
		</prefer-application-packages>
	</container-descriptor>
	<library-ref>
		<library-name>hibernate</library-name>
		<specification-version>4.1</specification-version>
		<implementation-version>4.1.2</implementation-version>
		<exact-match>true</exact-match>
	</library-ref>
	<library-ref>
		<library-name>spring</library-name>
		<specification-version>3.1</specification-version>
		<implementation-version>3.1.2</implementation-version>
		<exact-match>true</exact-match>
	</library-ref>
</weblogic-web-app>

When the application is deployed and the testservlet is accessed the following is observed in the logging

# LOGGING CLUSTER-SERVER1
Aug 17, 2012 11:17:18 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1e3741a5: startup date [Fri Aug 17 11:17:18 CEST 2012]; root of context hierarchy
Aug 17, 2012 11:17:18 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-config.xml]
Aug 17, 2012 11:17:18 AM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from class path resource [spring.properties]
Aug 17, 2012 11:17:18 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1e57db48: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.DefaultMessageListenerContainer#0,companymdp]; root of factory hierarchy
Aug 17, 2012 11:17:18 AM org.springframework.transaction.jta.JtaTransactionManager checkUserTransactionAndTransactionManager
INFO: Using JTA UserTransaction: ClientTM[cluster-server1+axis-into-ict.nl:9001+base_domain+t3+]
Aug 17, 2012 11:17:18 AM org.springframework.transaction.jta.JtaTransactionManager checkUserTransactionAndTransactionManager
INFO: Using JTA TransactionManager: ClientTM[cluster-server1+axis-into-ict.nl:9001+base_domain+t3+]
Aug 17, 2012 11:17:18 AM org.springframework.transaction.jta.JtaTransactionManager initTransactionSynchronizationRegistry
INFO: Using JTA TransactionSynchronizationRegistry: ClientTM[cluster-server1+axis-into-ict.nl:9001+base_domain+t3+]
Aug 17, 2012 11:17:19 AM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Aug 17, 2012 11:17:19 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.2.Final}
Aug 17, 2012 11:17:19 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Aug 17, 2012 11:17:19 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Aug 17, 2012 11:17:19 AM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Aug 17, 2012 11:17:19 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
Aug 17, 2012 11:17:19 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Aug 17, 2012 11:17:20 AM org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup start
INFO: Starting beans in phase 2147483647
INSERT 1vfaxqqm2868k 9170
RECEIVED OBJECT MESSAGE 1vfaxqqm2868k 9170
INSERT 1azwiw7lwh4y7 6205
RECEIVED OBJECT MESSAGE 1azwiw7lwh4y7 6205
UPDATE 1t4a3l9tlt0i1 7843
UPDATE 1gpie3s1fmk7a 5058
UPDATE wgiimvyfwc8i 5756
INSERT 1tmgsmdsi2sbh 435
RECEIVED OBJECT MESSAGE 1tmgsmdsi2sbh 435
UPDATE 1mqtq9gwil0py 8978
INSERT ts5nfho8b4wb 3167
RECEIVED OBJECT MESSAGE ts5nfho8b4wb 3167
INSERT j878nzzqf3b3 3553
RECEIVED OBJECT MESSAGE j878nzzqf3b3 3553
INSERT 1upuhpirvr0a7 938
RECEIVED OBJECT MESSAGE 1upuhpirvr0a7 938
UPDATE mgt58gj3d61n 3538
INSERT 1q5smfr3dh6df 2715
RECEIVED OBJECT MESSAGE 1q5smfr3dh6df 2715
UPDATE 1r3jwyj2g5x5m 6113
UPDATE 1d6cpm9lavqwg 1972
INSERT vxc1h63kfy2w 1496
RECEIVED OBJECT MESSAGE vxc1h63kfy2w 1496
INSERT 55otw4aj7n7u 3826
RECEIVED OBJECT MESSAGE 55otw4aj7n7u 3826
INSERT 1dl36wovta1vf 8045
RECEIVED OBJECT MESSAGE 1dl36wovta1vf 8045
INSERT p1693zg2q0bl 4673
RECEIVED OBJECT MESSAGE p1693zg2q0bl 4673
INSERT 1e6c1ssik0esu 8536
RECEIVED OBJECT MESSAGE 1e6c1ssik0esu 8536
INSERT w7hlqytbosrt 2874
RECEIVED OBJECT MESSAGE w7hlqytbosrt 2874
UPDATE 152p5lvqwxco8 9516
INSERT byh8hu448t7w 8913
RECEIVED OBJECT MESSAGE byh8hu448t7w 8913
INSERT 1dajek4kv7xgb 8368
RECEIVED OBJECT MESSAGE 1dajek4kv7xgb 8368
INSERT ju0rs6v1k0dv 6421
RECEIVED OBJECT MESSAGE ju0rs6v1k0dv 6421
UPDATE 107qwp5m3bh6u 4167
INSERT uewom3s9awr0 4933
RECEIVED OBJECT MESSAGE uewom3s9awr0 4933
INSERT 1gejfty8uqly1 9279
RECEIVED OBJECT MESSAGE 1gejfty8uqly1 9279
INSERT ixpxzvpr08ww 5428
RECEIVED OBJECT MESSAGE ixpxzvpr08ww 5428
INSERT 17qi3yaxwtrxu 7411
RECEIVED OBJECT MESSAGE 17qi3yaxwtrxu 7411
UPDATE 7fgzuwkcz48e 5716
INSERT 1tbtnsilprbmm 8680
RECEIVED OBJECT MESSAGE 1tbtnsilprbmm 8680
UPDATE 1b2b771wi8waz 6832
INSERT 14v47vzyr5egt 564
RECEIVED OBJECT MESSAGE 14v47vzyr5egt 564
INSERT v30iv4nv8g5n 4052
RECEIVED OBJECT MESSAGE v30iv4nv8g5n 4052
UPDATE 1f2rqzn03y5qq 7750
REMOVE 1ibtlrunczhdk 4166
REMOVE 19fzxc64sngs1 5131
INSERT 981c8ahs90go 6356
RECEIVED OBJECT MESSAGE 1ibtlrunczhdk 4166
RECEIVED OBJECT MESSAGE 981c8ahs90go 6356
RECEIVED OBJECT MESSAGE 19fzxc64sngs1 5131
INSERT 1dm92l3kuloyc 3669
RECEIVED OBJECT MESSAGE 1dm92l3kuloyc 3669
UPDATE 3dtym6dsmm8j 6477
UPDATE jm5v2s8kq5cn 436
UPDATE 1aa1z7okdo09k 8246
INSERT jjnultqc90f4 9607
RECEIVED OBJECT MESSAGE jjnultqc90f4 9607
INSERT 1mmixox5tpnnn 3279
RECEIVED OBJECT MESSAGE 1mmixox5tpnnn 3279
INSERT 1227bi0v86b3t 4022
RECEIVED OBJECT MESSAGE 1227bi0v86b3t 4022
UPDATE stvbc1ya5lc2 8047
UPDATE 1xntj3pwd7p9x 258
UPDATE 1k6r3ryeo8ulm 6901
UPDATE b2e526chsv6o 2934
INSERT 1q0axu96bm6lg 7173
RECEIVED OBJECT MESSAGE 1q0axu96bm6lg 7173
INSERT sigdxvz05hsi 3065
RECEIVED OBJECT MESSAGE sigdxvz05hsi 3065
INSERT 1hgbown1i5fc9 6686
RECEIVED OBJECT MESSAGE 1hgbown1i5fc9 6686
UPDATE 9s7hmdtntgkd 4601
UPDATE 17ce0wl4ealwc 2423
UPDATE 1a96qcppjpe5f 7212
UPDATE 152pp0q3zk8zg 4671
INSERT tdlhx4yk0pmg 9733
RECEIVED OBJECT MESSAGE tdlhx4yk0pmg 9733
UPDATE 622um5vc14mq 7765
INSERT 1lsx0iiup6gg5 6041
RECEIVED OBJECT MESSAGE 1lsx0iiup6gg5 6041
UPDATE 16ekljbz9e387 4309
UPDATE 1cezkqse6hvd0 3349
UPDATE 1a6olflotven8 1087
INSERT 1au7gq4p6mv8c 3261
RECEIVED OBJECT MESSAGE 1au7gq4p6mv8c 3261
INSERT 1em7bsp3g29w 2566
RECEIVED OBJECT MESSAGE 1em7bsp3g29w 2566
INSERT 1a4mkxcpjug71 6167
RECEIVED OBJECT MESSAGE 1a4mkxcpjug71 6167
UPDATE pmw4v5xst33l 5002
UPDATE 1mpp7mfpl5kru 682
UPDATE 10z3im4emd96i 4022
UPDATE 1jxworov8e1z9 9844
INSERT 1sedtpmbhtquc 270
RECEIVED OBJECT MESSAGE 1sedtpmbhtquc 270
UPDATE lwesgdzgwpl0 8422
UPDATE gvjyxm2c7jd0 5366
INSERT moiepveyd9xt 9931
RECEIVED OBJECT MESSAGE moiepveyd9xt 9931
INSERT a8kfudlzxcxy 6156
RECEIVED OBJECT MESSAGE a8kfudlzxcxy 6156
UPDATE o0hx0zv9qgzg 3469
INSERT ugs4gnhafozq 6680
RECEIVED OBJECT MESSAGE ugs4gnhafozq 6680
INSERT sdheu51y4yfx 8489
RECEIVED OBJECT MESSAGE sdheu51y4yfx 8489
UPDATE sq6j7i0baitp 6699
INSERT v2ojrjfekv9k 4533
RECEIVED OBJECT MESSAGE v2ojrjfekv9k 4533
UPDATE 10wfve0yjl4k4 4589
INSERT uqwxetfuogwt 9849
RECEIVED OBJECT MESSAGE uqwxetfuogwt 9849
UPDATE 1ush98l72a9d3 8258
UPDATE owyg8kl65g8j 4156
INSERT pb8v2gufr6rh 6497
RECEIVED OBJECT MESSAGE pb8v2gufr6rh 6497
INSERT dmfq7qiueu7x 9955
RECEIVED OBJECT MESSAGE dmfq7qiueu7x 9955
INSERT 13ke7pnvs9ylu 7792
RECEIVED OBJECT MESSAGE 13ke7pnvs9ylu 7792
INSERT y7kbegscmisj 896
RECEIVED OBJECT MESSAGE y7kbegscmisj 896
UPDATE 2iwm9v61fvhy 749
INSERT bdmcdk1ogf9l 6628
RECEIVED OBJECT MESSAGE bdmcdk1ogf9l 6628
INSERT 18bysp3l4gb0f 6056
RECEIVED OBJECT MESSAGE 18bysp3l4gb0f 6056
UPDATE 16hr14gvrsh1k 2122
UPDATE hyp4ojojxdes 8218
UPDATE 1khy3p4q9dclk 747
UPDATE 1uzuvg1xslcky 9561
UPDATE 1kgdpavy2chez 519
INSERT 1mox60j02zh85 9798
RECEIVED OBJECT MESSAGE 1mox60j02zh85 9798
INSERT ci128g9jo27u 7739
RECEIVED OBJECT MESSAGE ci128g9jo27u 7739
INSERT 6j5syb4xpota 9066
RECEIVED OBJECT MESSAGE 6j5syb4xpota 9066
UPDATE 652v8hhke5ai 4884
UPDATE 1u1dzud98psop 2480
UPDATE q6ci13nicvri 9825
INSERT 1n81wvaep5nr6 6212
RECEIVED OBJECT MESSAGE 1n81wvaep5nr6 6212
INSERT 18ncq6m6s1acl 3285
RECEIVED OBJECT MESSAGE 18ncq6m6s1acl 3285
INSERT zjtnfrh2ajsj 3407
RECEIVED OBJECT MESSAGE zjtnfrh2ajsj 3407
UPDATE q5ug6q1daqpn 6675
INSERT uzaeixyt6g0l 610
RECEIVED OBJECT MESSAGE uzaeixyt6g0l 610
INSERT rpftez66w9rr 1695
RECEIVED OBJECT MESSAGE rpftez66w9rr 1695
UPDATE 135a8m7uhk006 4194
UPDATE 14exorxy3klbg 5424
UPDATE 14r1nopyggixk 7215
UPDATE 1izhgww1gazcn 5707
UPDATE gz1k3p3nyzcz 30
UPDATE fnf7ggv9gy8s 7314
UPDATE 2ql8f9rupz8g 1206
UPDATE 7ylaxoxi9uua 4279
INSERT x5wphn4pz0xf 7045
RECEIVED OBJECT MESSAGE x5wphn4pz0xf 7045
UPDATE b8x13s890p7v 3471
INSERT ij7897v2tqp2 8531
RECEIVED OBJECT MESSAGE ij7897v2tqp2 8531
UPDATE 1ir4dulll98sj 7765
INSERT hwiqxp6cx32v 2775
RECEIVED OBJECT MESSAGE hwiqxp6cx32v 2775
INSERT 19lblxbbkdoi0 7419
RECEIVED OBJECT MESSAGE 19lblxbbkdoi0 7419
INSERT 1dgxsd9fcwthk 6299
RECEIVED OBJECT MESSAGE 1dgxsd9fcwthk 6299
UPDATE 17owe7epcdanl 7480
UPDATE qvzncb916e1l 6856
INSERT 1c5pamjalavz0 6374
RECEIVED OBJECT MESSAGE 1c5pamjalavz0 6374
INSERT 1xndfh1zhsm8t 7993
RECEIVED OBJECT MESSAGE 1xndfh1zhsm8t 7993
INSERT 1kz8donqnnc8g 2967
RECEIVED OBJECT MESSAGE 1kz8donqnnc8g 2967
INSERT 19qq0303net89 1906
RECEIVED OBJECT MESSAGE 19qq0303net89 1906
INSERT sax47077f9ka 3016
RECEIVED OBJECT MESSAGE sax47077f9ka 3016
INSERT pufs4n4rhr1e 7255
RECEIVED OBJECT MESSAGE pufs4n4rhr1e 7255
INSERT 1e5kf8rlv0kav 5159
RECEIVED OBJECT MESSAGE 1e5kf8rlv0kav 5159
INSERT 1ulnvxkxowbly 7415
RECEIVED OBJECT MESSAGE 1ulnvxkxowbly 7415
UPDATE t9edlkta9x06 7882
UPDATE 1pkra952k87nb 2277
INSERT 1v4x4t69qoyvv 1948
RECEIVED OBJECT MESSAGE 1v4x4t69qoyvv 1948
INSERT ynlrxbwg2o86 9056
RECEIVED OBJECT MESSAGE ynlrxbwg2o86 9056
INSERT 1pjurxwpfoafo 2735
RECEIVED OBJECT MESSAGE 1pjurxwpfoafo 2735
UPDATE sxec5z2fdc8t 9386
INSERT 1po7ankt6q1e6 1401
RECEIVED OBJECT MESSAGE 1po7ankt6q1e6 1401
UPDATE 10wjk2jzd5rgb 1541
UPDATE 1rs2vq5yy7603 4562
INSERT 12l3q5i8xcyem 6099
RECEIVED OBJECT MESSAGE 12l3q5i8xcyem 6099
INSERT 105ia9hr5xg3t 4083
RECEIVED OBJECT MESSAGE 105ia9hr5xg3t 4083
INSERT naup4tcu7c2w 9001
RECEIVED OBJECT MESSAGE naup4tcu7c2w 9001
INSERT r97pmgdg7z4y 4698
RECEIVED OBJECT MESSAGE r97pmgdg7z4y 4698
INSERT 11bba4337czby 444
RECEIVED OBJECT MESSAGE 11bba4337czby 444
INSERT lcodtofso3fy 3621
RECEIVED OBJECT MESSAGE lcodtofso3fy 3621
INSERT o2l983w9jov8 8912
RECEIVED OBJECT MESSAGE o2l983w9jov8 8912
INSERT 1urnou35ulywu 697
RECEIVED OBJECT MESSAGE 1urnou35ulywu 697
INSERT 1lvbw429diy7v 9018
RECEIVED OBJECT MESSAGE 1lvbw429diy7v 9018
INSERT 1p4pa3tntgroo 2444
RECEIVED OBJECT MESSAGE 1p4pa3tntgroo 2444
INSERT qxiiwynhc3gj 9248
RECEIVED OBJECT MESSAGE qxiiwynhc3gj 9248
# LOGGING CLUSTER-SERVER2
Aug 17, 2012 11:25:34 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1e701a84: startup date [Fri Aug 17 11:25:34 CEST 2012]; root of context hierarchy
Aug 17, 2012 11:25:35 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-config.xml]
Aug 17, 2012 11:25:35 AM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties
INFO: Loading properties file from class path resource [spring.properties]
Aug 17, 2012 11:25:35 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1e9c800e: defining beans [company,sessionfactory,datasource,propertyConfigurer,transactionManager,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,connectionfactory,destination,jmstemplate,org.springframework.jms.listener.DefaultMessageListenerContainer#0,companymdp]; root of factory hierarchy
Aug 17, 2012 11:25:35 AM org.springframework.transaction.jta.JtaTransactionManager checkUserTransactionAndTransactionManager
INFO: Using JTA UserTransaction: ClientTM[cluster-server2+axis-into-ict.nl:9002+base_domain+t3+]
Aug 17, 2012 11:25:35 AM org.springframework.transaction.jta.JtaTransactionManager checkUserTransactionAndTransactionManager
INFO: Using JTA TransactionManager: ClientTM[cluster-server2+axis-into-ict.nl:9002+base_domain+t3+]
Aug 17, 2012 11:25:35 AM org.springframework.transaction.jta.JtaTransactionManager initTransactionSynchronizationRegistry
INFO: Using JTA TransactionSynchronizationRegistry: ClientTM[cluster-server2+axis-into-ict.nl:9002+base_domain+t3+]
Aug 17, 2012 11:25:35 AM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Aug 17, 2012 11:25:35 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.2.Final}
Aug 17, 2012 11:25:35 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Aug 17, 2012 11:25:35 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Aug 17, 2012 11:25:36 AM org.hibernate.internal.util.xml.DTDEntityResolver resolveEntity
WARN: HHH000223: Recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
Aug 17, 2012 11:25:36 AM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
Aug 17, 2012 11:25:36 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
Aug 17, 2012 11:25:37 AM org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup start
INFO: Starting beans in phase 2147483647
INSERT 1ro7iaej9wd9k 8795
RECEIVED OBJECT MESSAGE 1ro7iaej9wd9k 8795
INSERT 1b1fcai34faga 6314
RECEIVED OBJECT MESSAGE 1b1fcai34faga 6314
INSERT 1v57ryimse5uf 9755
RECEIVED OBJECT MESSAGE 1v57ryimse5uf 9755
INSERT yx01xew3z2jh 9354
RECEIVED OBJECT MESSAGE yx01xew3z2jh 9354
UPDATE um8jioyfz2xw 3576
UPDATE fzzhd0wiga1j 5555
UPDATE g2yjl64y5r26 9223
UPDATE 1ajjz2xwnb0xy 6102
INSERT sc8lrc1ltn1c 3679
RECEIVED OBJECT MESSAGE sc8lrc1ltn1c 3679
UPDATE 19g20kvci9lgc 3349
INSERT yekowaz2yvvv 2135
RECEIVED OBJECT MESSAGE yekowaz2yvvv 2135
UPDATE hgoeapqkrf3h 9331
INSERT qoioytyju0pd 8055
RECEIVED OBJECT MESSAGE qoioytyju0pd 8055
UPDATE q9kkzncyf9vg 5423
INSERT 1e0hjp4authf2 7252
RECEIVED OBJECT MESSAGE 1e0hjp4authf2 7252
INSERT kfuv64fpg5xh 9006
RECEIVED OBJECT MESSAGE kfuv64fpg5xh 9006
UPDATE 1bzhy6v1trxil 2834
INSERT 3jeohjlsc4ai 3093
RECEIVED OBJECT MESSAGE 3jeohjlsc4ai 3093
INSERT dlbnur9etkbu 9469
RECEIVED OBJECT MESSAGE dlbnur9etkbu 9469
UPDATE 1p02mjgb66m5c 8668
UPDATE 1nkdo6q2dok30 6031
INSERT 1memxxtvl9d7j 8365
RECEIVED OBJECT MESSAGE 1memxxtvl9d7j 8365
INSERT 18qq5qqnowk38 4747
RECEIVED OBJECT MESSAGE 18qq5qqnowk38 4747
INSERT ojxr6mn4bkpf 4212
RECEIVED OBJECT MESSAGE ojxr6mn4bkpf 4212
INSERT 1s4hpfjw4uckk 8261
RECEIVED OBJECT MESSAGE 1s4hpfjw4uckk 8261
UPDATE a7267e4nojm5 7415
UPDATE 121eduf2de5o7 1629
INSERT 1jp76tnlkkk23 5448
RECEIVED OBJECT MESSAGE 1jp76tnlkkk23 5448
INSERT b3cvx730ikth 129
RECEIVED OBJECT MESSAGE b3cvx730ikth 129
UPDATE 11pwub752h6e4 4900
INSERT 1rra35pu4kx34 5472
RECEIVED OBJECT MESSAGE 1rra35pu4kx34 5472
UPDATE 1s0zsfne0divn 4096
UPDATE 1rtoy57gl7bhu 2614
UPDATE ezzxkiss0quj 3927
UPDATE 1l9zzie9sjjwx 8543
INSERT 1hufcx719vzm1 3106
RECEIVED OBJECT MESSAGE 1hufcx719vzm1 3106
UPDATE 1wifye5nhv9fh 8054
INSERT m2e4uladi9g0 5162
RECEIVED OBJECT MESSAGE m2e4uladi9g0 5162
INSERT arag8dj5j6k8 9491
RECEIVED OBJECT MESSAGE arag8dj5j6k8 9491
UPDATE vchq9193eelj 4236
INSERT r2lu5002hm8q 3371
RECEIVED OBJECT MESSAGE r2lu5002hm8q 3371
INSERT ah5ivj9eb08g 6552
RECEIVED OBJECT MESSAGE ah5ivj9eb08g 6552
INSERT 9wbnmdm841qe 5687
RECEIVED OBJECT MESSAGE 9wbnmdm841qe 5687
INSERT m7dk38en2pa6 2771
RECEIVED OBJECT MESSAGE m7dk38en2pa6 2771
INSERT 2ccmfrlth7qi 7890
RECEIVED OBJECT MESSAGE 2ccmfrlth7qi 7890
INSERT 1j4u6kowyig5h 7865
RECEIVED OBJECT MESSAGE 1j4u6kowyig5h 7865
UPDATE 71ter5vkj56o 6106
INSERT 9o7qpmcbl4vh 1349
RECEIVED OBJECT MESSAGE 9o7qpmcbl4vh 1349
INSERT lmr4oqlu0o0o 5685
RECEIVED OBJECT MESSAGE lmr4oqlu0o0o 5685
INSERT y2du188lqyjy 1659
RECEIVED OBJECT MESSAGE y2du188lqyjy 1659
INSERT ud58jd9xkmir 4338
RECEIVED OBJECT MESSAGE ud58jd9xkmir 4338
INSERT 33sskk07r3j 2585
RECEIVED OBJECT MESSAGE 33sskk07r3j 2585
INSERT 1o3gde8i54tgt 1874
RECEIVED OBJECT MESSAGE 1o3gde8i54tgt 1874
INSERT i2ixrboywlv1 4780
RECEIVED OBJECT MESSAGE i2ixrboywlv1 4780
INSERT zwtyym43rr61 9273
RECEIVED OBJECT MESSAGE zwtyym43rr61 9273
INSERT 1im8h986ltsjb 4391
RECEIVED OBJECT MESSAGE 1im8h986ltsjb 4391
INSERT 12bcoiykhyxbz 2045
RECEIVED OBJECT MESSAGE 12bcoiykhyxbz 2045
INSERT 344m66wfi4pj 2932
RECEIVED OBJECT MESSAGE 344m66wfi4pj 2932
INSERT avu4p8rk1u49 1110
RECEIVED OBJECT MESSAGE avu4p8rk1u49 1110
INSERT 1qjb6odryerif 1602
RECEIVED OBJECT MESSAGE 1qjb6odryerif 1602
UPDATE sd8x343td04w 8207
UPDATE 1nkz2pyuxq6uf 8336
INSERT 1wd44tnl8sb21 3082
RECEIVED OBJECT MESSAGE 1wd44tnl8sb21 3082
INSERT 2osxfuuxdxbm 6578
RECEIVED OBJECT MESSAGE 2osxfuuxdxbm 6578
UPDATE 1siosbc26v8pk 3497
INSERT 136pfbsg1r4pm 6778
RECEIVED OBJECT MESSAGE 136pfbsg1r4pm 6778
INSERT 1hbb0a41y2s2v 6981
RECEIVED OBJECT MESSAGE 1hbb0a41y2s2v 6981
INSERT fqxegdpt6rl4 9823
RECEIVED OBJECT MESSAGE fqxegdpt6rl4 9823
REMOVE z66prw2lb7bp 1849
RECEIVED OBJECT MESSAGE z66prw2lb7bp 1849
INSERT 11rh97d29fhky 9445
RECEIVED OBJECT MESSAGE 11rh97d29fhky 9445
UPDATE ebh10c5v33z1 8965
UPDATE 1vd660sbipcp1 8809
UPDATE 15xnralb7gz9s 9511
INSERT 1kd8n3a1hs1e1 9622
RECEIVED OBJECT MESSAGE 1kd8n3a1hs1e1 9622
INSERT 1lrqknnl2wa9b 4794
RECEIVED OBJECT MESSAGE 1lrqknnl2wa9b 4794
INSERT 1sihm871ppxgs 5251
RECEIVED OBJECT MESSAGE 1sihm871ppxgs 5251
UPDATE 1hl9r1c3jtsww 7388
INSERT 1ktajkpo6zkrt 5676
RECEIVED OBJECT MESSAGE 1ktajkpo6zkrt 5676
UPDATE 2dja2aq45ctz 3865
INSERT 161mpey6d6vr5 4319
RECEIVED OBJECT MESSAGE 161mpey6d6vr5 4319
UPDATE 1cb45pn2a4avu 4032
UPDATE s0lllla2u71m 976
INSERT 5upsxkqis7yg 9610
RECEIVED OBJECT MESSAGE 5upsxkqis7yg 9610
UPDATE 1nz3rzwkpow1r 7827
INSERT 13vklojl41kiz 2462
RECEIVED OBJECT MESSAGE 13vklojl41kiz 2462
INSERT zdtjhvacufbe 4345
RECEIVED OBJECT MESSAGE zdtjhvacufbe 4345
UPDATE s7wc62ybsumu 1280
INSERT 4pbi0tkgevwx 8057
RECEIVED OBJECT MESSAGE 4pbi0tkgevwx 8057
INSERT 6ip3sgwf3g3v 5447
RECEIVED OBJECT MESSAGE 6ip3sgwf3g3v 5447
INSERT 2rsxw9lvikhb 5606
RECEIVED OBJECT MESSAGE 2rsxw9lvikhb 5606
INSERT ubllgdw263e 5556
RECEIVED OBJECT MESSAGE ubllgdw263e 5556
INSERT 1recoqmjit876 9174
RECEIVED OBJECT MESSAGE 1recoqmjit876 9174
INSERT sor1hnjar6c2 5791
RECEIVED OBJECT MESSAGE sor1hnjar6c2 5791
INSERT 1d7r2ebnidhwx 2335
RECEIVED OBJECT MESSAGE 1d7r2ebnidhwx 2335
INSERT 1rtu3pc4ds3t0 7070
RECEIVED OBJECT MESSAGE 1rtu3pc4ds3t0 7070
UPDATE 1s79t8kafadq1 8465
UPDATE ax93q52uqnsk 1767
REMOVE e6n7hkwvo8yp 4487
RECEIVED OBJECT MESSAGE e6n7hkwvo8yp 4487
INSERT 1j6hs0edfxrkf 8433
RECEIVED OBJECT MESSAGE 1j6hs0edfxrkf 8433
INSERT 1lcd1uj5ikznc 7508
RECEIVED OBJECT MESSAGE 1lcd1uj5ikznc 7508
UPDATE sedm4wcjn1b 8343
UPDATE 1afyqhqvum90o 9944
INSERT 1v1r9p1dqm52t 210
RECEIVED OBJECT MESSAGE 1v1r9p1dqm52t 210
INSERT sg0hnmqe4dem 1375
RECEIVED OBJECT MESSAGE sg0hnmqe4dem 1375
UPDATE 75t1sh43ixpo 3927
UPDATE vg47h8u8d22f 6993
UPDATE fck5afipv4pa 5141
UPDATE 1cyykiwoedg49 8312
INSERT f10y81rg9yml 6747
RECEIVED OBJECT MESSAGE f10y81rg9yml 6747
INSERT 7l3f1g1mee1m 1420
RECEIVED OBJECT MESSAGE 7l3f1g1mee1m 1420
INSERT m28pdjg9x95g 8483
RECEIVED OBJECT MESSAGE m28pdjg9x95g 8483
INSERT 1j8xcvo5xnpjb 7360
RECEIVED OBJECT MESSAGE 1j8xcvo5xnpjb 7360
UPDATE 1sew10cgbiejp 3257
UPDATE 16hhdy988j64o 6329
UPDATE qzsxk5twh1de 5195
UPDATE 1agu0r1l7510z 431
INSERT 637vkjsrwpi3 4456
RECEIVED OBJECT MESSAGE 637vkjsrwpi3 4456
INSERT v3ugf4y8ckrz 3271
RECEIVED OBJECT MESSAGE v3ugf4y8ckrz 3271
INSERT 1fle12g0d0zx5 8707
RECEIVED OBJECT MESSAGE 1fle12g0d0zx5 8707
INSERT 1xej9zfi0t8dm 2928
RECEIVED OBJECT MESSAGE 1xej9zfi0t8dm 2928
UPDATE pwiwzjaoubbk 8390
INSERT 1f70u0ia40x6k 401
RECEIVED OBJECT MESSAGE 1f70u0ia40x6k 401
UPDATE art5ao3f00em 9900
INSERT vn759fh7ubd0 1720
RECEIVED OBJECT MESSAGE vn759fh7ubd0 1720
INSERT 1w1bllg3eosbz 7590
RECEIVED OBJECT MESSAGE 1w1bllg3eosbz 7590
UPDATE 9pxmv4vpmddc 9141
INSERT w6nh1tlqir3t 8431
RECEIVED OBJECT MESSAGE w6nh1tlqir3t 8431
INSERT 111j0mkmjrhlr 7553
RECEIVED OBJECT MESSAGE 111j0mkmjrhlr 7553
INSERT hyg2h3m7qgd8 7779
RECEIVED OBJECT MESSAGE hyg2h3m7qgd8 7779
INSERT 14nkhq5vf2fs8 4448
RECEIVED OBJECT MESSAGE 14nkhq5vf2fs8 4448
INSERT 15xckpgp1svzs 4840
RECEIVED OBJECT MESSAGE 15xckpgp1svzs 4840
INSERT 4vtaoozysimn 7844
RECEIVED OBJECT MESSAGE 4vtaoozysimn 7844
INSERT duxumkaj9u9d 837
RECEIVED OBJECT MESSAGE duxumkaj9u9d 837
INSERT njkgl8ck5yl2 5271
RECEIVED OBJECT MESSAGE njkgl8ck5yl2 5271
INSERT 1x9ykjycto7pz 29
RECEIVED OBJECT MESSAGE 1x9ykjycto7pz 29
UPDATE 7tu7toe52nw9 8115
INSERT x1y805u22iy3 6559
RECEIVED OBJECT MESSAGE x1y805u22iy3 6559
INSERT m9pbcrb569xa 367
RECEIVED OBJECT MESSAGE m9pbcrb569xa 367
UPDATE j1oi3zdc1a9h 5242
UPDATE fiqdxeb9qmqa 1877
INSERT 302l3uigwltl 6179
RECEIVED OBJECT MESSAGE 302l3uigwltl 6179
INSERT xx85e4f0zbhy 3213
RECEIVED OBJECT MESSAGE xx85e4f0zbhy 3213
INSERT veji44ccim7q 188
RECEIVED OBJECT MESSAGE veji44ccim7q 188
INSERT sx7u7fe5gq30 6652
RECEIVED OBJECT MESSAGE sx7u7fe5gq30 6652
INSERT 1w8ryh4viycl8 4882
RECEIVED OBJECT MESSAGE 1w8ryh4viycl8 4882
INSERT 100ahar3u9h9x 2920
RECEIVED OBJECT MESSAGE 100ahar3u9h9x 2920
INSERT vwgz1hmx2ty4 72
RECEIVED OBJECT MESSAGE vwgz1hmx2ty4 72
INSERT 1erhw9czpwzpo 4113
RECEIVED OBJECT MESSAGE 1erhw9czpwzpo 4113
INSERT 95vj41irgy5u 3379
RECEIVED OBJECT MESSAGE 95vj41irgy5u 3379
INSERT 1gh5lvz2o9xnw 4171
RECEIVED OBJECT MESSAGE 1gh5lvz2o9xnw 4171
INSERT 18isrf6smcuh1 2392
RECEIVED OBJECT MESSAGE 18isrf6smcuh1 2392
INSERT 1tiek05d1byq2 511
RECEIVED OBJECT MESSAGE 1tiek05d1byq2 511
INSERT 1am7ssut5lhw6 1647
RECEIVED OBJECT MESSAGE 1am7ssut5lhw6 1647
INSERT 1mepqwdhs4a14 7800
RECEIVED OBJECT MESSAGE 1mepqwdhs4a14 7800
UPDATE 1btsuhaqfxheg 7232
INSERT 1axl8f9uwwiza 9581
RECEIVED OBJECT MESSAGE 1axl8f9uwwiza 9581
INSERT 1r8ctl0p5sojt 3607
RECEIVED OBJECT MESSAGE 1r8ctl0p5sojt 3607
UPDATE r09sraod9bdu 9494
INSERT 1oxjinecd0x1t 8898
RECEIVED OBJECT MESSAGE 1oxjinecd0x1t 8898
INSERT ubbramifgk2l 7782
RECEIVED OBJECT MESSAGE ubbramifgk2l 7782
UPDATE 1s0h223s7gmcp 5523
UPDATE 1fjirpbx38a21 4219
INSERT 7vdwh61fljb7 6492
RECEIVED OBJECT MESSAGE 7vdwh61fljb7 6492
UPDATE 4uuxh5dxormc 244
UPDATE 1wtvmom1lmwm8 9559
INSERT wu47ep5bxl2o 4597
RECEIVED OBJECT MESSAGE wu47ep5bxl2o 4597
INSERT 1icnimpttk4px 4539
RECEIVED OBJECT MESSAGE 1icnimpttk4px 4539
UPDATE 112vbkll1rj32 1642
UPDATE qub5j6dhxlqm 4851
UPDATE 90pt6t3vrrwv 5812
INSERT 1j39u3t15rvm4 8527
RECEIVED OBJECT MESSAGE 1j39u3t15rvm4 8527
UPDATE pvrxzd0n4iu7 1087
INSERT 1vzia89yavuuf 1959
RECEIVED OBJECT MESSAGE 1vzia89yavuuf 1959
INSERT 1nq2d0t41i47k 8819
RECEIVED OBJECT MESSAGE 1nq2d0t41i47k 8819
UPDATE xs8ick4ea6s2 4154
INSERT 1p0zwzuk5ah6b 5207
RECEIVED OBJECT MESSAGE 1p0zwzuk5ah6b 5207
INSERT 1gfatuxk2o62j 4241
RECEIVED OBJECT MESSAGE 1gfatuxk2o62j 4241
INSERT evgpnsmtvk5j 259
INSERT 1xliyynq7e0li 8309
RECEIVED OBJECT MESSAGE evgpnsmtvk5j 259
UPDATE 5s65mfw0uxo6 4748
RECEIVED OBJECT MESSAGE 1xliyynq7e0li 8309
UPDATE 151ot0gb16gc 7844
INSERT 9hrb8vo6bxdd 4201
RECEIVED OBJECT MESSAGE 9hrb8vo6bxdd 4201
INSERT laqk54r7rfwb 7216
RECEIVED OBJECT MESSAGE laqk54r7rfwb 7216
UPDATE 1grmm4am2frd5 7082
INSERT q2c0b960x97e 5383
RECEIVED OBJECT MESSAGE q2c0b960x97e 5383
UPDATE 1itkw8bmozyd1 8031
INSERT 1f2m3mtwe5cv8 518
RECEIVED OBJECT MESSAGE 1f2m3mtwe5cv8 518
UPDATE g5kf2dr94i2q 9129
UPDATE 14tafi90oyyc5 9494

We have also showed how a Spring Hibernate application can be migrated from JBoss AS7 to WebLogic 12c (or vice versa). The things to keep in mind when migrating Spring from one application server to another, is the classloading and how the used resources are to be configured on the application server.

References

[1] The Red Hat product reference library.
[2] JBoss Web Framework Kit 2: Spring Installation Guide for use with JBoss Web Framework Kit Edition 2.0.0.
[3] HornetQ User Manual.
[3] Spring Framework Reference Documentation.
[4] JMS (Java Message Service).


Spring and JBoss AS7 JMS

In this post we are going to look at how we can set-up a client (build using Spring) that uses the JBoss JMS provider HornetQ remotely.

Remoting

Let us first look at how we can obtain objects remotely. In the Fun with JBoss post we have created an application that contains a stateless enterprise bean. This gives us a nice playground to call this stateless enterprise bean remotely. In order to do this we can use the following program

package test;

import model.entities.Person;
import model.logic.Company;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;
import java.util.Random;

public class Test {
    public static void main(String[] args) {
        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
        properties.put(Context.PROVIDER_URL, "remote://192.168.1.150:4447");
        properties.put(Context.SECURITY_PRINCIPAL, "employee");
        properties.put(Context.SECURITY_CREDENTIALS, "welcome1");
        properties.put("jboss.naming.client.ejb.context", true);

        try {
            Context context = new InitialContext(properties);
            Company company = (Company) context.lookup("LoadTest6/Model/Company!model.logic.Company");
            company.insertPerson(createPerson());
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }

    private static Person createPerson() {
        Person person = new Person();
        Random generator = new Random();
        person.setNaam(Long.toString(Math.abs(generator.nextLong()), 36));
        person.setSofinummer(1);
        return person;
    }
}

There are some points worth mentioning:

  • We need jboss-client-7.1.0.Final.jar in the client’s class path. The jar file can be obtained from the $JBOSS_HOME/bin/client directory of a JBoss AS7.1 distribution.
  • An application user must be created. This can be accomplished by using add-user.sh, located in the $JBOSS_HOME/bin directory. Detailed steps can be found in the Building a Coherence Cluster with Multiple Application Servers post. This user is then used to set the principal and credentials of the naming context that will be set-up.
  • Only JNDI objects prepended by java:jboss/exported/ can be obtained remotely. In the example, in which we obtain a stateless enterprise bean remotely, the object is bound as follows: app-name/module-name/bean-name!bean-interface in which,
    • app-name: the name of the .ear (without the .ear suffix) or the application name configured via application.xml deployment descriptor. If the application is not packaged in an .ear then there will be no app-name part to the JNDI string.
    • module-name: the name of the .jar or .war (without the .jar/.war suffix) in which the bean is deployed or the module-name configured in web.xml/ejb-jar.xml of the deployment. The module name is mandatory in the JNDI string.
    • bean-name: the name of the bean which by default is the simple name of the bean implementation class. It can be overridden either by using the name attribute of the bean defining annotation (@Stateless(name = "Company") in this case) or the ejb-jar.xml deployment descriptor.
    • bean-interface: the fully qualified class name of the interface being exposed by the bean.

When this is all to confusing for comfort, the logging will help, as something like the following output will be present when an application is deployed that contains enterprise beans:

16:50:52,840 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named Company in deployment unit subdeployment "Model.jar" of deployment "LoadTest6.ear" are as follows:

java:global/LoadTest6/Model/Company!model.logic.Company
java:app/Model/Company!model.logic.Company
java:module/Company!model.logic.Company
java:jboss/exported/LoadTest6/Model/Company!model.logic.Company
java:global/LoadTest6/Model/Company
java:app/Model/Company
java:module/Company

Here, we see which objects are bound under the java:jboss/exported/ name-space that can be obtained remotely. In our example, we can use context.lookup("LoadTest6/Model/Company!model.logic.Company") to obtain an instance of the enterprise bean. Note that we must not include java:jboss/exported/, as the remote-naming project expects it to always be relative to the java:jboss/exported/ name-space.

Set-up a JBoss JMS Provider

In the domain configuration file, we have the following

<domain xmlns="urn:jboss:domain:1.1">

    <extensions>
		...
        <extension module="org.jboss.as.messaging"/>
		...
    </extensions>

	<profiles>
		<profile name="cluster">
			...
		    <subsystem xmlns="urn:jboss:domain:messaging:1.1">
                <hornetq-server>
                    <persistence-enabled>true</persistence-enabled>
                    <journal-file-size>102400</journal-file-size>
                    <journal-min-files>2</journal-min-files>

                    <connectors>
                        <netty-connector name="netty" socket-binding="messaging"/>
						...
                    </connectors>

                    <acceptors>
                        <netty-acceptor name="netty" socket-binding="messaging"/>
						...
                    </acceptors>

                    <security-settings>
                        <security-setting match="#">
                            <permission type="send" roles="guest"/>
                            <permission type="consume" roles="guest"/>
                            <permission type="createNonDurableQueue" roles="guest"/>
                            <permission type="deleteNonDurableQueue" roles="guest"/>
                        </security-setting>
                    </security-settings>

					...

                    <jms-connection-factories>
						...
                        <connection-factory name="RemoteConnectionFactory">
                            <connectors>
                                <connector-ref connector-name="netty"/>
                            </connectors>
                            <entries>
                                <entry name="RemoteConnectionFactory"/>
                                <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>
                            </entries>
                        </connection-factory>
						...
                    </jms-connection-factories>

                    <jms-destinations>
                        <jms-queue name="testQueue">
                            <entry name="java:/queue/test"/>
                            <entry name="java:jboss/exported/jms/queue/test"/>
                        </jms-queue>
						...
                    </jms-destinations>
                </hornetq-server>
            </subsystem>
		</profile>
	</profiles>

	<interfaces>
        <interface name="management"/>
        <interface name="public"/>
        <interface name="unsecure"/>
    </interfaces>

    <socket-binding-groups>
        <socket-binding-group name="cluster-sockets" default-interface="public">
			...
            <socket-binding name="messaging" port="5445"/>
			...
        </socket-binding-group>
    </socket-binding-groups>

    <deployments>
        <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear">
            <content sha1="161f51dde7f085c822cc4c68b306d57f1bee902d"/>
        </deployment>
    </deployments>

    <server-groups>
        <server-group name="cluster-group" profile="cluster">
            <jvm name="default"/>
            <socket-binding-group ref="cluster-sockets"/>
            <deployments>
                <deployment name="LoadTest6.ear" runtime-name="LoadTest6.ear" enabled="false"/>
            </deployments>
        </server-group>
    </server-groups>

</domain>

The host configuration is set-up as follows:

<host name="jboss" xmlns="urn:jboss:domain:1.1">

    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
                <authentication>
                    <properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir"/>
                </authentication>
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <properties path="application-users.properties" relative-to="jboss.domain.config.dir" />
                </authentication>
            </security-realm>
        </security-realms>
        <management-interfaces>
            <native-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.native.port:9999}"/>
            </native-interface>
            <http-interface security-realm="ManagementRealm">
                <socket interface="management" port="${jboss.management.http.port:9990}"/>
            </http-interface>
        </management-interfaces>
    </management>

    <domain-controller>
       <local/>
    </domain-controller>

    <interfaces>
        <interface name="management">
            <nic name="eth0"/>
        </interface>
        <interface name="public">
            <nic name="eth0"/>
        </interface>
        <interface name="unsecure">
            <inet-address value="127.0.0.1"/>
        </interface>
    </interfaces>

    <jvms>
    	<jvm name="default">
            <heap size="512m" max-size="512m"/>
            <permgen size="256m" max-size="256m"/>
            <jvm-options>
                <option value="-server"/>
                <option value="-XX:NewRatio=2"/>
                <option value="-XX:+UseParallelGC"/>
                <option value="-XX:ParallelGCThreads=2"/>
                <option value="-XX:MaxGCPauseMillis=200"/>
                <option value="-XX:GCTimeRatio=19"/>
                <option value="-XX:+UseParallelOldGC"/>
            </jvm-options>
        </jvm>
    </jvms>

    <servers>
        <server name="cluster-server1" group="cluster-group" auto-start="false">
        </server>
        <server name="cluster-server2" group="cluster-group" auto-start="false">
            <socket-bindings port-offset="1"/>
        </server>
    </servers>
</host>

Some points are worth mentioning in the above configuration:

  • In the host configuration, we have set-up two servers: cluster-server1 and cluster-server2. Note that these servers are bound to the cluster-group server group.
  • The server group is defined in the domain configuration and coupled to the cluster profile, the default JVM (defined in the host configuration), and the cluster-sockets socket binding group.
  • The default interface that cluster-sockets socket binding group uses, is the public interface. The public interface is configured to use the network interface card in this case eth0 (see the host configuration).
  • The messaging socket binding is part of the cluster-sockets socket binding group.
  • The netty connector is configured to use the messaging socket-binding.
  • The RemoteConnectionFactory is configured to use the netty connector so when a client looks up this connection factory it will receive this netty connector which will tell the client where to connect. A remark is in order: Once we get the JMS connection factory reference from the server by looking it up in JNDI and use it to create a connection, the final destination of the connection has nothing to do with the java.naming.provider.url (Context.PROVIDER_URL) that was used in the JNDI lookup. When looking up a connection factory in JNDI, the client gets a connector which is a simple stub telling the client where its connections should go. In this case the connections are bound to the network interface card and the port defined in the messaging socket binding.

Using JBoss JMS Remotely

To interact remotely with the JBoss JMS provider (HornetQ) we can use the following program to test (before we put everything into Spring)

package model.test;

import javax.jms.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;

public class JNDITest {
    public static void main(String[] args) {
        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
        properties.put(Context.PROVIDER_URL, "remote://192.168.1.150:4447");
        properties.put(Context.SECURITY_PRINCIPAL, "employee");
        properties.put(Context.SECURITY_CREDENTIALS, "welcome1");

        ConnectionFactory connectionFactory = null;
        Destination destination = null;

        try {
            Context context = new InitialContext(properties);
            connectionFactory = (ConnectionFactory) context.lookup("jms/RemoteConnectionFactory");
            destination = (Destination) context.lookup("jms/queue/test");

            System.out.println(connectionFactory);
            System.out.println(destination);

            sendMessage(connectionFactory, destination);
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }

    private static void sendMessage(ConnectionFactory connectionFactory, Destination destination) {
        Connection connection = null;
        Session session = null;
        MessageProducer messageProducer = null;

        try {
            connection = connectionFactory.createConnection("employee", "welcome1");
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            messageProducer = session.createProducer(destination);

            TextMessage text = session.createTextMessage();
            text.setText("Send some useful message");
            messageProducer.send(text);
        } catch (JMSException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                try {
                    connection.close();
                } catch (JMSException f) {
                    f.printStackTrace();
                }
            }
        }

    }
}

One (or more) of the following exceptions can be encountered when running the program:

  1. Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]
  2. Caused by: HornetQException[errorCode=105 message=Unable to validate user: null]
  3. javax.jms.JMSSecurityException: User: employee doesn’t have permission=’SEND’ on address jms.queue.test

The first exception is usually due to a host mismatch. Note that we are using the netty connector for the RemoteConnectionFactory. The netty connector uses the following (NettyConnector.java) to obtain an address:

    remoteDestination = new InetSocketAddress(host, port);
    InetAddress inetAddress = ((InetSocketAddress) remoteDestination).getAddress();

So what address would that be? To check this we can use the following

import java.net.InetAddress;

public class WhatIsMyAddress {
    public static void main(String[] args) throws Exception {
        System.out.println(InetAddress.getLocalHost());
    }
}

When this program is run we get the following output:

[jboss@axis-into-ict temp]$ /home/jboss/jdk1.6.0_31/bin/java WhatIsMyAddress
axis-into-ict.nl/192.168.1.150

When we run the test to interact with the JBoss JMS provider remotely, we get the following

Aug 10, 2012 10:48:44 AM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.3.GA
Aug 10, 2012 10:48:44 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.3.GA
Aug 10, 2012 10:48:44 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.2.GA
HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=axis-into-ict-nl], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]
HornetQQueue[testQueue]

One important thing to note here, is that the host is set to axis-into-ict-nl instead of the expected axis-into-ict.nl, i.e., in the host the ‘.’ are replaced by ‘-’. In order to get the axis-into-ict-nl to be resolved to the right IP address we add this to the etc/hosts file on the client

192.168.1.150       axis-into-ict.nl axis-into-ict-nl

The second exception is because no user is provided in the creation of a connection, i.e., connection = connectionFactory.createConnection(); is used instead of connection = connectionFactory.createConnection("employee", "welcome1").

The third exception is because the provided user to create a connection does not have the right privileges. Note that in the JMS configuration the following is present

<security-settings>
    <security-setting match="#">
        <permission type="send" roles="guest"/>
        <permission type="consume" roles="guest"/>
        <permission type="createNonDurableQueue" roles="guest"/>
        <permission type="deleteNonDurableQueue" roles="guest"/>
    </security-setting>
</security-settings>

This means the user must have the guest role. To accomplish this edit the application-roles.properties file (located in the $JBOSS_HOME/domain/configuration directory) and add the guest role to the used user, for example,

employee=guest,EMPLOYEE
manager=MANAGER

Restart the server such that the changes are picked up.

Create the Spring Client

Now that we have everything in place we can set-up the Spring configuration, for example,

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="jnditemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">org.jboss.naming.remote.client.InitialContextFactory</prop>
                <prop key="java.naming.provider.url">remote://192.168.1.150:4447</prop>
                <prop key="java.naming.security.principal">employee</prop>
                <prop key="java.naming.security.credentials">welcome1</prop>
            </props>
        </property>
    </bean>
    <bean id="connectionfactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="jnditemplate"/>
        <property name="jndiName" value="jms/RemoteConnectionFactory"/>
    </bean>
    <bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="jnditemplate"/>
        <property name="jndiName" value="jms/queue/test"/>
    </bean>
    <bean id="credentialsconnectionfactory"
          class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory" ref="connectionfactory"/>
        <property name="username" value="employee"/>
        <property name="password" value="welcome1"/>
    </bean>
    <bean id="jmstemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="credentialsconnectionfactory"/>
        <property name="defaultDestination" ref="destination"/>
    </bean>
    <bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
        <property name="connectionFactory" ref="credentialsconnectionfactory"/>
        <property name="destination" ref="destination"/>
        <property name="messageListener" ref="receiver"/>
    </bean>
    <bean id="sender" class="model.logic.JMSSender">
        <property name="jmsTemplate" ref="jmstemplate"/>
    </bean>
    <bean id="receiver" class="model.logic.JMSReceiver"/>
</beans>

in which, the referred classes JMSSender and JMSReceiver look as follows

package model.logic;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.Random;

public class JMSSender {

    private Random generator = new Random();
    private JmsTemplate jmsTemplate;

    public JMSSender() {
    }

    public JmsTemplate getJmsTemplate() {
        return jmsTemplate;
    }

    public void setJmsTemplate(JmsTemplate jmsTemplate) {
        this.jmsTemplate = jmsTemplate;
    }

    public void sendMessage() {
        getJmsTemplate().send(new MessageCreator(){
            public Message createMessage(Session session) throws JMSException {
                TextMessage message = session.createTextMessage();
                message.setText(Long.toString(Math.abs(generator.nextLong()), 36));
                return message;
            }
        });
    }
}
package model.logic;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class JMSReceiver implements MessageListener {
    public JMSReceiver() {
    }

    public void onMessage(Message message) {
        TextMessage text = (TextMessage)message;
        try {
            message.acknowledge();
            System.out.println("received the following message: " + text.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}

To test the set-up we can use

package model.test;

import model.logic.JMSSender;
import model.utils.SpringUtilities;

public class JMSTest {

    public static void main(String[] args) {
        JMSSender jmsSender = SpringUtilities.getJMSSender();

        while (true) {
            jmsSender.sendMessage();
            System.out.println("done sending message");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

When the test is run the following output is observed

Aug 10, 2012 11:19:41 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@1ed2ae8: startup date [Fri Aug 10 11:19:41 CEST 2012]; root of context hierarchy
Aug 10, 2012 11:19:41 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-config.xml]
Aug 10, 2012 11:19:41 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@ef5502: defining beans [jnditemplate,connectionfactory,destination,credentialsconnectionfactory,jmstemplate,org.springframework.jms.listener.SimpleMessageListenerContainer#0,sender,receiver]; root of factory hierarchy
Aug 10, 2012 11:19:41 AM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.3.GA
Aug 10, 2012 11:19:41 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.3.GA
Aug 10, 2012 11:19:41 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.2.GA
Aug 10, 2012 11:19:42 AM org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver handleEnd
ERROR: Channel end notification received, closing channel Channel ID b3d15ef8 (outbound) of Remoting connection 009ffe3f to /192.168.1.150:4447
Aug 10, 2012 11:19:42 AM org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver handleEnd
ERROR: Channel end notification received, closing channel Channel ID c4cd8d30 (outbound) of Remoting connection 0032060c to /192.168.1.150:4447
Aug 10, 2012 11:19:42 AM org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup start
INFO: Starting beans in phase 2147483647
received the following message: Send some useful message
received the following message: q9em87lq59pb
done sending message
received the following message: 9l1e70x6e2yf
done sending message
received the following message: 1e0fqxcfs0os5
done sending message
received the following message: 8bcprios0t56
done sending message
received the following message: 1elnsn5m1sxf1
done sending message
received the following message: 5cnl5bt1ztp8
done sending message
received the following message: 1tnm5yf1dn6fx
done sending message
received the following message: j8efslaqykc6
done sending message
received the following message: t10r3842i2fi
done sending message
received the following message: j845q4yhyrgn
done sending message
received the following message: 4ky8mbz8h7kl
done sending message
received the following message: y5go5h1iwcl0
done sending message
received the following message: 5j6buhmnq9up
done sending message
received the following message: 1wdojt8n3kztv
done sending message
received the following message: 1k6p9352nwcgl
done sending message
received the following message: 1povempe0r3ju
done sending message

References

[1] EJB invocations from a remote client using JNDI.
[2] Remote EJB invocations via JNDI – EJB client API or remote-naming project.
[3] EJB invocations from a remote server instance.


Free WebLogic Server Course

We are bringing you a free course on WebLogic Server. In the course you will learn the following:

  • Introduction
    • WebLogic Server architecture (domain, admin server, managed server, node manager, cluster, machine)
    • WebLogic Server internal architecture (listen threads, socket muxer, execute queue, execute threads)
  • JVM Tuning
    • Code generation
    • Memory management
    • Garbage collection performance
    • JRockit Mission Control
  • Deployment
    • Packaging applications recommendations
    • Deployment descriptors
    • Deployment plans
    • Work Manager configuration
  • Diagnostic Framework (logging, instrumentation, harvesting, watching and notifying)
  • Class Loading
    • Bundled libraries
    • Shared libraries
    • Filtering class loader
  • Security
    • JAAS introduction
    • Embedded LDAP
    • WebLogic Server security providers
    • Secure communications (SSL and TLS)
  • Configure Resources
    • Configure data sources
    • Monitoring resources
    • Configure JMS environment
    • Migrating singleton services (leasing, migratable targets, service migration policy)
  • Clustering
    • Unicast or multicast?
    • Node manager and machine set-up
    • Denial of service configuration
    • Network channels
    • Vertical and horizontal scaling
    • Caching by using Coherence
    • Apache HTTP Server and WebLogic plug-in set-up
  • Scripting (WLST)

Note that this is a course you can do at your own pace. The exercises lead you step-by-step through the process of installing, configuring, deploying etcetera. The material consists of the following:

Have fun!


Free GlassFish Server Course

We are bringing you a free course on GlassFish Server. In the course you will learn the following:

  • Introduction
    • GlassFish Server architecture
    • GlassFish Server internal architecture (listen threads, threads pools, containers)
    • Command-line utility
    • Admin console
  • JVM Tuning
    • Code generation
    • Memory management
    • Garbage collection performance
    • JConsole and JVisualVM
  • Deployment
    • Packaging applications recommendations
    • Deployment descriptors
    • Server logging
    • Front-end configuration using the Apache HTTP Server and mod_jk
  • Class Loading
  • Security
    • JAAS introduction
    • Role-based security
    • Secure communications (SSL and TLS)
  • Configure Resources
    • Configure data sources
    • Monitoring resources
    • Configure JMS environment
  • Clustering
    • Unicast or multicast?
    • Denial of service configuration
    • Vertical and horizontal scaling
    • Caching
    • Load balancing
    • Load testing

Note that this is a course you can do at your own pace. The exercises lead you step-by-step through the process of installing, configuring, deploying etcetera. The material consists of the following:

Have fun!

JavaOne 2012

Presenting at JavaOne 2012: Harness the Power and Performance of GlassFish Tuning for High Availability. The presentation slides can be found here.


WebLogic Messaging Bridge and Store-and-Forward Service

In this post we first set-up a WebLogic environment that uses the WebLogic Messaging Bridge to forward messages. Next, we use the store-and-forward service to do the same. We will use Spring to test the set-ups. We end the post by looking at some performance considerations.

Messaging bridge

The WebLogic messaging bridge is a forwarding mechanism that provides interoperability between WebLogic JMS implementations, and between JMS and other messaging products. Use the Messaging Bridge to integrate messaging applications between:

  • Any two implementations of WebLogic JMS, including those from separate releases of WebLogic Server
  • WebLogic JMS implementations that reside in separate WebLogic domains
  • WebLogic JMS and a third-party JMS product

A messaging bridge instance forwards messages between a pair of bridge source and target destinations. These destinations are mapped to a pair of bridge source and target destinations. The messaging bridge reads messages from the source bridge destination and forwards those messages to the target bridge destination. For WebLogic JMS and third-party JMS products, a messaging bridge communicates with source and target destinations using the Java EE Connector Architecture (JCA) resource adapters provided with WebLogic Server. Two resource adapters are provided, i.e.,

  • eis.jms.WLSConnectionFactoryJNDIXA – Provides transaction semantics. Used when the required quality of service (QOS) is exactly-once (the message will be delivered from the sending destination to the receiving destination using XA transactions so that the receiver gets exactly one copy of each message). This envelopes a received message and sends it within a user transaction (XA/JTA). The following requirements apply to use of this resource adapter:
    • Any WebLogic Server implementation being bridged must be release 7.0 or later
    • The source and target JMS connection factories must be configured to use the XAConnectionFactory
  • eis.jms.WLSConnectionFactoryJNDINoTX – Provides no transaction semantics. Used when the required QOS is atmost-once (Makes sure that the receiving destination receives only a single copy of the message or does not receive it at all) or duplicate-okay (the bridge acknowledges receiving the message from the source destination only after writing it to the target destination, because this is done outside the scope of a transaction, failures after writing the message to the target and before acknowledging the source can result in duplicate messages being delivered but should never result in a message being lost, this type of delivery is better known as at-least-once delivery). If the requested QOS is atmost-once, the resource adapter uses AUTO_ACKNOWLEDGE mode. If the requested QOS is duplicate-okay, CLIENT_ACKNOWLEDGE is used.

An instance of the messaging bridge maps each source destination with a target destination. Each destination is configured using one of the adapters. Each bridge instance is targeted to a specific WebLogic Server instance. If the source is a distributed destination, the JMS consumer load balancing rules will associate the bridge with a single destination. In this case, it is best to connect a separate bridge instance to each member of the source destination. This leads to a proliferation of bridge instances that must be reconfigured if the cluster membership changes. The messaging bridge must be used when storing and forwarding messages between JMS destinations where one or both destinations are either hosted by foreign JMS providers or running on older versions of WebLogic Server (prior 9.0) that do not support the store-and-forward service.

Configuration

To set-up a messaging bridge, we need to first set-up the JMS resources involved in the bridge, i.e., the connection factories and destinations. In the example below we use two WebLogic environments. On one WebLogic environment we create the following:

  • Persistent store targeted to the admin server
  • JMS Server targeted to the admin server
  • JMS Module targeted to the admin server with the following resources:
    • Connection Factory default targeting enabled, with JNDI jms/BridgeConnectionFactory (and is XA enabled)
    • Destination (Queue) targeted through a sub deployment to the JMS Server, with JNDI jms/BridgeCompanyQueue

On the other environment we create the following:

  • A cluster consisting of two managed servers
  • Two JMS servers each targeted to a migratable target belonging to a managed server in the cluster (note that a migratable target is automatically created when a managed server is clustered
  • Two persistent stores each targeted to a managed server in the cluster
  • JMS module targeted to the cluster with the following resources:
    • Connection Factory default targeting enabled, with JNDI jms/ConnectionFactory (and is XA enabled)
    • Uniform distributed destination (queue) targeted through a subdeployment to the JMS Servers, with JNDI jms/CompanyQueue

Next, we configure two JMS bridge destinations. One source destination from which the messaging bridge instance reads messages and one target destination where the messaging bridge instance sends the messages it receives from the source destination. In the admin console

  • Open the tree services, messaging, bridges
  • Click JMS bridge destinations, click new and enter the following parameters:
    • Name: SourceDestination
    • Adapter JNDI Name: eis.jms.ConnectionFactoryJNDINoTx
    • Adapter Classpath: When connecting to a third-party JMS product, the bridge destination must supply the product’s CLASSPATH in the WebLogic Server CLASSPATH.
    • Connection URL: t3://192.168.1.50:7001
    • Connection Factory JNDI Name: jms/BridgeConnectionFactory
    • Destination JNDI Name: jms/BridgeCompanyQueue
  • Click OK

The target destination is configured as

  • Open the tree services, messaging, bridges
  • Click JMS bridge destinations, click new and enter the following parameters:
    • Name: TargetDestination
    • Adapter JNDI Name: eis.jms.ConnectionFactoryJNDINoTx
    • Adapter Classpath: When connecting to a third-party JMS product, the bridge destination must supply the product’s CLASSPATH in the WebLogic Server CLASSPATH.
    • Connection URL: t3://192.168.1.50:9001,192.168.1.50:9002
    • Connection Factory JNDI Name: jms/ConnectionFactory
    • Destination JNDI Name: jms/CompanyQueue
  • Click OK

The actual messaging bridge can be created as follows:

  • Open the tree services, messaging, bridges
  • Click new and enter the following parameters:
    • Name: WebLogicToWebLogicBridge
    • Selector: can be left empty
    • Quality Of Service: atmost-once
    • Started: enabled
  • Click next and select the source destination in our case this is SourceDestination
  • Click next and select the messaging provider in our case this is WebLogic Server 7.0 or higher
  • Click next and select the target destination in our case this is TargetDestination
  • Click next and select the messaging provider for the target in our case this is WebLogic Server 7.0 or higher
  • Click next and target the messaging bridge to the server that holds to the source destination, which is our case is the adminserver
  • Click next and click finish

Note that after the creation the messaging bridge can be fine tuned.

WLST

The following script shows an example how the messaging bridge can be set-up using WLST

print 'CONNECT TO ADMIN SERVER';
connect('weblogic', 'magic12c', 't3://192.168.1.50:7001');

print 'START EDIT MODE';
edit();
startEdit();

print 'CREATE SOURCE JMS BRIDGE DESTINATION';
cmo.createJMSBridgeDestination('SourceDestination');
sourcedestination = cmo.lookupJMSBridgeDestination('SourceDestination');
sourcedestination.setClasspath('');
sourcedestination.setConnectionURL('t3://192.168.1.50:7001');
sourcedestination.setAdapterJNDIName('eis.jms.WLSConnectionFactoryJNDINoTX');
sourcedestination.setConnectionFactoryJNDIName('jms/BridgeConnectionFactory');
sourcedestination.setDestinationJNDIName('jms/BridgeCompanyQueue');

print 'CREATE TARGET JMS BRIDGE DESTINATION';
cmo.createJMSBridgeDestination('TargetDestination');
targetdestination = cmo.lookupJMSBridgeDestination('TargetDestination');
targetdestination.setClasspath('');
targetdestination.setConnectionURL('t3://192.168.1.50:9001,192.168.1.50:9002');
targetdestination.setAdapterJNDIName('eis.jms.WLSConnectionFactoryJNDINoTX');
targetdestination.setConnectionFactoryJNDIName('jms/ConnectionFactory');
targetdestination.setDestinationJNDIName('jms/CompanyQueue');

print 'CREATE MESSAGING BRIDGE';
cmo.createMessagingBridge('Bridge');
bridge = cmo.lookupMessagingBridge('Bridge');
adminserver = cmo.lookupServer('AdminServer');
targets = bridge.getTargets();
targets.append(adminserver);
bridge.setTargets(targets);
bridge.setSourceDestination(sourcedestination);
bridge.setTargetDestination(targetdestination);
bridge.setStarted(true);
bridge.setSelector('');
bridge.setQualityOfService('Atmost-once');

print 'SAVE AND ACTIVATE CHANGES';
save();
activate(block='true');

Test

To test if the set-up works we will use a Spring client. Make sure the wlclient and wljmsclient jar files are on the classpath. To set-up a JMS producer using Spring we can use the following configuration:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="sourceJndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                <prop key="java.naming.provider.url">t3://192.168.1.50:7001</prop>
            </props>
        </property>
    </bean>
    <bean id="sourceConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="sourceJndiTemplate"/>
        <property name="jndiName" value="jms/BridgeConnectionFactory"/>
    </bean>
    <bean id="sourceDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="sourceJndiTemplate"/>
        <property name="jndiName" value="jms/BridgeCompanyQueue"/>
    </bean>
    <bean id="sourceJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="sourceConnectionFactory"/>
        <property name="defaultDestination" ref="sourceDestination"/>
    </bean>
    <bean id="sender" class="model.logic.JMSSender">
        <property name="jmsTemplate" ref="sourceJmsTemplate"/>
    </bean>
</beans>

To send a message by using the configured JMSTemplate we can use the following class:

package model.logic;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.Random;

public class JMSSender {

    private Random generator = new Random();
    private JmsTemplate jmsTemplate;

    public JMSSender() {
    }

    public JmsTemplate getJmsTemplate() {
        return jmsTemplate;
    }

    public void setJmsTemplate(JmsTemplate jmsTemplate) {
        this.jmsTemplate = jmsTemplate;
    }

    public void sendMessage() {
        getJmsTemplate().send(new MessageCreator(){
            public Message createMessage(Session session) throws JMSException {
                TextMessage message = session.createTextMessage();
                message.setText(Long.toString(Math.abs(generator.nextLong()), 36));
                return message;
            }
        });
    }
}

To run the class we can use:

package model.test;

import model.logic.JMSSender;
import model.utils.SpringUtilities;

public class JMSTest {

    public static void main(String[] args) {
        JMSSender jmsSender = SpringUtilities.getJMSSender();
        jmsSender.sendMessage();
    }
}

To consume a message we create another client using Spring’s SimpleMessageListenerContainer. We have the following configuration:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="targetJndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                <prop key="java.naming.provider.url">t3://192.168.1.50:9001,192.168.1.50:9002</prop>
            </props>
        </property>
    </bean>
    <bean id="targetConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="targetJndiTemplate"/>
        <property name="jndiName" value="jms/ConnectionFactory"/>
    </bean>
    <bean id="targetDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="targetJndiTemplate"/>
        <property name="jndiName" value="jms/CompanyQueue"/>
    </bean>
    <bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
        <property name="connectionFactory" ref="targetConnectionFactory"/>
        <property name="destination" ref="targetDestination"/>
        <property name="messageListener" ref="receiver"/>
    </bean>
    <bean id="receiver" class="model.logic.JMSReceiver"/>
</beans>

To receive a message asynchronously we use:

package model.logic;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class JMSReceiver implements MessageListener {
    public JMSReceiver() {
    }

    public void onMessage(Message message) {
        TextMessage text = (TextMessage)message;
        try {
            message.acknowledge();
            System.out.println("received the following message: " + text.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}

Store-and-forward service

The Store-and-Forward (SAF) service enables WebLogic Server to deliver messages reliably between applications that are distributed across WebLogic Server instances. JMS modules utilize the SAF service to enable local JMS message producers to reliably send messages to remote queues or topics without worrying about the availability of the remote environment. If the destination is not available at the moment the messages are sent, either because of network problems or system failures, then the messages are saved on a local server instance, and are forwarded to the remote destination once it becomes available. The SAF Service should be used when forwarding JMS messages between WebLogic Server 9.x or later domains. The SAF service can deliver messages:

  • Between two stand-alone server instances
  • Between server instances in a cluster
  • Across two clusters in a domain
  • Across separate domains

When not to use the SAF service:

  • Forwarding messages to prior releases of WebLogic Server
  • Interoperating with third-party JMS products. For these tasks, we should use the WebLogic Messaging Bridge
  • When using temporary destinations with the JMSReplyTo field to return a response to a request

Additionally, when using JMS SAF, an application can only receive messages directly from a remote server, and only when the remote server is available. Both the store-and-forward service and the messaging bridge provide JMS applications a message forwarding agent-based technology. A thing to note is that the store-and-forward service uses an internal duplicate elimination algorithm that does not require XA transactions and thus will perform better for the exactly-once quality of service. The store-and-forward service uses agents to store and forward the messages between the sending and receiving sides. We must configure store-and-forward agents to support sending, receiving, or both depending on the set-up being used:

  • JMS sending – only a sending agent
  • JMS receiving – no agent needed
  • Web Services Reliable Messaging sending – sending and receiving agent
  • Web Services Reliable Messaging receiving – receiving agent

SAF agents are similar to JMS servers in that they have persistent stores, paging directories, and destinations, as well as quotas, thresholds, and other similar configuration parameters. The primary difference is that SAF agents only support imported destinations, a local representation of remote destinations to which messages are stored locally and then forwarded. SAF agents also support targeting to migratable targets to enable SAF agent service migration. Reliability in SAF is time-based in that the time-to-live attribute determines how long the agent will attempt to forward the message before expiring it. When setting a time-to-live on one of the SAF objects, a value of -1 means that the value is not set, 0 means that the message never expires, and a positive value defines the number of milliseconds after the message was created that the message will expire. If a message expires, SAF error handling provides four expiration policies from which to choose: Discard, Log, Redirect, and Always-forward. Always-forward ignores the time-to-live setting on the imported destinations and any message expiration time and forwards the message even after it has expired. Typically, this option would be used if the application had expiration policies set up on the remote destinations and we want the expired messages to be handled using these policies.

Configuration

To set-up a store-and-forward service we can use the following steps. First, we create a SAF agent:

  • In the admin console click services, messaging, store and forward agent
  • Click new and enter the following parameters:
    • name: SAFAgent
    • persistent store: AdminFileStore (or create a new one)
    • agent type: sending-only
  • Click next and enter the following parameters:
    • target: AdminServer (the same as the target of the persistent store)

Next, create a JMS module or use an existing one and create a subdeployment for the SAF agent

  • Click subdeployments, click new and enter the following parameters:
    • subdeployment name: SAFSubDeployment
  • Click next and select as target the created SAF agent
  • Click finish

Subsequently, we create a remote SAF context

  • Click the configuration tab of the JMS module
  • Click new, select remote SAF context, click next and enter the following parameters:
    • name: RemoteSAFContext
    • URL: t3://192.168.1.50:9001,192.168.1.50:9002
    • username: weblogic (admin username)
    • password: magic12c (admin password)
    • confirm password: magic12c
  • Click OK

Next, create SAF imported destinations

  • Click the configuration tab of the JMS module
  • Click new, select SAF imported destinations, click next and enter the following parameters:
    • name: SAFImportedDestinations
    • JNDI prefix: jms/ (this can be used for the local destination counterparts of remote destinations to which the SAF agent is connecting)
    • remote SAF context: RemoteSAFContext
  • Click next and click advanced targeting
  • Select SAFSubDeployment and click finish

In the last step we will add remote queues to the created SAF imported destination

  • Click the create SAF imported destination
  • Click the queues, configuration tab, click new and enter the following parameters:
    • name: SAFQueue
    • remote JNDI name: jms/CompanyQueue
  • Click OK
  • Click SAFQueue and set the local JNDI name to SAFCompanyQueue (note that we can now look up the local queue by using jms/SAFCompanyQueue, in which jms/ is the JNDI prefix we set earlier)
  • Save the configuration

To check if the configuration is correct check the server logging, something like the following should be present

####<Apr 16, 2012 10:43:49 AM CEST> <Info> <JMS> <axis-into-ict.nl> <AdminServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1334565829666> <BEA-040506> <The JMS store-and-forward (SAF) forwarder has successfully connected to the remote destination "t3://192.168.1.50:9001,192.168.1.50:9002/jms/CompanyQueue".>

When the servers to which the SAF agent is connecting are not present the following exception is observed

####<Apr 16, 2012 10:43:07 AM CEST> <Info> <JMS> <axis-into-ict.nl> <AdminServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1334565787556> <BEA-040507> <The JMS store-and-forward (SAF) forwarder failed to connect to the remote destination "t3://192.168.1.50:9001,192.168.1.50:9002/jms/CompanyQueue", because of javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://192.168.1.50:9001,192.168.1.50:9002: Destination unreachable; nested exception is:
	java.net.ConnectException: Connection refused; No available router to destination]
	at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:40)
	at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:767)
	at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:366)
	at weblogic.jndi.Environment.getContext(Environment.java:315)
	at weblogic.jndi.Environment.getContext(Environment.java:285)
	at weblogic.jndi.Environment.createInitialContext(Environment.java:208)
	at weblogic.jndi.Environment.getInitialContext(Environment.java:192)
	at weblogic.jndi.Environment.getInitialContext(Environment.java:170)
	at weblogic.jndi.Environment.getContext(Environment.java:215)
	at weblogic.jms.forwarder.Forwarder.getInitialContext(Forwarder.java:428)
	at weblogic.jms.forwarder.Forwarder.connectTarget(Forwarder.java:447)
	at weblogic.jms.forwarder.Forwarder.reconnect(Forwarder.java:270)
	at weblogic.jms.forwarder.Forwarder.timerExpired(Forwarder.java:335)
	at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:293)
	at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:545)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused by: java.net.ConnectException: t3://192.168.1.50:9001,192.168.1.50:9002: Destination unreachable; nested exception is:
	java.net.ConnectException: Connection refused; No available router to destination
	at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:216)
	at weblogic.rjvm.RJVMFinder.findOrCreate(RJVMFinder.java:170)
	at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:165)
	at weblogic.jndi.WLInitialContextFactoryDelegate$1.run(WLInitialContextFactoryDelegate.java:345)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
	at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:340)
	... 14 more
Caused by: java.rmi.ConnectException: Destination unreachable; nested exception is:
	java.net.ConnectException: Connection refused; No available router to destination
	at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:470)
	at weblogic.rjvm.ConnectionManager.bootstrap(ConnectionManager.java:321)
	at weblogic.rjvm.RJVMManager.findOrCreateRemoteInternal(RJVMManager.java:260)
	at weblogic.rjvm.RJVMManager.findOrCreate(RJVMManager.java:197)
	at weblogic.rjvm.RJVMFinder.findOrCreateRemoteServer(RJVMFinder.java:238)
	at weblogic.rjvm.RJVMFinder.findOrCreateRemoteCluster(RJVMFinder.java:316)
	at weblogic.rjvm.RJVMFinder.findOrCreateInternal(RJVMFinder.java:205)
	... 20 more
.>

As can be seen from the previous log line (which in time is happening later), when the servers become available the SAF agent connects to the servers.

WLST

The following script shows an example how the save-and-forward service can be set-up using WLST

print 'CONNECT TO ADMIN SERVER';
connect('weblogic', 'magic12c', 't3://192.168.1.50:7001');

print 'START EDIT MODE';
edit();
startEdit();

print 'CREATE FILE STORE';
cmo.createFileStore('SAFFileStore');
saffilestore = cmo.lookupFileStore('SAFFileStore');
saffilestore.setDirectory('/home/oracle/weblogic12.1.1/configuration/applications/base_domain');
targets = saffilestore.getTargets();
adminserver = cmo.lookupServer('AdminServer');
targets.append(adminserver);
saffilestore.setTargets(targets);

print 'SAVE, ACTIVATE CHANGES AND START EDIT';
save();
activate(block='true');
startEdit();

print 'CREATE SAF Agent';
cmo.createSAFAgent('SAFAgent');
safagent = cmo.lookupSAFAgent('SAFAgent');
safagent.setStore(saffilestore);
safagent.setTargets(targets);
safagent.setServiceType('Sending-only');

print 'SAVE, ACTIVATE CHANGES AND START EDIT';
save();
activate(block='true');
startEdit();

print 'CREATE JMS MODULE';
cmo.createJMSSystemResource('jms-saf-module');
safmodule = cmo.lookupJMSSystemResource('jms-saf-module');
safmodule.setTargets(targets);
safmodule.createSubDeployment('SAFSubDeployment');
cd('/JMSSystemResources/jms-saf-module/SubDeployments/SAFSubDeployment');
set('Targets',jarray.array([ObjectName('com.bea:Name=SAFAgent,Type=SAFAgent')], ObjectName));
cd('/');

print 'SAVE, ACTIVATE CHANGES AND START EDIT';
save();
activate(block='true');
startEdit();

print 'OBTAIN JMS RESOURCE';
resource = safmodule.getJMSResource();

print 'CREATE CONNECTION FACTORY';
resource.createConnectionFactory('SAFConnectionFactory');
connectionfactory = resource.lookupConnectionFactory('SAFConnectionFactory');
connectionfactory.setJNDIName('jms/SAFConnectionFactory');
connectionfactory.setDefaultTargetingEnabled(true);
connectionfactory.getTransactionParams().setTransactionTimeout(3600);
connectionfactory.getTransactionParams().setXAConnectionFactoryEnabled(true);
connectionfactory.getSecurityParams().setAttachJMSXUserId(false);
connectionfactory.getClientParams().setClientIdPolicy('Restricted');
connectionfactory.getClientParams().setSubscriptionSharingPolicy('Exclusive');
connectionfactory.getClientParams().setMessagesMaximum(10);

print 'SAVE, ACTIVATE CHANGES AND START EDIT';
save();
activate(block='true');
startEdit();

print 'CREATE SAF REMOTE CONTEXT';
resource.createSAFRemoteContext('RemoteSAFContext');
safcontext = resource.lookupSAFRemoteContext('RemoteSAFContext');
safcontext.getSAFLoginContext().setLoginURL('t3://192.168.1.50:9001,192.168.1.50:9002');
safcontext.getSAFLoginContext().setUsername('weblogic');
safcontext.getSAFLoginContext().setPassword('magic12c');

print 'SAVE, ACTIVATE CHANGES AND START EDIT';
save();
activate(block='true');
startEdit();

print 'CREATE SAF IMPORTED DESTINATIONS';
resource.createSAFImportedDestinations('SAFImportedDestinations');
importeddestinations = resource.lookupSAFImportedDestinations('SAFImportedDestinations');
importeddestinations.setJNDIPrefix('jms/');
importeddestinations.setSAFRemoteContext(safcontext);
importeddestinations.setSAFErrorHandling(None);
importeddestinations.setTimeToLiveDefault(0);
importeddestinations.setUseSAFTimeToLiveDefault(false);
importeddestinations.setSubDeploymentName('SAFSubDeployment');

print 'SAVE, ACTIVATE CHANGES AND START EDIT';
save();
activate(block='true');
startEdit();

print 'ADD QUEUE TO THE SAF IMPORTED DESTINATIONS';
importeddestinations.createSAFQueue('SAFQueue');
safqueue = importeddestinations.lookupSAFQueue('SAFQueue');
safqueue.setRemoteJNDIName('jms/CompanyQueue');
safqueue.setLocalJNDIName('SAFCompanyQueue');

print 'SAVE AND ACTIVATE CHANGES';
save();
activate(block='true');

Test

To test the set-up we will again use Spring. To set-up the sending end, we will use the following configuration

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="sourceJndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                <prop key="java.naming.provider.url">t3://192.168.1.50:7001</prop>
            </props>
        </property>
    </bean>
    <bean id="sourceConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="sourceJndiTemplate"/>
        <property name="jndiName" value="jms/SAFConnectionFactory"/>
    </bean>
    <bean id="sourceDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="sourceJndiTemplate"/>
        <property name="jndiName" value="jms/SAFCompanyQueue"/>
    </bean>
    <bean id="sourceJmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="sourceConnectionFactory"/>
        <property name="defaultDestination" ref="sourceDestination"/>
    </bean>
    <bean id="timerListener" class="org.springframework.scheduling.commonj.ScheduledTimerListener">
        <property name="delay" value="10000"/>
        <property name="period" value="30000"/>
        <property name="runnable" ref="sender"/>
    </bean>
    <bean id="timerFactory" class="org.springframework.scheduling.commonj.TimerManagerFactoryBean">
        <property name="timerManagerName" value="java:comp/env/tm/default"/>
        <property name="resourceRef" value="true"/>
        <property name="scheduledTimerListeners">
            <list>
                <ref bean="timerListener"/>
            </list>
        </property>
    </bean>
    <bean id="sender" class="model.logic.JMSSender">
        <property name="jmsTemplate" ref="sourceJmsTemplate"/>
    </bean>
</beans>

in which the sender bean looks as follows

package model.logic;

import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.Random;

public class JMSSender implements Runnable {

    private Random generator = new Random();
    private JmsTemplate jmsTemplate;

    public JMSSender() {
    }

    public JmsTemplate getJmsTemplate() {
        return jmsTemplate;
    }

    public void setJmsTemplate(JmsTemplate jmsTemplate) {
        this.jmsTemplate = jmsTemplate;
    }

    public void sendMessage() {
        getJmsTemplate().send(new MessageCreator(){
            public Message createMessage(Session session) throws JMSException {
                TextMessage message = session.createTextMessage();
                message.setText(Long.toString(Math.abs(generator.nextLong()), 36));
                return message;
            }
        });
    }

    public void run() {
        sendMessage();
    }
}

To set-up the receiving end, we will use the following configuration

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="targetJndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory</prop>
                <prop key="java.naming.provider.url">t3://192.168.1.50:9001,192.168.1.50:9002</prop>
            </props>
        </property>
    </bean>
    <bean id="targetConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="targetJndiTemplate"/>
        <property name="jndiName" value="jms/ConnectionFactory"/>
    </bean>
    <bean id="targetDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="targetJndiTemplate"/>
        <property name="jndiName" value="jms/CompanyQueue"/>
    </bean>
    <bean id="taskExecutor" class="org.springframework.scheduling.commonj.WorkManagerTaskExecutor">
        <property name="workManagerName" value="java:comp/env/default"/>
        <property name="resourceRef" value="true"/>
    </bean>
    <bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
        <property name="connectionFactory" ref="targetConnectionFactory"/>
        <property name="destination" ref="targetDestination"/>
        <property name="messageListener" ref="receiver"/>
        <property name="taskExecutor" ref="taskExecutor"/>
    </bean>
    <bean id="receiver" class="model.logic.JMSReceiver"/>
</beans>

in which the receiver bean looks as follows

package model.logic;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class JMSReceiver implements MessageListener {
    public JMSReceiver() {
    }

    public void onMessage(Message message) {
        TextMessage text = (TextMessage)message;
        try {
            message.acknowledge();
            System.out.println("received the following message: " + text.getText());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}

We deploy the sender to the AdminServer and the receiver to the cluster (the server set-up can be found here). To deploy the application we add a web.xml with the following contents

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
           version="3.0">
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring-config.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- default weblogic work manager -->
    <resource-ref>
        <res-ref-name>default</res-ref-name>
        <res-type>commonj.work.WorkManager</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <!-- default weblogic timer manager -->
    <resource-ref>
        <res-ref-name>tm/default</res-ref-name>
        <res-type>commonj.timers.TimerManager</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    <servlet>
        <servlet-name>TestServlet</servlet-name>
        <servlet-class>test.TestServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>TestServlet</servlet-name>
        <url-pattern>/testservlet</url-pattern>
    </servlet-mapping>
</web-app>

What happens when the applications run is that a JMS producer (sender) is connected to the SAF environment on the AdminServer. The JMS producer sends messages every 30 seconds, which is configured by using a commonj timer manager. The message send to the SAF queue is being forwarded to the jms/CompanyQueue (a distributed queue) to which a JMS consumer (receiver) is listening by using a SimpleMessageListenerContainer that is coupled to a commonj work manager in order to make sure the thread spawned by the listener is managed by the WebLogic Server. In the logging the following is observed

Logging server1 in the cluster
Apr 16, 2012 11:41:02 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Apr 16, 2012 11:41:02 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1e3c6703: display name [Root WebApplicationContext]; startup date [Mon Apr 16 11:41:02 CEST 2012]; root of context hierarchy
Apr 16, 2012 11:41:03 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-config.xml]
Apr 16, 2012 11:41:03 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@1e3c6703]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1e4efd06
Apr 16, 2012 11:41:03 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1e4efd06: defining beans [sourceJndiTemplate,targetJndiTemplate,sourceConnectionFactory,sourceDestination,sourceJmsTemplate,targetConnectionFactory,targetDestination,taskExecutor,timerListener,timerFactory,org.springframework.jms.listener.SimpleMessageListenerContainer#0,sender,receiver]; root of factory hierarchy
Apr 16, 2012 11:41:03 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 842 ms
received the following message: d8nv7v6vgm5j
received the following message: 1be4omcwwiy61
received the following message: 19y6wh44hora6
received the following message: ha5hp6gaw6ql
received the following message: xercuxsl5qwf
received the following message: 1vvx5lptldi8r
received the following message: 1cgsdl10dkokz
received the following message: qfmd6v14tbb6
received the following message: 53hsnn8dfmor
received the following message: 8uaecn6919mi
received the following message: 8i93wuglm4lj
received the following message: 11d5bkqc5vdnq
received the following message: wc9hpcqmzjj9
received the following message: 17zj64mnvj7d9
received the following message: 1dt5g68vv9d50
received the following message: 13ch0ee5ofrzb
received the following message: 121t0btwasrqs
received the following message: 1lr8qb6il7nac
received the following message: 1l6lm4lge9tjx
received the following message: 15bgb2y3qzxl8
received the following message: vlryb3s3cn1o
received the following message: 189ahnkk5me1n
received the following message: 1wlhom58c3u01

Logging server2 in the cluster
Apr 16, 2012 11:41:02 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Apr 16, 2012 11:41:02 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@1e9e9ebc: display name [Root WebApplicationContext]; startup date [Mon Apr 16 11:41:02 CEST 2012]; root of context hierarchy
Apr 16, 2012 11:41:03 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-config.xml]
Apr 16, 2012 11:41:03 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@1e9e9ebc]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1ec29f17
Apr 16, 2012 11:41:03 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1ec29f17: defining beans [sourceJndiTemplate,targetJndiTemplate,sourceConnectionFactory,sourceDestination,sourceJmsTemplate,targetConnectionFactory,targetDestination,taskExecutor,timerListener,timerFactory,org.springframework.jms.listener.SimpleMessageListenerContainer#0,sender,receiver]; root of factory hierarchy
Apr 16, 2012 11:41:03 AM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 686 ms
received the following message: 1uwivfp2ngq1t
received the following message: bo4z7iakwqqv
received the following message: 1sdrelhucxxed
received the following message: 99xztxrc3f9f
received the following message: 1u8ej4ls0avqt
received the following message: hhkpei2bqyaw
received the following message: 2nid8k122rnd
received the following message: m2n72h6ajiao
received the following message: 1wpp89uiqttrw
received the following message: 18ecmmhgmmheu
received the following message: 1neja8ptey39a
received the following message: 1iu5em4cknpaa
received the following message: p89q16c2npbp
received the following message: 13gx5jqyzh57n
received the following message: 6lcjw5vjpttp
received the following message: 74wvvr4ey35s
received the following message: 1mcnjxzy2xp6f
received the following message: 12d6ybdpmi2wp

The extra messages in server1 are there because when running Spring as a client instead of being deployed to the WebLogic cluster, the receiver is only registered to one queue in the distributed queue. To test the set-up (without the timer manager and work manager configuration and) without deploying the application to WebLogic we can use

package model.test;

import model.logic.JMSSender;
import model.utils.SpringUtilities;

public class JMSTest {

    public static void main(String[] args) {
        JMSSender jmsSender = SpringUtilities.getJMSSender();

        while (true) {
            jmsSender.sendMessage();
            System.out.println("done sending message");
            try {
                Thread.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}

Performance considerations

The following documents provide information on various methods to improve performance:

Another tuning parameter to consider is the chunk size. A chunk is a unit of memory that the WebLogic Server network layer, both on the client and server side, uses to read data from and write data to sockets. To reduce memory allocation costs, a server instance maintains a pool of these chunks. For applications that handle large amounts of data per request, increasing the value on both the client and server sides can boost performance. The default chunk size is about 4K. Use the following properties to tune the chunk size and the chunk pool size:

  • weblogic.Chunksize – sets the size of a chunk (in bytes). The primary situation in which this may need to be increased is if request sizes are large. It should be set to values that are multiples of the network’s maximum transfer unit (MTU), after subtracting from the value any Ethernet or TCP header sizes. Set this parameter to the same value on the client and server.
  • weblogic.utils.io.chunkpoolsize – sets the maximum size of the chunk pool. The default value is 2048. The value may need to be increased if the server starts to allocate and discard chunks in steady state. To determine if the value needs to be increased, monitor the CPU profile or use a memory/ heap profiler for call stacks invoking the constructor weblogic.utils.io.Chunk.
  • weblogic.PartitionSize – sets the number of pool partitions used (default is 4). The chunk pool can be a source of significant lock contention as each request to access to the pool must be synchronized. Partitioning the thread pool spreads the potential for contention over more than one partition.

For example, we can set the chunksize by using -Dweblogic.Chunksize=65536 on the command-line.

References

[1] Configuring and Managing JMS for WebLogic Server.
[2] Configuring and Managing the Messaging Bridge for WebLogic Server.
[3] Configuring and Managing Store-and-Forward for WebLogic Server.
[4] Performance and Tuning for WebLogic Server.


Spring and GlassFish JMS

In this post we set-up a GlassFish Server environment that includes a JMS configuration that will be used by a Spring client. First, we look at some considerations when developing a client that uses JMS. Next, we look at the classloading, i.e., the classes needed in order for Spring to communicate with GlassFish and obtain JMS resources from JNDI. Finally, we show the configuration needed in Spring and test the set-up.

Some notes up front

The Java Messaging Specification was developed to abstract access to message-oriented middleware systems. A client that writes JMS code should be portable to any provider that implements this specification. If code portability is important, be sure to do the following in developing clients:

  • Make sure the code does not depend on extensions or features that are specific to Message Queue.
  • Look up, using JNDI, (rather than instantiate) administered objects for connection factories and destinations.

Another point to consider when developing a client is to use threads effectively, i.e., we need to balance performance, throughput, and resource needs. To do this, we need to understand JMS restrictions on thread usage, what threads Message Queue allocates for itself, and the architecture of the applications. The Java Messaging Specification mandates that a session not be operated on by more than one thread at a time. This leads to the following restrictions:

  • A session may not have an asynchronous consumer and a synchronous consumer.
  • A session that has an asynchronous consumer can only produce messages from within the onMessage() method (the message listener). The only call that we can make outside the message listener is to close the session.
  • A session may include any number of synchronous consumers, any number of producers, and any combination of the two. That is, the single-thread requirement cannot be violated by these combinations. However, performance may suffer.

The system does not enforce the requirement that a session be single threaded. If the client application violates this requirement, we will get a JMSIllegalState exception or unexpected results. When the Message Queue client runtime creates a connection, it creates two threads: one for consuming messages from the socket, and one to manage the flow of messages for the connection. In addition, the client runtime creates a thread for each client session. Thus, at a minimum, for a connection using one session, three threads are created. For a connection using three sessions, five threads are created, and so on. Managing threads in a JMS application often involves trade-offs between performance and throughput. Weigh the following considerations when dealing with threading issues. When we create several asynchronous message consumers in the same session, messages are delivered serially by the session thread to these consumers. Sharing a session among several message consumers might starve some consumers of messages while inundating other consumers. If the message rate across these consumers is high enough to cause an imbalance, we might want to separate the consumers into different sessions. To determine whether message flow is unbalanced, we can monitor destinations to see the rate of messages coming in. We can reduce the number of threads allocated to the client application by using fewer connections and fewer sessions. However, doing this might slow the application’s throughput. We might be able to use certain JVM runtime options to improve thread memory usage and performance.

A client application running in a JVM needs enough memory to accommodate messages that flow in from the network as well as messages the client creates. If the client gets OutOfMemoryError errors, chances are that not enough memory was provided to handle the size or the number of messages being consumed or produced. The client might need more than the default JVM heap space. Consider the following guidelines:

  • Evaluate the normal and peak system memory footprints when sizing heap space.
  • Adjust the heap size settings accordingly (the best size for the heap space depends on both the operating system and the JDK release).

In general, for better manageability, we can break large messages into smaller parts, and use sequencing to ensure that the partial messages sent are concatenated properly. We can also use a Message Queue JMS feature to compress the body of a message. Compression only affects the message body; the message header and properties are not compressed. Although message compression has been added to improve performance, such benefit is not guaranteed. Benefits vary with the size and format of messages, the number of consumers, network bandwidth, and CPU performance. For example, the cost of compression and decompression might be higher than the time saved in sending and receiving a compressed message. This is especially true when sending small messages in a high-speed network. On the other hand, applications that publish large messages to many consumers or who publish in a slow network environment, might improve system performance by compressing messages.

Persistent messages guarantee message delivery in case of broker failure. The broker stores these message in a persistent store until all intended consumers acknowledge that they have consumed the message. Broker processing of persistent messages is slower than for nonpersistent messages for the following reasons:

  • A broker must reliably store a persistent message so that it will not be lost should the broker fail.
  • The broker must confirm receipt of each persistent message it receives. Delivery to the broker is guaranteed once the method producing the message returns without an exception.
  • Depending on the client acknowledgment mode, the broker might need to confirm a consuming client’s acknowledgment of a persistent message.

A transaction guarantees that all messages produced in a transacted session and all messages consumed in a transacted session will be either processed or not processed (rolled back) as a unit. A message produced or acknowledged in a transacted session is slower than in a non-transacted session for the following reasons:

  • Additional information must be stored with each produced message.
  • In some situations, messages in a transaction are stored when normally they would not be. For example, a persistent message delivered to a topic destination with no subscriptions would normally be deleted, however, at the time the transaction is begun, information about subscriptions is not available.
  • Information on the consumption and acknowledgment of messages within a transaction must be stored and processed when the transaction is committed.

Other than using transactions, we can ensure reliable delivery by having the client acknowledge receiving a message. The messaging provider can sort messages according to criteria specified in the message selector associated with a consumer and deliver to that consumer only those messages whose property value matches the message selector. Creating consumers with selectors lowers performance (as compared to using multiple destinations) because additional processing is required to handle each message. When a selector is used, it must be parsed so that it can be matched against future messages. Additionally, the message properties of each message must be retrieved and compared against the selector as each message is routed. However, using selectors provides more flexibility in a messaging application and may lower resource requirements at the expense of speed.

Message size affects performance because more data must be passed from producing client to broker and from broker to consuming client, and because for persistent messages a larger message must be stored. However, by batching smaller messages into a single message, the routing and processing of individual messages can be minimized, providing an overall performance gain. In this case, information about the state of individual messages is lost. JMS supports five message body types, shown below roughly in the order of complexity:

  • Bytes: Contains a set of bytes in a format determined by the application.
  • Text: Is a java.lang.String.
  • Stream: Contains a stream of Java primitive values.
  • Map: Contains a set of name-and-value pairs.
  • Object: Contains a Java serialized object.

While, in general, the message type is dictated by the needs of an application, the more complicated types (map and object) carry a performance cost – the expense of serializing and deserializing the data. The performance cost depends on how simple or how complicated the data is.

Developing the JMS client with Spring

When using GlassFish JMS in a Spring client we need the right classes on the class path. The gf-client.jar contains all the necessary references, i.e., the MANIFEST.MF contained in the jar file looks as follows

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: Apache Maven
Archiver-Version: Plexus Archiver
Built-By: java_re
Build-Jdk: 1.6.0_10
Package: org.glassfish.appclient.client.acc
Main-Class: org.glassfish.appclient.client.AppClientFacade
GlassFish-ServerExcluded: true
PreMain-Class: org.glassfish.appclient.client.acc.agent.AppClientContainerAgent
Class-Path: ../modules/jtype.jar ../modules/tools.jar ../modules/glassfish-corba-asm.jar ../modules/glassfish-corba-codegen.jar ../modules/glassfish-corba-csiv2-idl.jar ../modules/glassfish-corba-internal-api.jar ../modules/glassfish-corba-newtimer.jar ../modules/glassfish-corba-omgapi.jar ../modules/glassfish-corba-orb.jar ../modules/glassfish -corba-orbgeneric.jar ../modules/auto-depends.jar ../modules/config.jar ../modules/config-types.jar ../modules/hk2.jar ../modules/hk2-core.jar ../modules/osgi-adapter.jar ../modules/grizzly-comet.jar ../modules/grizzly-config.jar ../modules/grizzly-framework.jar ../modules/grizzly-http.jar ../modules/grizzly-http-servlet.jar ../modules/grizzly-lzma.jar ../modules/grizzly-portunif.jar ../modules/grizzly-rcm.jar ../modules/grizzly-utils.jar ../modules/grizzly-websockets.jar ../modules/javax.mail.jar ../modules/pkg-client.jar ../modules/jaxb-osgi.jar ../modules/activation.jar ../modules/el-api.jar ../modules/jaxr-api-osgi.jar ../modules/jaxrpc-api-osgi.jar ../modules/endorsed/jaxb-api-osgi.jar ../modules/stax-api.jar ../modules/junit.jar ../modules/stax2-api.jar ../modules/woodstox-core-asl.jar ../modules/javax.persistence.jar ../modules/org.eclipse.persistence.antlr.jar ../modules/org.eclipse.persistence.asm.jar ../modules/org.eclipse.persistence.core.jar ../modules/org.eclipse.persistence.jpa.jar ../modules/org.eclipse.persistence.jpa.modelgen.jar ../modules/org.eclipse.persistence.oracle.jar ../modules/endorsed/javax.annotation.jar ../modules/javax.ejb.jar ../modules/javax.enterprise.deploy.jar ../modules/javax.jms.jar ../modules/javax.management.j2ee.jar ../modules/javax.resource.jar ../modules/javax.security.auth.message.jar ../modules/javax.security.jacc.jar ../modules/javax.servlet.jar ../modules/javax.servlet.jsp.jar ../modules/javax.transaction.jar ../modules/simple-glassfish-api.jar ../modules/admin-core.jar ../modules/admin-util.jar ../modules/config-api.jar ../modules/monitoring-core.jar ../modules/acc-config.jar ../modules/gf-client-module.jar ../modules/gms-bootstrap.jar ../modules/amx-core.jar ../modules/amx-j2ee.jar ../modules/annotation-framework.jar ../modules/common-util.jar ../modules/container-common.jar ../modules/glassfish-api.jar ../modules/glassfish-ee-api.jar ../modules/glassfish-naming.jar ../modules/internal-api.jar ../modules/scattered-archive-api.jar ../modules/stats77.jar ../modules/connectors-inbound-runtime.jar ../modules/connectors-internal-api.jar ../modules/connectors-runtime.jar ../modules/work-management.jar ../modules/glassfish.jar ../modules/kernel.jar ../modules/logging.jar ../modules/deployment-common.jar ../modules/deployment-javaee-core.jar ../modules/dol.jar ../modules/ejb-container.jar ../modules/ejb-internal-api.jar ../modules/ldapbp-repackaged.jar ../modules/libpam4j-repackaged.jar ../modules/management-api.jar ../modules/flashlight-framework.jar ../modules/gmbal.jar ../modules/ha-api.jar ../modules/class-model.jar ../modules/asm-a ll-repackaged.jar ../modules/bean-validator.jar ../modules/jms-core.jar ../modules/endorsed/webservices-api-osgi.jar ../modules/webservices-extra-jdk-packages.jar ../modules/webservices-osgi.jar ../modules/orb-connector.jar ../modules/orb-iiop.jar ../modules/eclipselink-wrapper.pom ../modules/jpa-connector.jar ../modules/persistence-common.jar ../modules/cmp-internal-api.jar ../modules/appclient.security.jar ../modules/ejb.security.jar ../modules/jaspic.provider.framework.jar ../modules/security.jar ../modules/ssl-impl.jar ../modules/websecurity.jar ../modules/webservices.security.jar ../modules/jta.jar ../modules/jts.jar ../modules/transaction-internal-api.jar ../modules/el-impl.jar ../modules/jsp-impl.jar ../modules/war-util.jar ../modules/web-cli.jar ../modules/web-core.jar ../modules/web-embed-api.jar ../modules/web-glue.jar ../modules/web-gui-plugin-common.jar ../modules/web-naming.jar ../modules/jsr109-impl.jar ../modules/mimepull.jar ../modules/tiger-types.jar ../modules/shoal-gms-api.jar ../../mq/lib/imq.jar ../ ../mq/lib/imqadmin.jar ../../mq/lib/imqutil.jar ../../mq/lib/fscontext.jar ../lib/install/applications/jmsra/imqjmsra.jar ../lib/install/applications/__ds_jdbc_ra/__ds_jdbc_ra.jar ../lib/install/applications/__cp_jdbc_ra/__cp_jdbc_ra.jar ../lib/install/applications/__xa_jdbc_ra/__xa_jdbc_ra.jar ../lib/install/applications/__dm_jdbc_ra/__dm_jdbc_ra.jar ../../javadb/lib/derby.jar ../../javadb/lib/derbyclient.jar ../../javadb/lib/derbynet.jar ../../javadb/lib/derbytools.jar ../../javadb/lib/derbyrun.jar ../lib/install/applications/jaxr-ra/jaxr-ra.jar ../modules/aixporting-repackaged.jar
GlassFish-Conditional-Additions: ../modules/aixporting-repackaged.jar

which is of course quite a lot to have on the classpath when we just want to use JMS. Note that it also means we have to install GlassFish on the client. So naturally you start to look for alternative ways. To see if we can obtain an object from a GlassFish server by using JNDI, we can create a little test class, for example,

package model.test;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Properties;

public class JMSTest {

    public static void main(String[] args) {
        Properties props = new Properties();
        props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
        props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
        props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
        props.setProperty("org.omg.CORBA.ORBInitialHost", "192.168.1.50");
        props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");

        try {
            Context context = new InitialContext(props);
            System.out.println(context);
            System.out.println(context.lookup("jms/ConnectionFactory"));
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }
}

When running this class we of course miss classes on the class path. To find which jar contains the missing class we can use

#!/bin/sh

PATH=${PATH}:/home/oracle/jdk1.6.0_31/bin
export PATH

LOOK_FOR="org/glassfish/api/admin/ProcessEnvironment$ProcessType"
export LOOK_FOR

for i in `find /home/oracle/glassfish3/glassfish/modules -name "*jar"`
do
	jar tvf $i | grep $LOOK_FOR > /dev/null
	if [ $? == 0 ]
	then
		echo "==> Found \"$LOOK_FOR\" in $i"
	fi
done

Here the LOOK_FOR variable is set to the value for the missing class and the first parameter in the find command is the path in which to look. After a while we get to a collection of these classes

auto-depends.jar
common-util.jar
glassfish-api.jar
glassfish-corba-internal-api.jar
glassfish-naming.jar
hk2-core.jar
internal-api.jar

and run into the following exception

Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={java.naming.provider.url=iiop://192.168.1.50:3700, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is java.lang.NullPointerException]
	at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:352)
	at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)
	... 8 more
Caused by: java.lang.NullPointerException
	at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:365)
	at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:372)
	at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:402)
	at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:347)
	... 9 more

Now what? You go for the gf-client.jar and install GlassFish on the client. Not the nicest of solutions but one that works. The gf-client.jar file is located in the ${GLASS_HOME}/glassfish/lib directory. With gf-client.jar on the class path we get the following output when running the test

javax.naming.InitialContext@682bc3f5
Apr 12, 2012 4:59:02 PM org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator 4.1.0.Final
Apr 12, 2012 4:59:02 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
Apr 12, 2012 4:59:02 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version:  4.5.1  (Build 3-b) Compile:  Tue Jun 21 16:31:32 PDT 2011
Apr 12, 2012 4:59:02 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
Apr 12, 2012 4:59:02 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE
com.sun.messaging.jms.ra.ConnectionFactoryAdapter@61672c01

Next we need to configure Spring

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">com.sun.enterprise.naming.SerialInitContextFactory</prop>
                <prop key="java.naming.factory.url.pkgs">com.sun.enterprise.naming</prop>
                <prop key="java.naming.factory.state">com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl</prop>
                <prop key="org.omg.CORBA.ORBInitialHost">192.168.1.50</prop>
                <prop key="org.omg.CORBA.ORBInitialPort">3700</prop>
            </props>
        </property>
    </bean>
    <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="jndiTemplate"/>
        <property name="jndiName" value="jms/ConnectionFactory"/>
    </bean>
    <bean id="destination" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate" ref="jndiTemplate"/>
        <property name="jndiName" value="jms/CompanyQueue"/>
    </bean>
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="connectionFactory"/>
        <property name="defaultDestination" ref="destination"/>
    </bean>
    <bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
        <property name="connectionFactory" ref="connectionFactory"/>
        <property name="destination" ref="destination"/>
        <property name="messageListener" ref="receiver"/>
    </bean>
    <bean id="sender" class="model.logic.JMSSender">
        <property name="jmsTemplate" ref="jmsTemplate"/>
    </bean>
    <bean id="receiver" class="model.logic.JMSReceiver"/>
</beans>

The classes JMSSender and JMSReceiver can be found in the post WebLogic JMS Clustering and Spring. The post Fun with GlassFish shows the steps involved in how to create the JMS resources (connection factory and queue). To test the set-up we can use

package model.test;

import model.logic.JMSSender;
import model.utils.SpringUtilities;

public class JMSTest {

    public static void main(String[] args) {
        JMSSender jmsSender = SpringUtilities.getJMSSender();
        jmsSender.sendMessage();
        System.out.println("done sending message");
    }
}

which leads to the following output

Apr 12, 2012 5:30:45 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@78b5f53a: display name [org.springframework.context.support.ClassPathXmlApplicationContext@78b5f53a]; startup date [Thu Apr 12 17:30:45 CEST 2012]; root of context hierarchy
Apr 12, 2012 5:30:45 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [spring-config.xml]
Apr 12, 2012 5:30:45 PM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@78b5f53a]: org.springframework.beans.factory.support.DefaultListableBeanFactory@21b64e6a
Apr 12, 2012 5:30:45 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@21b64e6a: defining beans [jndiTemplate,connectionFactory,destination,jmsTemplate,org.springframework.jms.listener.SimpleMessageListenerContainer#0,sender,receiver]; root of factory hierarchy
Apr 12, 2012 5:30:49 PM org.hibernate.validator.util.Version <clinit>
INFO: Hibernate Validator 4.1.0.Final
Apr 12, 2012 5:30:49 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
Apr 12, 2012 5:30:49 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter: Version:  4.5.1  (Build 3-b) Compile:  Tue Jun 21 16:31:32 PDT 2011
Apr 12, 2012 5:30:49 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter starting: broker is REMOTE, connection mode is TCP
Apr 12, 2012 5:30:49 PM com.sun.messaging.jms.ra.ResourceAdapter start
INFO: MQJMSRA_RA1101: GlassFish MQ JMS Resource Adapter Started:REMOTE
received the following message: 8dxgbdo4u4ee
done sending message

References

[1] GlassFish Server Documentation.


  • Testimonials

  • RSS Middleware Magic – JBoss

  • Receive FREE Updates


    FREE Email updates of our new posts Enter your email address:



  • Magic Archives

  • Sitemeter Status

  • ClusterMap 7-Nov-2011 till Date

  • ClusterMap 6-Nov-2010 till 7-Nov-2011

  • Copyright © 2010-2012 Middleware Magic. All rights reserved. | Disclaimer