<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DirkReske.de &#187; javaee</title>
	<atom:link href="http://www.dirkreske.de/tag/javaee/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dirkreske.de</link>
	<description>Personal homepage of Dirk Reske</description>
	<lastBuildDate>Fri, 07 Oct 2011 13:29:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Glassfish load balancing using mod_proxy_balancer</title>
		<link>http://www.dirkreske.de/glassfish-load-balancing-using-mod_proxy_balancer/</link>
		<comments>http://www.dirkreske.de/glassfish-load-balancing-using-mod_proxy_balancer/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 15:28:06 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javaee]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=280</guid>
		<description><![CDATA[Overview In my previous article about configuring a glassfish load balancer, I&#8217;ve used the mod_jk connector for the apache webserver. These time I&#8217;m going to show, how to solve this using the mod proxy balancer plugin shipped with the most apache installations. (A &#8220;cleaner&#8221; way in my oppinion) A couple of times I&#8217;ve tried to &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/glassfish-load-balancing-using-mod_proxy_balancer/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<h3>Overview</h3>
<p>In my previous article about<a href="http://www.dirkreske.de/load-balancing-glassfish-using-apache/" target="_self"> configuring a glassfish load balancer</a>, I&#8217;ve used the mod_jk connector for the apache webserver.<br />
These time I&#8217;m going to show, how to solve this using the mod proxy balancer plugin shipped with the most apache installations. (A &#8220;cleaner&#8221; way in my oppinion)</p>
<p>A couple of times I&#8217;ve tried to get the Sun load balancing plugin  working, but without success. This was because of  some operating system  issues or other problems.<br />
So after looking around the web, I&#8217;ve found some good solutions using  apache and the mod_jk connector from the apache tomcat project.</p>
<h3>Requirements</h3>
<ul>
<li>Recent glassfish installation (I use v2.1.1).</li>
<li><a href="http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html" target="_blank">mod_jk</a> tomcat connector.</li>
<li><a href="http://tomcat.apache.org/" target="_blank">Apache tomcat</a> server to get some files from (Use version 5.5.23, others won&#8217;t work).</li>
<li><a href="http://commons.apache.org/logging/" target="_blank">Apache commons logging</a></li>
<li><a href="http://commons.apache.org/modeler/" target="_blank">Apache commons modeler</a></li>
</ul>
<h3>Installation</h3>
<ol>
<li>Configuring the glassfish cluster
<ol>
<li>Copy the <em>$CATALINA_HOME/server/lib/tomcat-ajp.jar</em> to your <em>$GLASSFISH_HOME/lib </em>directory on each glassfish installation in your cluster.</li>
<li>Also copy the<em> commons-logging.jar</em> and<em> commons-modeler.jar</em> to your <em>$GLASSFISH_HOME/lib </em>directory on each glassfish installation in your cluster.</li>
<li>Now you have to define <em>jvmRoute </em>and<em> com.sun.enterprise.web.connector.enableJK</em> system properties for the cluster (this can be done from the domain administration server)
<pre>asadmin create-jvm-options --target cluster1 "-DjvmRoute=\${AJP_INSTANCE_NAME}"
asadmin create-jvm-options --target cluster1 "-Dcom.sun.enterprise.web.connector.enableJK=\${AJP_PORT}"</pre>
</li>
<li>Now you have to define the values for these properties for each  instance running in the cluster (this can also be done from the domain  administration server).<br />
This is needed, because the instance name, the user is working on has to be appended to the session id.</p>
<pre>asadmin create-system-properties --target instance1 AJP_INSTANCE_NAME=instance1
asadmin create-system-properties --target instance1 AJP_PORT=8020</pre>
</li>
</ol>
</li>
<li>Configuring the apache web server
<ol>
<li>Enable mod_proxy, mod_proxy_http and mod_proxy_balancer on your apache installation.</li>
<li>Create a virtual-host (or use your main server), and copy the following lines to i.<br />
Be aware, that the <em>route </em>parameters matches the instance names assigned in the previous steps.</p>
<pre>ProxyRequests       Off
ProxyPreserveHost   On

&lt;Proxy *&gt;
  Order deny,allow
  Allow from all
&lt;/Proxy&gt;

&lt;Location /balancer-manager&gt;    
  SetHandler balancer-manager 
  ProxyPass !  
  Order deny,allow
  Allow from all
&lt;/Location&gt;

&lt;Proxy balancer://cluster&gt;
  BalancerMember http://192.168.0.10:38080 route=instance1
  BalancerMember http://192.168.0.11:38080 route=instance2
  BalancerMember http://192.168.0.12:38080 route=instance3
&lt;/Proxy&gt;

&lt;Location /&gt;
  ProxyPass balancer://cluster/ lbmethod=byrequests stickysession=JSESSIONID|jsessionid
&lt;/Location&gt;</pre>
</li>
<li>Restart all cluster instances and the web server. Your load balancing should be working now.<br />
Each time a new session is creted by the glassfish, it appends its  instance name to the JSESSIONID, so the load balancer can determine on  which instance to route the request.<br />
If one instance crashes, the load balancer will notice this and  redirects all requests to another instance. If you have enabled session  replication, your old session will be resumed there.</li>
</ol>
<h3>Further reading</h3>
<ul>
<li><a href="../enable-glassfish-session-replication/">enable session replication</a></li>
<li><a href="../glassfish-cluster-configuration/">setting up a glassfish cluster</a></li>
<li><a href="http://httpd.apache.org/docs/2.1/mod/mod_proxy_balancer.html" target="_blank">mod proxy balancer documentation</a></li>
</ul>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/glassfish-load-balancing-using-mod_proxy_balancer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designer friendly JSF using jsfc attribute</title>
		<link>http://www.dirkreske.de/designer-friendly-jsf-using-jsfc-attribute/</link>
		<comments>http://www.dirkreske.de/designer-friendly-jsf-using-jsfc-attribute/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 16:47:35 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[facelets]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[jsf]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=185</guid>
		<description><![CDATA[Have you ever tried to edit your jsf code using a visual designer like dreamweaver? Or do you get your html layout from a professional designer and have to &#8220;translate&#8221; it to jsf? In the first case, most times it will be look very strange, because the designer doesn&#8217;t understand the jsf tags and so &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/designer-friendly-jsf-using-jsfc-attribute/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>Have you ever tried to edit your jsf code using a visual designer like dreamweaver? Or do you get your html layout from a professional designer and have to &#8220;translate&#8221; it to jsf?</p>
<p>In the first case, most times it will be look very strange, because the designer doesn&#8217;t understand the jsf tags and so it don&#8217;t know how to display it.</p>
<p>If you want to create a fast jsf prototype of your html layout you can use the <em>jsfc</em> attribute provided by the facelets compiler. By adding this attribute to standard html tags, you can tell the compiler, in which jsf component it has to &#8220;translate&#8221; the html component.</p>
<p>See the following simple html example:</p>
<pre>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">strong</span></a>&gt;</span>Name<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">strong</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">strong</span></a>&gt;</span>eMail<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000; font-weight: bold;">strong</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span>John Doe<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span>jon@doe.de<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span></div></td></tr></tbody></table></div>
</pre>
<p>You can convert this by replacing all with a <em>h:dataTable</em> tag, or you can use the jsfc attribute in several ways.<br />
One way could be:</p>
<pre>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">b</span></a>&gt;</span>Name<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">b</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">b</span></a>&gt;</span>eMail<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/b.html"><span style="color: #000000; font-weight: bold;">b</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a> jsfc<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ui:repeat&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{userListBean.users}&quot;</span> var<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;user&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span>#{user.name}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span>#{user.email}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span></div></td></tr></tbody></table></div>
</pre>
<p>You see, there is no jsf tag in this code. Sou you can edit this html using your favorite designer, it will simply ignore the unknown attributes.</p>
<p>Another way would be, telling the facelets compiler to render the table as a <em>h:dataTable</em>, but because of the header row, you&#8217;ll have to use the f:facet tag.</p>
<pre>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a> jsfc<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;h:dataTable&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{userListBean.users}&quot;</span> var<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;user&quot;</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a> jsfc<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;h:column&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;f:facet <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;</span>Username<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>f:facet&gt;</span><br />
&nbsp; &nbsp; &nbsp; #{user.name}<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a> jsfc<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;h:column&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;f:facet <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;</span>eMail<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>f:facet&gt;</span><br />
&nbsp; &nbsp; &nbsp; #{user.email}<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span></div></td></tr></tbody></table></div>
</pre>
<p>So this way you still have to use jsf tags and so the visual designer can&#8217;t interpret it correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/designer-friendly-jsf-using-jsfc-attribute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load balancing glassfish using apache</title>
		<link>http://www.dirkreske.de/load-balancing-glassfish-using-apache/</link>
		<comments>http://www.dirkreske.de/load-balancing-glassfish-using-apache/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 23:19:48 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[load balancing]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=116</guid>
		<description><![CDATA[Overview After my articles about setting up a glassfish cluster and enable session replication, its now time to put a load balancer in front of it. A couple of times I&#8217;ve tried to get the Sun load balancing plugin working, but without success. This was because of  some operating system issues or other problems. So &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/load-balancing-glassfish-using-apache/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<h3>Overview</h3>
<p>After my articles about <a href="http://www.dirkreske.de/glassfish-cluster-configuration/">setting up a glassfish cluster</a> and <a href="http://www.dirkreske.de/enable-glassfish-session-replication/">enable session replication</a>, its now time to put a load balancer in front of it.</p>
<p>A couple of times I&#8217;ve tried to get the Sun load balancing plugin working, but without success. This was because of  some operating system issues or other problems.<br />
So after looking around the web, I&#8217;ve found some good solutions using apache and the mod_jk connector from the apache tomcat project.</p>
<h3>Requirements</h3>
<ul>
<li>Recent glassfish installation (I use v2.1.1).</li>
<li><a href="http://tomcat.apache.org/connectors-doc/webserver_howto/apache.html" target="_blank">mod_jk</a> tomcat connector.</li>
<li><a href="http://tomcat.apache.org/" target="_blank">Apache tomcat</a> server to get some files from (Use version 5.5.23, others won&#8217;t work).</li>
<li><a href="http://commons.apache.org/logging/" target="_blank">Apache commons logging</a></li>
<li><a href="http://commons.apache.org/modeler/" target="_blank">Apache commons modeler</a></li>
</ul>
<h3>Installation</h3>
<ol>
<li>Configuring the glassfish cluster
<ol>
<li>Copy the <em>$CATALINA_HOME/server/lib/tomcat-ajp.jar</em> to your <em>$GLASSFISH_HOME/lib </em>directory on each glassfish installation in your cluster.</li>
<li>Also copy the<em> commons-logging.jar</em> and<em> commons-modeler.jar</em> to your <em>$GLASSFISH_HOME/lib </em>directory on each glassfish installation in your cluster.</li>
<li>Now you have to define <em>jvmRoute </em>and<em> com.sun.enterprise.web.connector.enableJK</em> system properties for the cluster (this can be done from the domain administration server)
<pre>asadmin create-jvm-options --target cluster1 "-DjvmRoute=\${AJP_INSTANCE_NAME}"
asadmin create-jvm-options --target cluster1 "-Dcom.sun.enterprise.web.connector.enableJK=\${AJP_PORT}"</pre>
</li>
<li>Now you have to define the values for these properties for each instance running in the cluster (this can also be done from the domain administration server)
<pre>asadmin create-system-properties --target instance1 AJP_INSTANCE_NAME=instance1
asadmin create-system-properties --target instance1 AJP_PORT=8020</pre>
</li>
</ol>
</li>
<li>Configuring the apache web server
<ol>
<li>Copy the mod_jk.so to a apache accessible directory.</li>
<li>Copy the following lines to your apache main config file.
<pre>LoadModule jk_module <strong>&lt;path to your mod_jk.so&gt;</strong>
JkWorkersFile <strong>&lt;path to your worker.properties (created later)&gt;</strong>
JkLogFile <strong>&lt;path to your mod_jk.log&gt;</strong>
JkLogLevel debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"</pre>
</li>
<li>Copy the following lines to your virtual host configuration (or into the main config, if you don&#8217;t use virtual hosts).
<pre>JkMount /* loadbalancer</pre>
</li>
<li>This will redirect all requests to your load balancer. (You can also use patterns like <em>/*.jsp</em> for only redirecting jsp file request to the load balancer or just any other sensefull pattern).</li>
</ol>
</li>
<li>Writing your worker.properties configuration file.
<pre>worker.list=loadbalancer

# Set properties for instance1
worker.instance1.type=ajp13
worker.instance1.host=<strong>&lt;host of instance1&gt;</strong>
worker.instance1.port=<strong>&lt;AJP port of instance1&gt;</strong>
worker.instance1.lbfactor=50
worker.instance1.connection_pool_size=10
worker.instance1.connection_pool_timeout=600
worker.instance1.socket_keepalive=1
worker.instance1.socket_timeout=300

# Set properties for instance2
worker.instance2.type=ajp13
worker.instance2.host=<strong>&lt;host of instance2&gt;</strong>
worker.instance2.port=<strong>&lt;AJP port of instance2&gt;</strong>
worker.instance2.lbfactor=50
worker.instance2.connection_pool_size=10
worker.instance2.connection_pool_timeout=600
worker.instance2.socket_keepalive=1
worker.instance2.socket_timeout=300

worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=instance1,instance2</pre>
</li>
<li>Restart all cluster instances and the web server. Your load balancing should be working now.<br />
Each time a new session is creted by the glassfish, it appends its instance name to the JSESSIONID, so the load balancer can determine on which instance to route the request.<br />
If one instance crashes, the load balancer will notice this and redirects all requests to another instance. If you have enabled session replication, your old session will be resumed there.</li>
</ol>
<h3>Further reading</h3>
<ul>
<li><a href="http://www.dirkreske.de/enable-glassfish-session-replication/">enable session replication</a></li>
<li><a href="http://www.dirkreske.de/glassfish-cluster-configuration/">setting up a glassfish cluster</a></li>
<li><a href="http://tomcat.apache.org/connectors-doc/reference/workers.html" target="_blank">mod_jk connector documentation</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/load-balancing-glassfish-using-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable glassfish session replication</title>
		<link>http://www.dirkreske.de/enable-glassfish-session-replication/</link>
		<comments>http://www.dirkreske.de/enable-glassfish-session-replication/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 00:31:47 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[javaee]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=86</guid>
		<description><![CDATA[Overview One of the high availability methods provided by glassfish, is session replication. With session replication enabled, the server distributes session data across the cluster. If one cluster instances crashes, the session is still available on the other instances. Requirements A recent glassfish installation (versions prior to 2.1.1 had some bugs). A configured cluster (Look &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/enable-glassfish-session-replication/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<h3>Overview</h3>
<p>One of the high availability methods provided by glassfish, is session replication.<br />
With session replication enabled, the server distributes session data across the cluster. If one cluster instances crashes, the session is still available on the other instances.</p>
<h3>Requirements</h3>
<ul>
<li>A recent glassfish installation (versions prior to 2.1.1 had some bugs).</li>
<li>A configured cluster (Look <a href="../glassfish-cluster-configuration/">here </a>who to install a glassfish cluster).</li>
<li>All cluster instances located in the same subnet. (later glassfish version should support different subnets)</li>
</ul>
<h3>Configure session replication</h3>
<ol>
<li>Add a <em>&lt;distributable /&gt;</em> tag to your web.xml
<pre>&lt;web-app&gt;
  &lt;distributable /&gt;
  ...
&lt;/web-app&gt;</pre>
</li>
<li>Add following lines to your sun-web.xml
<pre>&lt;session-config&gt;
  &lt;session-manager persistence-type="replicated"&gt;
    &lt;manager-properties&gt;
      &lt;property name="persitencerequency" value="web-method" /&gt;
    &lt;/manager-properties&gt;
    &lt;store-properties&gt;
      &lt;property name="persistenceScope" value="session" /&gt;
    &lt;/store-properties&gt;
  &lt;/session-manager&gt;
&lt;/session-config&gt;</pre>
<ul>
<li><em>persistenceType=&#8221;replicated&#8221; </em>says, that the session should be replicated along the cluster.</li>
<li><em>persistenceFrequency=&#8221;web-method&#8221;</em> says that the session state should be stored after processing a request, but before sending the response. (other values: <em>time-based</em>)</li>
<li><em>persistenceScope=&#8221;session&#8221;</em> says that the whole session state should be stored. (other values: <em>modified-session</em>, <em>modified-attribute</em>)</li>
</ul>
</li>
<li>Deploy application
<ul>
<li>using the web-interface: check the <em>Availability </em>checkbox.</li>
<li>using the cli: add <em>&#8211;availabilityenabled=true</em> parameter.</li>
</ul>
</li>
</ol>
<h3>Notes</h3>
<ul>
<li>Be sure that all classes that are going to be stored in a session implements the <em>Serializable </em>interface.<br />
If not, the server can&#8217;t serialize it and replication won&#8217;t work.</li>
<li>As already mentioned, the instances have to be on the same subnet, otherwise session replication will not work.</li>
</ul>
<h3>Further reading</h3>
<p><a href="http://docs.sun.com/app/docs/doc/820-4336/gdshu?a=view" target="_blank">The replicated Persistence Type</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/enable-glassfish-session-replication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Glassfish cluster configuration</title>
		<link>http://www.dirkreske.de/glassfish-cluster-configuration/</link>
		<comments>http://www.dirkreske.de/glassfish-cluster-configuration/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 23:00:13 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[high availability]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javaee]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=41</guid>
		<description><![CDATA[Overview After I looked around the web, I&#8217;ve found a few good howto&#8217;s about glassfish cluster configuration, but either they use only single machine clusters or they have some other disadvantages in my eyes. So I&#8217;ve decided to write my own article about this. This article will describes how to set up a two machine &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/glassfish-cluster-configuration/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<h3>Overview</h3>
<p>After I looked around the web, I&#8217;ve found a few good howto&#8217;s about glassfish cluster configuration, but either they use only single machine clusters or they have some other disadvantages in my eyes. So I&#8217;ve decided to write my own article about this.</p>
<p>This article will describes how to set up a two machine cluster which consists of the domain administration server (DAS) and a &#8220;normal&#8221; node. Thereby the DAS also works as such a normal node.</p>
<p>This article uses Glassfish v2.1.</p>
<h3>Before the installation</h3>
<p>You have to ensure, that your network is configured properly, especially the dns system. If there are problems, there will be curious problems while setting all up. I&#8217;ve done this using the hosts file.</p>
<pre>10.0.0.1   das-host
10.0.0.2   node2-host
10.0.0.x   nodex-host</pre>
<p>The next thing is the firewall. The nodes communicating using a couple of ports. For setup and testing I&#8217;ve configured my firewalls to accept everything from all the other nodes, so there are no problems for the nodes to communicate with each other.</p>
<h3>Setting up the DAS</h3>
<p>Because the DAS server needs cluster support, we have to configure this first.<br />
There are two ways to do this.</p>
<ul>
<li>install the glassfish server using:
<pre>ant -f setup-cluster.xml</pre>
</li>
<li>activate cluster support using the admin console
<ol>
<li>go the the admin console (e.g. http://localhost:4848)</li>
<li>select from the common task: Enable Cluster Support</li>
</ol>
</li>
</ul>
<p>Now start up the server using:</p>
<pre>asadmin start-domain domain1</pre>
<p>In the next steps, I will create the cluster, then a node-agent and one instance running on the DAS server using the cli.</p>
<p>In most cases you have to specifiy your admin username and password. This can be done using the <em>&#8211;user</em> and <em>&#8211;passwordfile</em> parameters, but for simpler reading I will omit this. The server will ask you in this case.</p>
<ol>
<li>Create the cluster:
<pre>asadmin create-cluster cluster1</pre>
<p>This creates a cluster on the local server (the DAS) with the name <em>cluster1</em>.</li>
<li>Create the node agent:
<pre>asadmin create-node-agent das-agent</pre>
<p>This will create the node agent for the current node.</li>
<li>Create the instance for the current node:
<pre>asadmin create-instance --nodeagent das-agent --cluster cluster1 instance1</pre>
<p>This will create the instance <em>instance1</em> associated with the node agent <em>das-agent</em> and the cluster <em>cluster1</em>.</li>
<li>Now start up the node agent and the associated instance:
<pre>asadmin start-node-agent --syncinstances=true --startinstances=true das-agent</pre>
<ul>
<li><em>&#8211;syncinstances=true</em> says that the node agent should synchronize its instances with the central repository of the DAS</li>
<li><em>&#8211;startinstances=true</em> says the the node agent should start all its instances (instance1 in our case)</li>
</ul>
</li>
</ol>
<p>Now the domain administration server is up and running.<br />
The first node is also running.</p>
<h3>Setting up the second node</h3>
<p>Now come to setup the second node.<br />
Because the second node should only work a &#8220;computing&#8221; node, we do not need to install the whole application server, just a node agent.<br />
I omit user and password parameters here too. You have to enter the DAS login informations when asked for.</p>
<ol>
<li>Install the node agent:
<pre>ant -f setup-cluster.xml create-node-agent -Ddas.host=das-host -Dnodeagent.name=node2-agent</pre>
<ul>
<li><em>-Ddas.host=das-host</em> sets the hostname of the domain administration server</li>
<li><em>-Dnodeagent.name=node2-agent</em> sets the name of the local node agent</li>
</ul>
</li>
<li>Create the new instance:
<pre>asadmin create-instance --host das-host --nodeagent node2-agent --cluster cluster1 instance2</pre>
<p>This will create the new instance associated with the node agent<em> node2-agent</em> and the cluster <em>cluster1</em>. The <em>&#8211;host</em> parameter specifies the hostname of the domain administration server.</li>
<li>Start the instance:
<pre>asadmin start-node-agent --syncinstances=true --startinstances=true node2-agent</pre>
<p>Now the local node agent starts, synchronizes with the das server and starts all local instances (only <em>instance2 </em>in our case)</li>
</ol>
<p>Now your cluster is running with two nodes. To add more nodes, just repeat the three above steps as much as you want.</p>
<h3>Deploying applications to the cluster</h3>
<p>For deploying applications to the cluster, just type on the das server</p>
<pre>asadmin deploy --user admin --target cluster1 MyApplication.ear</pre>
<p>This will deploy the application to the whole cluster.</p>
<h3>For further reading</h3>
<ul>
<li><a href="http://www.dirkreske.de/enable-glassfish-session-replication/">Enable glassfish session replication</a></li>
<li><a href="http://docs.sun.com/app/docs/doc/819-3675/create-cluster-1?l=de&amp;a=view" target="_blank">create-cluster command</a></li>
<li><a href="http://docs.sun.com/app/docs/doc/819-3675/create-node-agent-1?l=de&amp;a=view" target="_blank">create-node-agent command</a></li>
<li><a href="http://docs.sun.com/app/docs/doc/819-3675/create-instance-1?l=de&amp;a=view" target="_blank">create-instance command</a></li>
<li><a href="http://docs.sun.com/app/docs/doc/819-3675/start-node-agent-1?l=de&amp;a=view" target="_blank">start-node-agent command</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/glassfish-cluster-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nxApex Workflow Editor</title>
		<link>http://www.dirkreske.de/nxapex-workflow-editor/</link>
		<comments>http://www.dirkreske.de/nxapex-workflow-editor/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 19:04:10 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Project References]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[jboss]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=31</guid>
		<description><![CDATA[The Workflow Editor is a part of the net-linx application nxApex. The users of this application are phone directory publishers. Service order is a process to import customer information like address, phone number, placement information, etc and to create and update the existing information in the customer database by creating, deleting or updating this information. &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/nxapex-workflow-editor/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>The Workflow Editor is a part of the net-linx application nxApex. The users of this application are phone directory publishers. Service order is a process to import customer information like address, phone number, placement information, etc and to create and update the existing information in the customer database by creating, deleting or updating this information.</p>
<p>This is a rather complex process and it is different from publisher to publisher. In the past the service order module has been customized for each publisher.</p>
<p>The new workflow editor is used to edit flexible workflows that can be adopted easily by configuration personnel. On the development of this module external student apprentices took part together with experienced internal Java developers.</p>
<h3>Workflow Overview</h3>
<p>The Workflow Editor is meant for system administrator use only. The information provided in this module is technical and not meant for end user&#8217;s view.</p>
<p>The workflow for service order and other DAQ processes is specified in workflow configuration file.<br />
The workflow configuration file contains all workflows. A workflow is always bound to a record type. You can define more than one workflow for a record type. The workflow which should be used must be marked as default.</p>
<p>A workflow can contain the following items: transformation items, validation items, search items and processing items, process flow items, and actions.</p>
<p>All changes made to the record data during the processing of the workflow are discarded after the workflow is finished if not otherwise specified. (See transformation item). Changes made to the administrative data (status, status messages) are saved to the database.</p>
<p>A workflow defines the sequence in which the rules should be processed and the actions depending on the output value of one rule. Rules are for example matching rules.</p>
<p>A workflow consists of a list of workflow items. These workflow items define the rules which should be used and the actions which should be taken on a specific rule output.<br />
If no action is defined for a specific output value is defined, a default action will be used.<br />
The default action for the output values &#8216;NotUsed&#8217; and &#8216;Ok&#8217; is &#8216;Goto Next Item&#8217;. The default action for &#8216;Error&#8217; is &#8216;Reject Immediate&#8217;.<br />
Every action is defined by an action code and a number of parameters.</p>
<p><img class="alignnone size-full wp-image-32" title="workflow-editor" src="http://www.dirkreske.de/wp-content/uploads/2009/10/workflow-editor.jpg" alt="workflow-editor" width="505" height="315" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/nxapex-workflow-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

