<?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; java</title>
	<atom:link href="http://www.dirkreske.de/tag/java/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>JSF1095 with Glassfish 3.1</title>
		<link>http://www.dirkreske.de/jsf1095-with-glassfish-3-1/</link>
		<comments>http://www.dirkreske.de/jsf1095-with-glassfish-3-1/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 12:53:41 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[flash scope]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jsf 2]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=341</guid>
		<description><![CDATA[After I&#8217;ve learned about the new Flash scope before a while, I was often f***** by &#8220;JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash.  Any values stored to the flash will not be available on the next request.&#8220;. After reading all (I think around &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/jsf1095-with-glassfish-3-1/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>After I&#8217;ve learned about the new Flash scope before a while, I was often f***** by &#8220;<strong>JSF1095: The response was already committed by the time we tried to set the outgoing cookie for the flash.  Any values stored to the flash will not be available on the next request.</strong>&#8220;.</p>
<p>After reading all (I think around 15) Pages that google has found about this error, I still had no solution. Some of them thought, it is a RichFaces issue, the other say&#8217;s its a PrimeFaces, and so on. But after constructing a lot jsf pages, hoping to find a hint about where the failure comes from, the last idea I had, was debugging through the jsf-impl and glassfish <img src='http://www.dirkreske.de/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>And there it was: Glassfish chunks the output stream, where each chunk is commited separately. And it looks for me, as if the ELFlash implementation &#8220;thinks&#8221;, that the complete output is commited after the first chunk was commited, so it gives the message. (while debugging the first chunk was commited after writing the text of an h:outputText component)</p>
<p>The (for me) 100% working solution, was to disable chunking in the glassfish config. This can be done in the admin console via Configuration -&gt; [server-config] -&gt; Network Config -&gt; Protocols -&gt; http-listener-x.</p>
<p>If this is really correct, it also explains, why it was so hard to build a minimal project to reproduce it. If you have a xhtml file blown up with richfaces/icefaces code and ran into the issue, you&#8217;ve removed the must from this code to target the problem. And after it works, it seems to be clear, that richfaces/icefaces is the evil part. But by removing nearly the whole code, the file was simply to small to cut it into chunks.</p>
<p>Perhaps this will help you too <img src='http://www.dirkreske.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Greets from germany<br />
Dirk</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/jsf1095-with-glassfish-3-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate different validation groups depending on clicked button</title>
		<link>http://www.dirkreske.de/button-based-bean-validation/</link>
		<comments>http://www.dirkreske.de/button-based-bean-validation/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 21:00:12 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[bean validation]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jsf]]></category>
		<category><![CDATA[jsf 2]]></category>
		<category><![CDATA[jsr 303]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=305</guid>
		<description><![CDATA[One of the new features intruduced with JSF 2 is JSR-303 aka. Bean Validation. With bean validation the input&#8217;s are validated against built-in or user defined annotations, placed on the fields, methods or classes. I&#8217;m often in the situation, where I have to validate different values in the same form, depending on what action should &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/button-based-bean-validation/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>One of the new features intruduced with JSF 2 is JSR-303 aka. Bean Validation. With bean validation the input&#8217;s are validated against built-in or user defined annotations, placed on the fields, methods or classes.</p>
<p>I&#8217;m often in the situation, where I have to validate different values in the same form, depending on what action should be executed. After a lot google&#8217;ing and researching, I&#8217;ve found the following, pretty easy solution.</p>
<p>Imagine, you have the following managed bean, with the two fields <em>firstname </em>and <em>lastname</em> and a bunch of actions for doing some usefull stuff. But for some obvious reasons one of the actions needs only <em>firstname </em>to be validated, but another action needs <em>firstname </em>and <em>lastname </em>to be validated.</p>
<p>For doing this, we first need the placeholder interfaces for building the two validation groups. I use <em>validate.Both</em> and <em>validate.FirstnameOnly</em> here.</p>
<pre>
<div class="codecolorer-container java 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 /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">@ManagedBean<br />
@ViewScoped<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestBean <span style="color: #000000; font-weight: bold;">implements</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aserializable+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Serializable</span></a> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; @NotNull<span style="color: #009900;">&#40;</span>groups <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>Both.<span style="color: #000000; font-weight: bold;">class</span>, FirstnameOnly.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;First name must not be empy&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> firstname<span style="color: #339933;">;</span><br />
<br />
&nbsp; @NotNull<span style="color: #009900;">&#40;</span>groups <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>Both.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;message <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Last name must not be empy&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> lastname<span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
</pre>
<p>Now lets see how to trigger the different validation groups using different commandButtons (or commandLinks, &#8230;).<br /> For getting things work, we just add a<em> f:param</em> tag to the commandButtons and assign the full qualified class name of the validation group placeholder interface (If you want more than one, just separate it by comma) to a request parameter (<em>GROUPS</em> in my case).</p>
<p>Now you simply have to attach this value to the <em>validationGroups </em>attribute of the<em> f:validateBean</em> 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 />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<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;h:form&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;h:messages<span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;h:panelGrid columns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:outputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;First name&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:inputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.firstname}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;f:validateBean validationGroups<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{param['GROUPS']}&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:inputText&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:outputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Last name&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:inputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.lastname}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;f:validateBean validationGroups<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{param['GROUPS']}&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:inputText&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:panelGrid&gt;</span><br />
<br />
&nbsp; <span style="color: #009900;">&lt;h:commandButton <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;First and last name&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.someAction}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;f:param <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;GROUPS&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;validate.Both&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:commandButton&gt;</span><br />
<br />
&nbsp; <span style="color: #009900;">&lt;h:commandButton <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;First name only&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.someAction}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;f:param <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;GROUPS&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;validate.FirstnameOnly&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:commandButton&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:form&gt;</span></div></td></tr></tbody></table></div>
</pre>
<p>If you press the first commandLink now, both fields are validated, and if you press the second, only the first name gets validated.</p>
<p>In simpler cases (also if the current case is really simple), where you just want to exclude some fields from validation, just use the same method for disabling the appropriate validators. This can be done by setting the <em>disabled </em>attribute of the<em> f:validateBean</em> tag using the<em> f:param</em> 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 />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<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;h:form&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;h:messages<span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;h:panelGrid columns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:outputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;First name&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:inputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.firstname}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;f:validateBean <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:inputText&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:outputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Last name&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;h:inputText <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.lastname}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;f:validateBean <span style="color: #000066;">disabled</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{param['FIRSTNAME_ONLY']}&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:inputText&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:panelGrid&gt;</span><br />
<br />
&nbsp; <span style="color: #009900;">&lt;h:commandButton <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;First and last name&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.someAction}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;f:param <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;FIRSTNAME_ONLY&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:commandButton&gt;</span><br />
<br />
&nbsp; <span style="color: #009900;">&lt;h:commandButton <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;First name only&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#{testBean.someAction}&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;f:param <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;FIRSTNAME_ONLY&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:commandButton&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>h:form&gt;</span></div></td></tr></tbody></table></div>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/button-based-bean-validation/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<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>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>
		<item>
		<title>PathFinder</title>
		<link>http://www.dirkreske.de/pathfinder/</link>
		<comments>http://www.dirkreske.de/pathfinder/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 16:31:04 +0000</pubDate>
		<dc:creator>Dirk Reske</dc:creator>
				<category><![CDATA[Project References]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[shortest path]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://www.dirkreske.de/?p=15</guid>
		<description><![CDATA[PathFinder is an application for visualizing path finding algorithms written in by Armin and me. The source code of pathfinder was published at sourceforge.net (project page). The application can visualize the whole calculation of the implemented path finding algorithms. These algorithms are: A* Depth first Breadth first Hill climbing Beam search British museum Branch and &#8230; </p><p><a class="more-link block-button" href="http://www.dirkreske.de/pathfinder/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>PathFinder is an application for visualizing path finding algorithms written in by <a href="http://armin.widegreen.de/" target="_blank">Armin </a>and me.</p>
<p>The source code of pathfinder was published at sourceforge.net (<a href="https://sourceforge.net/projects/jpathfinder/" target="_blank">project page</a>).</p>
<p><a href="http://www.dirkreske.de/wp-content/uploads/2009/10/pathfinder.jpg"><img class="alignnone size-full wp-image-60" title="pathfinder" src="http://www.dirkreske.de/wp-content/uploads/2009/10/pathfinder.jpg" alt="" width="522" height="312" /></a></p>
<p>The application can visualize the whole calculation of the implemented path finding algorithms.<br />
These algorithms are:</p>
<ul>
<li>A*</li>
<li>Depth first</li>
<li>Breadth first</li>
<li>Hill climbing</li>
<li>Beam search</li>
<li>British museum</li>
<li>Branch and bound</li>
<li>Dijkstra</li>
<li>Depth limited</li>
<li>Great deluge</li>
</ul>
<p>Because of a very generic and abstract application design it is very simple to add new algorithms to the repository.</p>
<p>The core data model of PathFinder is a more or less simple graph (nodes connected by edges), that can be overlayed by an image for better visualization (e.g. a map like in the upper picture).<br />
The algorithms try to find a path from a start node to a destination nodes. Depending on the choosen algorithm this path should be the shortest path or just one path. Using the build in graph editor (picture below), the user is able to simply create own graphs.</p>
<p><a href="http://www.dirkreske.de/wp-content/uploads/2009/10/grapheditor.jpg"><img class="alignnone size-full wp-image-59" title="grapheditor" src="http://www.dirkreske.de/wp-content/uploads/2009/10/grapheditor.jpg" alt="" width="499" height="274" /></a></p>
<p>The most of these algorithms can be heavily parameterized to control the way the algorithm works.<br />
While working, the algorithm notifies the application about each calculation step. So, after the algorithm completes, the user is able to re-run the calculation in every speed or just step by step.<br />
This is great for understandig how a algorithm works or to look for weaknesses in a new algorithm.</p>
<p>After a calculation completes, also some statistics are stored in a history.<br />
Some of these values are:</p>
<ul>
<li>Time for calculation</li>
<li>Steps in the graph model</li>
<li>Length of the path (and the air distance between start and destination for comparison)</li>
<li>Count of backtracking nodes (this are nodes visited by the algorithm for calculation but not used in the path)</li>
<li>The parameters given to the algorithm</li>
</ul>
<p>Using the history, it is possible to compare differend algorithms or different parameters with each other.<br />
Therefore the pure statistic values can be compared, or the paths can be viewed together on the same graph. So it is very easy to see the differences of algorithms or the impacts of parameters.</p>
<p>The application is written completely in Java (1.6 standard edition) and was part of a projekt at our university.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dirkreske.de/pathfinder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

