{"id":1099,"date":"2012-08-23T19:26:07","date_gmt":"2012-08-23T11:26:07","guid":{"rendered":"http:\/\/rmohan.com\/?p=1099"},"modified":"2012-08-23T19:26:59","modified_gmt":"2012-08-23T11:26:59","slug":"configuring-http-and-https-clustering-on-jboss-server","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1099","title":{"rendered":"Configuring HTTP and HTTPS clustering on JBoss Server"},"content":{"rendered":"<h1>Some colleagues of mine were facing problems getting the HTTP\/HTTPS clustering setup done for JBoss server. Although I have no experience on working with JBoss I decided to give it a try.<\/h1>\n<p>Note that my development environment is Windows. The first thing I did was get hold of JBoss 4.2.2GA installable. Why this one, because this is the one that I have!! I copied the installable twice on my machine\u2019s D: drive, creating two JBoss homes namely D:\\JBoss 4.2.2GA-1 and D:\\JBoss 4.2.2GA-2. To get the clustering setup done I referred to JBoss <a title=\"JBoss Clustering Guide\" href=\"http:\/\/docs.jboss.org\/jbossas\/guides\/clusteringguide\/r2\/en\/pdf\/jboss4-clustering.pdf\" target=\"_blank\">documentation<\/a>. The documentation is decent and assists in getting your setup right. Instructions regarding setting up HTTP related services can be found \u00a0under section 1.5 titled \u201cHTTP Services\u201d.<\/p>\n<p>First things first. Let us setup the load balancer. The load balancer is not part of the JBoss installable. JBoss uses the popular Apache Web server to assist it in achieving load balancing. The Apache web server\u2019s jk module is used to forward all requests to the JBoss servlet container. Apache web server downloadable is available <a title=\"Apache Web Server Download\" href=\"http:\/\/httpd.apache.org\" target=\"_blank\">here<\/a>. I have used Apache 2.0.52 and 2.0.55 for our demonstration. Per JBoss, any version in the range 2.0.x is acceptable. Next get hold of the JK module binaries from the <a title=\"Apache JK Module Download\" href=\"http:\/\/www.apache.org\/dist\/jakarta\/tomcat-connectors\/jk\/binaries\/\" target=\"_blank\">site<\/a>. I have used mod_jk-1.2.28-httpd-2.0.52.so. Please select the jk module version compatible to your Apache server. Detailed instructions of version compatibility are available on the download <a title=\"JK binaries\" href=\"http:\/\/www.apache.org\/dist\/tomcat\/tomcat-connectors\/jk\/binaries\/win32\/jk-1.2.28\/\" target=\"_blank\">page<\/a>. for e.g. for jk 1.2.28. Copy the JK module so file in the APACHE_HOME\/modules folder.<\/p>\n<p>Modify the APACHE_HOME\/conf\/httpd.conf and add the following lines at the end of the file.<\/p>\n<div id=\"highlighter_131039\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code># Include mod_jk's specific configuration file<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>2<\/code><\/td>\n<td><code>Include conf\/mod-jk.conf<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h1>Create a new mod-jk.conf file and copy the file in the APACHE_HOME\/conf folder.\u00a0The contents of the file are as below:<\/h1>\n<div id=\"highlighter_446762\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>01<\/code><\/td>\n<td><code># Load mod_jk module<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>02<\/code><\/td>\n<td><code>LoadModule jk_module modules\/mod_jk-1.2.28-httpd-2.0.52.so<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>03<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>04<\/code><\/td>\n<td><code># Where to find worker.properties<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>05<\/code><\/td>\n<td><code>JkWorkersFile conf\/workers.properties<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>06<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>07<\/code><\/td>\n<td><code># Where to put jk logs<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>08<\/code><\/td>\n<td><code>JkLogFile logs\/mod_jk.log<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>09<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>10<\/code><\/td>\n<td><code># Set the jk log level [debug\/error\/info]<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>11<\/code><\/td>\n<td><code>JkLogLevel info<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>12<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>13<\/code><\/td>\n<td><code># Select the log format<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>14<\/code><\/td>\n<td><code>JkLogStampFormat \"[%a %b %d %H:%M:%S %Y]\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>15<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>16<\/code><\/td>\n<td><code>#JkOptions indicate to send SSK KEY SIZE<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>17<\/code><\/td>\n<td><code>JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>18<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>19<\/code><\/td>\n<td><code># JkRequestLogFormat<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>20<\/code><\/td>\n<td><code>JkRequestLogFormat \"%w %V %T\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>21<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>22<\/code><\/td>\n<td><code># Mount your applications<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>23<\/code><\/td>\n<td><code>JkMount \/* loadbalancer<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>24<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>25<\/code><\/td>\n<td><code># Add shared memory<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>26<\/code><\/td>\n<td><code>JkShmFile logs\/jk.shm<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<p>Ensure that the file name is as per the installable copied in the modules folder. As per the instructions in the clustering guide, the mod-jk.conf file should have a Location tag in it. I have removed the same as it is not supported by my older Apache server. You can add the same if required. The JkMount directive in the file configures the URL that needs to be redirected. Currently it is configured to reroute all URLs; feel free to customize if required.<\/p>\n<p>Create a new worker.properties file. Contents are as below:<\/p>\n<div id=\"highlighter_592974\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>01<\/code><\/td>\n<td><code># Define list of workers<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>02<\/code><\/td>\n<td><code>worker.list=loadbalancer,status<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>03<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>04<\/code><\/td>\n<td><code># Define Node1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>05<\/code><\/td>\n<td><code>worker.node1.port=8009<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>06<\/code><\/td>\n<td><code>worker.node1.host=localhost<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>07<\/code><\/td>\n<td><code>worker.node1.type=ajp13<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>08<\/code><\/td>\n<td><code>worker.node1.lbfactor=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>09<\/code><\/td>\n<td><code>worker.node1.cachesize=10<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>10<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>11<\/code><\/td>\n<td><code># Define Node2<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>12<\/code><\/td>\n<td><code>worker.node2.port=8109<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>13<\/code><\/td>\n<td><code>worker.node2.host=localhost<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>14<\/code><\/td>\n<td><code>worker.node2.type=ajp13<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>15<\/code><\/td>\n<td><code>worker.node2.lbfactor=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>16<\/code><\/td>\n<td><code>worker.node2.cachesize=10<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>17<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>18<\/code><\/td>\n<td><code># Load balancing behaviour<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>19<\/code><\/td>\n<td><code>worker.loadbalancer.type=lb<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>20<\/code><\/td>\n<td><code>worker.loadbalancer.balance_workers=node1,node2<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>21<\/code><\/td>\n<td><code>worker.loadbalancer.sticky_session=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>22<\/code><\/td>\n<td><code>#worker.list=loadbalancer<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>23<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>24<\/code><\/td>\n<td><code># Status worker for managing load balancer<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>25<\/code><\/td>\n<td><code>worker.status.type=status<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h1>Note that the ports 8009 and 8109 are the JBoss AJP connector ports and not the HTTP ports. Copy the attached workers.properties in APACHE_HOME\/conf folder. I have defined two nodes and am assuming both are located on the same machine.<\/h1>\n<p>The server.xml within JBOSS_HOME\/server\/default\/deploy\/jboss-web.deployer should have the following tag:<\/p>\n<div id=\"highlighter_857344\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code>&lt;<\/code><code>Connector<\/code> <code>port<\/code><code>=<\/code><code>\"8009\"<\/code> <code>address<\/code><code>=<\/code><code>\"${jboss.bind.address}\"<\/code> <code>protocol<\/code><code>=<\/code><code>\"AJP\/1.3\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>2<\/code><\/td>\n<td><code>\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>emptySessionPath<\/code><code>=<\/code><code>\"true\"<\/code> <code>enableLookups<\/code><code>=<\/code><code>\"false\"<\/code> <code>redirectPort<\/code><code>=<\/code><code>\"8443\"<\/code> <code>&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h1>This defines the AJP port.<\/h1>\n<p>This should be enough to get the JBOSS server running in clustered mode for HTTP.<\/p>\n<p>I also needed to get the HTTPS setup rolling.\u00a0Apparently Apache does not provide built-in SSL support. To achieve SSL support you will need to download the OpenSSL project and install it. An alternative is to get an integrated apache-openssl download from this <a title=\"Apache-OpenSSL download\" href=\"http:\/\/hunter.campbus.com\" target=\"_blank\">site\u00a0<\/a>(The site was not available , hence I used downloads from the following <a title=\"Apache-OpenSSL\" href=\"http:\/\/www.thompsonbd.com\/files\/apache\/Apache_2.0.52-Openssl_0.9.7e-Win32.zip\" target=\"_blank\">site\u00a0<\/a>and got the openssl download from <a title=\"OpenSSL\" href=\"http:\/\/www.thompsonbd.com\/files\/apache\/Openssl-0.9.7e-Win32.zip\" target=\"_blank\">here<\/a>.<\/p>\n<p>An update: The Apache <a title=\"Apache Download Site\" href=\"http:\/\/httpd.apache.org\/download.cgi\" target=\"_blank\">site<\/a> provides a Windows binary with OpenSSL built-in. So you can use that one as well.<\/p>\n<p>I am assuming that you have created the certificate using the tomcat(jboss) server. For my testing purposes I have created a self signed certificate using the Java utility keytool. The syntax for certificate creation is as below:<\/p>\n<div id=\"highlighter_838989\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code>keytool -genkey -alias &lt;aliasName&gt; -keystore &lt;keystore name&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h1>More clarity is available at this <a title=\"Certificate Creation\" href=\"http:\/\/www.exampledepot.com\/egs\/java.security.cert\/CreateCert.html\" target=\"_blank\">site<\/a>.<\/h1>\n<p>Go to the server.xml file located within the &lt;JBoss_home&gt;\\server\\default\\deploy\\jboss-web.deployer folder. Search for a connector tag with the following description:<\/p>\n<div id=\"highlighter_358864\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code>&lt;<\/code><code>Connector<\/code> <code>port<\/code><code>=<\/code><code>\"8443\"<\/code> <code>protocol<\/code><code>=<\/code><code>\"HTTP\/1.1\"<\/code> <code>SSLEnabled<\/code><code>=<\/code><code>\"true\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>2<\/code><\/td>\n<td><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>maxThreads<\/code><code>=<\/code><code>\"150\"<\/code> <code>scheme<\/code><code>=<\/code><code>\"https\"<\/code> <code>secure<\/code><code>=<\/code><code>\"true\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>3<\/code><\/td>\n<td><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>clientAuth<\/code><code>=<\/code><code>\"false\"<\/code> <code>sslProtocol<\/code><code>=<\/code><code>\"TLS\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>4<\/code><\/td>\n<td><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>keystoreFile<\/code><code>=<\/code><code>\"D:\\jboss-4.2.2GA-1\\server\\default\\deploy\\jboss-web.deployer\\testing.keystore\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>5<\/code><\/td>\n<td><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>keystorePass<\/code><code>=<\/code><code>\"testing\"<\/code><code>\/&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h1>Add the new attributes keystoreFile and keystorePass in the connector tag. Do the same procedure for the other server. Change the port of this server.\u00a0Add a new AJP connector both the server.xml files.<\/h1>\n<div id=\"highlighter_71479\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>01<\/code><\/td>\n<td><code>&lt;<\/code><code>Connector<\/code> <code>port<\/code><code>=<\/code><code>\"8019\"<\/code> <code>address<\/code><code>=<\/code><code>\"${jboss.bind.address}\"<\/code> <code>protocol<\/code><code>=<\/code><code>\"AJP\/1.3\"<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>02<\/code><\/td>\n<td><code>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code><code>emptySessionPath<\/code><code>=<\/code><code>\"true\"<\/code> <code>enableLookups<\/code><code>=<\/code><code>\"false\"<\/code> <code>scheme<\/code><code>=<\/code><code>\"https\"<\/code>\u00a0<code>secure<\/code><code>=<\/code><code>\"true\"<\/code> <code>redirectPort<\/code><code>=<\/code><code>\"8443\"<\/code> <code>\/&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>03<\/code><\/td>\n<td><code>&lt;\/<\/code><code>sourcecode<\/code><code>&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>04<\/code><\/td>\n<td><code>Note that two new attributes scheme and secure have been added in the AJP connector declaration. Ensure that the port number in use do not conflict with other port numbers.<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>05<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>06<\/code><\/td>\n<td><code>The Jboss servers are now ready to receive SSL requests. Now to set up the apache server for taking care of load balancing. If you have installed Apache using the URL provided above, the conf folder will have two files httpd.conf and ssl.conf. Open the conf files are check the ServerRoot and DocumentRoot paths.<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>07<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>08<\/code><\/td>\n<td><code>Make sure that following lines in the httpd.conf file are uncommented.<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>09<\/code><\/td>\n<td><code>[sourcecode language=\"text\"]<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>10<\/code><\/td>\n<td><code>LoadModule ssl_module modules\/mod_ssl.so<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>11<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>12<\/code><\/td>\n<td><code>&lt;<\/code><code>IfModule<\/code> <code>mod_ssl.c&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>13<\/code><\/td>\n<td><code>\u00a0\u00a0\u00a0\u00a0<\/code><code>Include conf\/ssl.conf<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>14<\/code><\/td>\n<td><code>&lt;\/<\/code><code>IfModule<\/code><code>&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<p>Add the following lines at the end of the httpd.conf file<\/p>\n<div id=\"highlighter_97796\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code>&lt;VirtualHost *:80&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>2<\/code><\/td>\n<td><code>\u00a0<\/code><code>JkMount \/* loadbalancer<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>3<\/code><\/td>\n<td><code>&lt;\/VirtualHost&gt;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>4<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>5<\/code><\/td>\n<td><code># Include mod_jk's specific configuration file<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>6<\/code><\/td>\n<td><code>Include conf\/mod-jk.conf<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<p>mod-jk.conf remains unchanged.<\/p>\n<p>Unzip the OpenSSL.zip on the machine. Copy the libeay32.dll and ssleay32.dll in Windows\\system32 folder of the machine.<\/p>\n<p>The Tomcat keystore and Apache SSL certificates and keys are incompatible. They need to be converted into compatible certificate and key. For details around the conversion process refer the <a title=\"Certificate Conversion\" href=\"http:\/\/techsk.blogspot.com\/2009\/01\/exporting-tomcat-keys-to-apache-httpd.html\" target=\"_blank\">url<\/a>.<\/p>\n<p>Now you should be having the pem certificate and private key. Copy the files in a suitable folder and make relevant entries for them in the ssl.conf:<\/p>\n<div id=\"highlighter_601566\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code>SSLCertificateFile \/root\/SSL_export\/exported-pem.crt<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>2<\/code><\/td>\n<td><code>SSLCertificateKeyFile \/root\/SSL_export\/exported.key<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h1>The intermediate certificate is not required in case of self signed certificates.<\/h1>\n<p>Add the following statement within the VirtualHost tag of the ssl.conf file<\/p>\n<div id=\"highlighter_207334\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>1<\/code><\/td>\n<td><code>JkMount \/* loadbalancerSSL<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<h1>In ssl.conf file remove &lt;IfDefine SSL&gt; and &lt;\/IfDefine&gt; tags ensure that the ServerName, DocumentRoot are pointing to the correct folders. The workers.properties file is configured to handle 4 nodes, two for HTTP requests and two for HTTPS requests.<\/h1>\n<p>Here is the updated workers.properties file.<\/p>\n<div id=\"highlighter_496907\">\n<div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>01<\/code><\/td>\n<td><code># Define list of workers<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>02<\/code><\/td>\n<td><code>worker.list=loadbalancer,loadbalancerSSL,status<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>03<\/code><\/td>\n<td><code>#worker.list=loadbalancer,status<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>04<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>05<\/code><\/td>\n<td><code># Define Node1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>06<\/code><\/td>\n<td><code>worker.node1.port=8009<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>07<\/code><\/td>\n<td><code>worker.node1.host=localhost<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>08<\/code><\/td>\n<td><code>worker.node1.type=ajp13<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>09<\/code><\/td>\n<td><code>worker.node1.lbfactor=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>10<\/code><\/td>\n<td><code>worker.node1.cachesize=10<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>11<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>12<\/code><\/td>\n<td><code># Define Node2<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>13<\/code><\/td>\n<td><code>worker.node2.port=8109<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>14<\/code><\/td>\n<td><code>worker.node2.host=localhost<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>15<\/code><\/td>\n<td><code>worker.node2.type=ajp13<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>16<\/code><\/td>\n<td><code>worker.node2.lbfactor=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>17<\/code><\/td>\n<td><code>worker.node2.cachesize=10<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>18<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>19<\/code><\/td>\n<td><code># Define Node3<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>20<\/code><\/td>\n<td><code>worker.node3.port=8019<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>21<\/code><\/td>\n<td><code>worker.node3.host=localhost<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>22<\/code><\/td>\n<td><code>worker.node3.type=ajp13<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>23<\/code><\/td>\n<td><code>worker.node3.lbfactor=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>24<\/code><\/td>\n<td><code>worker.node3.cachesize=10<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>25<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>26<\/code><\/td>\n<td><code># Define Node2<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>27<\/code><\/td>\n<td><code>worker.node4.port=8119<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>28<\/code><\/td>\n<td><code>worker.node4.host=localhost<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>29<\/code><\/td>\n<td><code>worker.node4.type=ajp13<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>30<\/code><\/td>\n<td><code>worker.node4.lbfactor=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>31<\/code><\/td>\n<td><code>worker.node4.cachesize=10<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>32<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>33<\/code><\/td>\n<td><code># Load balancing behaviour<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>34<\/code><\/td>\n<td><code>worker.loadbalancer.type=lb<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>35<\/code><\/td>\n<td><code>worker.loadbalancer.balance_workers=node1,node2<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>36<\/code><\/td>\n<td><code>worker.loadbalancer.sticky_session=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>37<\/code><\/td>\n<td><code>#worker.list=loadbalancer<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>38<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>39<\/code><\/td>\n<td><code># Load balancing behaviour<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>40<\/code><\/td>\n<td><code>worker.loadbalancerSSL.type=lb<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>41<\/code><\/td>\n<td><code>worker.loadbalancerSSL.balance_workers=node3,node4<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>42<\/code><\/td>\n<td><code>worker.loadbalancerSSL.sticky_session=1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>43<\/code><\/td>\n<td><code>#worker.list=loadbalancer<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>44<\/code><\/td>\n<td>\u00a0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>45<\/code><\/td>\n<td><code># Status worker for managing load balancer<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div>\n<table>\n<tbody>\n<tr>\n<td><code>46<\/code><\/td>\n<td><code>worker.status.type=status<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<p>The above configuration should be enough to get the JBoss running in a clustered environment for HTTP as well as HTTPS requests.<\/p>\n<p>This post does not cover the portion for sticky session configuration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some colleagues of mine were facing problems getting the HTTP\/HTTPS clustering setup done for JBoss server. Although I have no experience on working with JBoss I decided to give it a try. <\/p>\n<p>Note that my development environment is Windows. The first thing I did was get hold of JBoss 4.2.2GA installable. Why this one, because [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1099"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1099"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1099\/revisions"}],"predecessor-version":[{"id":1105,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1099\/revisions\/1105"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1099"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1099"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1099"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}