JBoss application server tutorials

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

How to trace JDBC statements with JBoss and WildFly

One of the most popular questions asked at JDBC forums is how to debug Statements which are issued to the JDBC driver. Statement Tracing can be done out of the box with the new WildFly application server or JBoss AS 7. If you are using an older version of JBoss application server you can still do it using a free library named P6Spy. We will see both approaches.
Last Updated on Wednesday, 13 August 2014 10:28 Read more...

JSF 2.0 tutorial on JBoss AS

jsf 2 2.0 jboss tutorial wenJSF 2.0 is a major upgrade over JSF 1.2. The major additions include ManagedBeans annotations, simplified navigation and Ajax Support. In this first article we will look at the first two additions, using the milestone 3 of JBoss AS 6.
Last Updated on Saturday, 14 July 2012 08:45 Read more...

Clustering with JBoss mod_cluster

Mod cluster is an http based load balancer which greatly simplify the setup of an http cluster. It ships as a set of modules which need to be installed on the httpd server and a Service Archive Library (.sar) which needs to be deployed on JBoss AS (It is built-in in JBoss AS 6/7).

 

Compared with the former mod_jk, the new mod_cluster has the great advantage to accept a dynamic configuration of httpd workers. This can be done through an advertise mechanism where all httpd workers communicate lifecycle events (like startup or shutdown) thus leveraging dynamic configuration of nodes.

The following picture describes an high level view of the communication between the httpd server and a set of JBoss nodes:


jboss cluster clustering

As you can see, mod_cluster issues requests to mod_proxy_ajp which forwards the AJP request to the target node of the cluster. The cluster of JBoss nodes communicates the cluster view to mod_cluster.
However note that AJP is optional: Unlike mod_jk, mod_cluster can forward connections to application server nodes using also HTTP or HTTPS. Refer to the documentation for additional information about it.

Installing mod_cluster

The installation of mod_cluster is slightly different depending on the release of the application server. If you are running JBoss AS 5.1.0 you need to execute all the steps listed in this tutorial. If you are running JBoss AS 6 or 7 you need just to execute steps 2 (Install Binaries) and 4 (Update Apache configuration).

At first move to the Download page and download the following items:

1) Download the Java Bundle package which contains the Service Archive (.sar) to be deployed on JBoss
2) Download the binaries for your platform which contains a built-in httpd server and its modules (including mod_cluster).

1. Installing Java Bundles

From the bundle tar.gz, copy the file mod-cluster.sar in the "deploy/cluster"  folder of your "all" configuration:

jboss clustering cluster

2. Installing Mod_cluster Binaries

 You have to copy the following modules to your Apache Web server installation:
  • mod_proxy.so
  • mod_proxy_ajp.so
  • mod_slotmem.so
  • mod_manager.so
  • mod_proxy_cluster.so
  • mod_advertise.so
The modules can be extracted from the archive mod-cluster-1.0.3.GA-xxx-ssl.zip. The modules need to be copied in the APACHE_HOME/modules dir.

3. Update JBoss AS Configuration

Now open the file server.xml which contains the embedded Web Server configuration and is located in the deploy/jbossweb.sar/ folder and add the following line at the same level of other Listeners:

<Listener className="org.jboss.web.tomcat.service.deployers.MicrocontainerIntegrationLifecycleListener"            delegateBeanName="ModClusterService"/>
In the same file, a few lines after, add the jvmRoute in the Engine element:

<Engine name="jboss.web" defaultHost="localhost"  jvmRoute="node01"> 

Next file we need to modify is jboss-beans.xml which is located in the deploy/jbossweb.sar/META-INF folder. There we need to state that the WebServer depends on the Mod Cluster Service.

just add the following dependency to the WebServer bean (approx line 16)
 <depends>ModClusterService</depends> 

4. Update Apache Web Server configuration

Provided that you have copied all modules in the previous step, all you have to do is loading the modules in the httpd memory and configure a VirtualHost for handling requests to JBoss cluster.

In order to enable mod_cluster, the following modules need to be enabled:
LoadModule proxy_module /modules/mod_proxy.so
LoadModule proxy_ajp_module /modules/mod_proxy_ajp.so
LoadModule slotmem_module /modules/mod_slotmem.so
LoadModule manager_module /modules/mod_manager.so
LoadModule proxy_cluster_module /modules/mod_proxy_cluster.so
LoadModule advertise_module /modules/mod_advertise.so
Then, add this configuration to the bottom of your Apache's httpd.conf file:
Listen 192.168.1.0:6666

<VirtualHost 192.168.1.0:6666>   
    <Directory />     
       Order deny,allow     
       Deny from all     
       Allow from 192.168.1.  
   </Directory> 

   KeepAliveTimeout 60
   MaxKeepAliveRequests 0  
   ManagerBalancerName mycluster
   AdvertiseFrequency 5 
</VirtualHost>
Here we assume that your Apache listen to the IP Address 192.168.1.0 and accepts requests on port 6666.

Now the configuration is complete. Restart Apache and start a set of JBoss nodes:

JBoss AS 4/5/6

run.sh -c all -b 192.168.1.10                    

JBoss AS 7

standalone.sh -c standalone-ha.xml -b 192.168.1.10

Verify that both Apache and JBoss serve correctly web pages:

http://192.168.1.0:6666

should serve Apache home page. ("It works!")

Now deploy a sample Web application to JBoss cluster, for example MyWebApp context:

http://192.168.1.0:6666/MyWebApp

As you can see, mod cluster automatically configures a context for all your Web applications, unless you have explicitly excluded it in mod_cluster.sar/META-INF/mod-cluster-jboss-beans.xml file. (Look for the property excludedContexts)

References:

Last Updated on Thursday, 02 August 2012 19:52

Announcing JBoss performance tuning book

I'm glad to announce to the community of JBoss users that by the end of 2010 will be available the first book enterely dedicated to JBoss (and its embedded Tomcat) performance tuning.
Last Updated on Saturday, 14 July 2012 20:29 Read more...

Singleton EJB tutorial

One of the most interesting news of Java EE 6 is the Singleton annotation which can be used to mark your EJB as Singleton services.
Last Updated on Saturday, 14 July 2012 20:38 Read more...

Develop advanced reports on JBoss with Pentaho

Pentaho Reporting is an easy-to-use, open source, lightweight suite of Java projects built for report generation. In this tutorial we will show how you can embed Pentaho Reporting into a Web application deployed on JBoss AS.
Last Updated on Wednesday, 04 September 2013 08:27 Read more...

Creating an SMF service script for JBoss AS

This article describes how you can create a Service Manager Facility (SMF) for JBoss AS on Solaris/OpenSolaris. What is an SMF service at first ? if you are new to Solaris administration we will give here a short description about it.

Last Updated on Sunday, 15 July 2012 09:42 Read more...

JBoss log4j configuration

JBoss AS uses log4j as logging framework. This tutorial will show how to configure log4j service in your jBoss application server and also how to create a custom configuration which can be deployed along with your application.
Last Updated on Saturday, 14 July 2012 08:12 Read more...

EJB 3.1 available on JBoss 6

Java EE 1.6 has been officially last December. Now we are pleased to learn that the release 6 M2 of JBoss application server, finally includes also some EJB 3.1 stuff.
Last Updated on Saturday, 14 July 2012 20:58 Read more...

Page 28 of 38

Top Programming Sites
You are here Home