<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8794747970423099262</id><updated>2011-11-10T11:48:16.208-08:00</updated><category term='linux'/><category term='Windows XP'/><category term='deamon'/><category term='JBoss'/><category term='java'/><category term='best practice'/><category term='patterns'/><category term='ajax'/><category term='html'/><category term='Springframework'/><category term='XML'/><category term='tomcat'/><category term='testing'/><category term='Windows'/><category term='J2EE'/><category term='postgreSQL'/><title type='text'>Salomo's Blog spot</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-7498111612750333738</id><published>2011-11-10T11:31:00.000-08:00</published><updated>2011-11-10T11:48:16.248-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Springframework'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Tomcat behind Apache HTTP server using Spring Security</title><content type='html'>Since I have been struggling with applications not working properly behind Apache HTTP server that use Spring Security I dedicated this blog to this issue.&lt;br /&gt;&lt;br /&gt;When you develop an application using Spring security this works fine when just running on a Tomcat server e.g. http://localhost:8080/app-context/. The problems start when you want to setup your environment properly by adding an Apache HTTP server in front of it using proxy AJP. You would start by adding the following to your apache config file:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ProxyPass /app-context/ ajp://localhost:8009/app-context/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This works fine when trying to go to http://servername/app-context/ but when you try to login you will be redirected back to the login page everytime. To avoid this behavior you need to add the following line to your Apache configuration:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ProxyPass /app-context/j_spring_security_check ajp://localhost:8009/app-context/j_spring_security_check&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;For some reason it doesn't work without this line which seems weird to me since you basically map the context and everything that comes after it with the previous line. After trying a lot of options I just tried adding this and this seemed to work. I discovered that when I was logging in (using firebug) that it couldn't find the path /app-context/j_spring_security_check so I tried adding it and it finally worked :-).&lt;br /&gt;&lt;br /&gt;There is still one thing left to do though since you also want to be able to logout you have to add the following line too:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ProxyPass /app-context/j_spring_security_check ajp://localhost:8009/app-context/j_spring_security_logout&lt;br /&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-7498111612750333738?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/7498111612750333738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2011/11/tomcat-behind-apache-http-server-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/7498111612750333738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/7498111612750333738'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2011/11/tomcat-behind-apache-http-server-using.html' title='Tomcat behind Apache HTTP server using Spring Security'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-6483824225776913175</id><published>2011-07-27T09:23:00.000-07:00</published><updated>2011-07-27T09:35:41.221-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='deamon'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Configure Tomcat as a deamon on Linux</title><content type='html'>Since I keep on forgetting how to do this I decided to put this on my blog to make it easier for me and other people that have the same issue as me. It's pretty simple actually but yesterday I caught myself forgetting how it needs to be done. Basically you need to follow to following steps to successfully.&lt;br /&gt;&lt;br /&gt;Step 1 - Creating startup deamon file&lt;br /&gt;&lt;br /&gt;You can take the following file and adjust it accordingly. You have to create this file in /etc/init.d/.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;#Jenkins startup script&lt;br /&gt;#!/bin/sh -e&lt;br /&gt;#Jenkins startup script&lt;br /&gt;#chkconfig: 2345 80 05&lt;br /&gt;#description: Jenkins CI&lt;br /&gt;&lt;br /&gt;# Define some variables&lt;br /&gt;# Name of app&lt;br /&gt;APP=Jenkins&lt;br /&gt;# Name of the user to run as&lt;br /&gt;USER=tomcat&lt;br /&gt;# Location of application's bin directory&lt;br /&gt;BASE=/var/tomcat/instances/jenkins&lt;br /&gt;# Location of Java JDK&lt;br /&gt;export JAVA_HOME=/opt/java/jdk1.6.0_11&lt;br /&gt;&lt;br /&gt;case "$1" in&lt;br /&gt;  # Start command&lt;br /&gt;  start)&lt;br /&gt;    echo "Starting $APP"&lt;br /&gt;    /bin/su -m $USER -c "cd $BASE/logs &amp;&amp; $BASE/bin/startup.sh &amp;&gt; /dev/null"&lt;br /&gt;    ;;&lt;br /&gt;  # Stop command&lt;br /&gt;  stop)&lt;br /&gt;    echo "Stopping $APP"&lt;br /&gt;    /bin/su -m $USER -c "$BASE/bin/shutdown.sh &amp;&gt; /dev/null"&lt;br /&gt;    echo "$APP stopped successfully"&lt;br /&gt;    ;;&lt;br /&gt;   # Restart command&lt;br /&gt;   restart)&lt;br /&gt;        $0 stop&lt;br /&gt;        sleep 5&lt;br /&gt;        $0 start&lt;br /&gt;        ;;&lt;br /&gt;  *)&lt;br /&gt;    echo "Usage: /etc/init.d/$APP {start|restart|stop}"&lt;br /&gt;    exit 1&lt;br /&gt;    ;;&lt;br /&gt;esac&lt;br /&gt;&lt;br /&gt;exit 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Step 2 - Register your deamon&lt;br /&gt;&lt;br /&gt;To register your deamon you can use chkconfig. This will make sure your deamon will be started up on boot and enables you to use the following command to start and stop your tomcat instance.&lt;br /&gt;&lt;br /&gt;To start:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;service jenkins start&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To stop:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;service jenkins stop&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To do the magic you should execute the following command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;chkconfig jenkins --add&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now your done :-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-6483824225776913175?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/6483824225776913175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2011/07/configure-tomcat-as-deamon-on-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/6483824225776913175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/6483824225776913175'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2011/07/configure-tomcat-as-deamon-on-linux.html' title='Configure Tomcat as a deamon on Linux'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-8175834201022787962</id><published>2009-04-27T06:46:00.000-07:00</published><updated>2009-04-27T06:54:16.714-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Cargo-itest extended</title><content type='html'>I have been doing some work on the cargo-itest project and extended it with the following features:&lt;br /&gt;- JOnas support&lt;br /&gt;- Jetty support&lt;br /&gt;- Auto detection of configuration files for JBoss&lt;br /&gt;- Extended logging information to be able to detect problems in an easier way&lt;br /&gt;&lt;br /&gt;These changes will be in the next release 1.2.0.&lt;br /&gt;&lt;br /&gt;The auto detection is a nice one since it automatically picks up .properties files and -ds.xml (Data source files) from a preconfigured location so you don't have to copy them selves to the correct location. :-)&lt;br /&gt;&lt;br /&gt;In the future we will try to implement configuration by annotation since some users prefer doing configuration through annotation instead of an XML file. In this case a Spring context file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-8175834201022787962?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/8175834201022787962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/04/cargo-itest-extended.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/8175834201022787962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/8175834201022787962'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/04/cargo-itest-extended.html' title='Cargo-itest extended'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-4161222526354684122</id><published>2009-02-24T06:14:00.000-08:00</published><updated>2009-02-24T06:15:40.477-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Disk Defragmenter Could not start</title><content type='html'>Anyone getting the "Disk Defragmenter Could not start" message and on Windows XP this is what worked for me.&lt;br /&gt;&lt;br /&gt;Go to Control Panel, Select System and select the Advance Tab. Now Select Settings Under Performance and again select the advance tab. Under Virtual Memory select Change. Make sure that the Paging File Size for selected Drive for the Drive partition you want to Defrag has either a custom at least 2 times the amount of installed RAM if the space is available or is set to System Managed Size. &lt;br /&gt;&lt;br /&gt;Once I did this Defrag started working again. I don't know how the Page file got turned off on my system but this has been driving me mad for months!! Hope it helps someone else out there !!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-4161222526354684122?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/4161222526354684122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/anyone-getting-disk-defragmenter-could.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/4161222526354684122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/4161222526354684122'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/anyone-getting-disk-defragmenter-could.html' title='Disk Defragmenter Could not start'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-670267357510131097</id><published>2009-02-18T01:05:00.000-08:00</published><updated>2009-02-18T01:19:17.408-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Shared configuration on Tomcat 6</title><content type='html'>In Tomcat 5 there was the famous ${catalina.home}/shared/classes which you could use for sharing class files, properties files etc. Tomcat 6 by default doesn't come with this directory. In a first glance it seems that you can't do it anymore :-(.. But that's not true :-)..&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You need to configure Tomcat to point to a directory which you want to be shared location so applications can pick up resources from the classpath. The configuration is very simple. Just go to ${catalina.home}/conf and open catalina.properties. Add the path to the &lt;span class="Apple-style-span" style="font-style: italic;"&gt;shared.loader &lt;/span&gt;property. It will look something like this:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;div&gt;#&lt;/div&gt;&lt;div&gt;# List of comma-separated paths defining the contents of the "shared" &lt;/div&gt;&lt;div&gt;# classloader. Prefixes should be used to define what is the repository type.&lt;/div&gt;&lt;div&gt;# Path may be relative to the CATALINA_BASE path or absolute. If left as blank,&lt;/div&gt;&lt;div&gt;# the "common" loader will be used as Catalina's "shared" loader.&lt;/div&gt;&lt;div&gt;# Examples:&lt;/div&gt;&lt;div&gt;#     "foo": Add this folder as a class repository&lt;/div&gt;&lt;div&gt;#     "foo/*.jar": Add all the JARs of the specified folder as class &lt;/div&gt;&lt;div&gt;#                  repositories&lt;/div&gt;&lt;div&gt;#     "foo/bar.jar": Add bar.jar as a class repository &lt;/div&gt;&lt;div&gt;# Please note that for single jars, e.g. bar.jar, you need the URL form&lt;/div&gt;&lt;div&gt;# starting with file:.&lt;/div&gt;&lt;div&gt;shared.loader=${catalina.home}/shared/classes&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This can be very usefull when you want to share configuration between several web applications or even just to decouple the configuration from your web application in an easy way. Using this makes it easier to have a platform independent configuration without creating separate artifacts for every platform. :-)&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-670267357510131097?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/670267357510131097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/shared-configuration-on-tomcat-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/670267357510131097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/670267357510131097'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/shared-configuration-on-tomcat-6.html' title='Shared configuration on Tomcat 6'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-5746313319338469850</id><published>2009-02-17T03:44:00.000-08:00</published><updated>2009-02-17T04:30:39.899-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><title type='text'>Fastest XML parser</title><content type='html'>In most applications you need to do some XML parsing to either provide XML to external systems or parse XML from external systems or of course both. Since the systems I work on use a lot of XML and they need to be as fast as possible I did some tests on several XML parsers. I tested the following parsers/XML frameworks:&lt;div&gt;&lt;ol&gt;&lt;li&gt;JDom&lt;/li&gt;&lt;li&gt;Piccolo&lt;/li&gt;&lt;li&gt;StaxMate&lt;/li&gt;&lt;li&gt;XStream&lt;/li&gt;&lt;li&gt;JAXB 2.1&lt;/li&gt;&lt;/ol&gt;All parsers were tested in isolation with the following parameters:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;25 threads running simultaniously&lt;/li&gt;&lt;li&gt;Every thread calls the parser 100 times&lt;/li&gt;&lt;/ol&gt;The results are as follows.&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;JDom&lt;br /&gt;Avg. parsing time: &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;325.24 ms&lt;br /&gt;Avg. memory usage: &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;307 KB&lt;/li&gt;&lt;li&gt;Piccolo&lt;br /&gt;Avg. parsing time:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;88.08 ms&lt;br /&gt;Avg. memory usage:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;454 KB&lt;/li&gt;&lt;li&gt;StaxMate&lt;br /&gt;Avg. parsing time:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;96.16 ms&lt;br /&gt;Avg. memory usage:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;203 KB&lt;/li&gt;&lt;li&gt;XStream&lt;br /&gt;Avg. parsing time:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;77.04 ms&lt;br /&gt;Avg. memory usage:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;319 KB&lt;/li&gt;&lt;li&gt;Jaxb 2.1&lt;br /&gt;Avg. parsing time:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;1778.12 ms&lt;br /&gt;Avg. memory usage:&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;618 KB&lt;/li&gt;&lt;/ol&gt;As you can see XStream is the fastest one of them all. The total ranking of the parsers you can find below:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;XStream&lt;/li&gt;&lt;li&gt;Piccolo&lt;/li&gt;&lt;li&gt;StaxMate&lt;/li&gt;&lt;li&gt;JDom&lt;/li&gt;&lt;li&gt;JAXB 2.1&lt;/li&gt;&lt;/ol&gt;As you can see StaxMate has the smallest memory footprint. The total ranking of the parser you can find below:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;StaxMate&lt;/li&gt;&lt;li&gt;JDom&lt;/li&gt;&lt;li&gt;XStream&lt;/li&gt;&lt;li&gt;Piccolo&lt;/li&gt;&lt;li&gt;JAXB 2.1&lt;/li&gt;&lt;/ol&gt;If you take the ovarall pro's and con's XStream comes out as the best choice as it comes to:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Speed&lt;/li&gt;&lt;li&gt;Memory footprint&lt;/li&gt;&lt;li&gt;Ease of use&lt;/li&gt;&lt;/ol&gt;JDom has a remarkably low memory footprint but this is because the test was done with a single XML file which wasn't that big so when the XML file will grow the memory footprint will drastically grow with JDom since it loads everything in memory to construct the full document.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;JAXB is dissapointingly slow and has a huge memory footprint. The ease of use was a big plus though but if you compare it to XStream it's almost the same. XStream also provides annotations to easily map XML to Java objects. And it performs much better.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Piccolo was a bit slower than XStream but there is a significant difference in the memory footprint but also in the ease of use. When using Piccolo you need to implement a lot of stuff that you actually don't use at all. Also a lot of Exceptions need to catched resulting in a lot of boiler plate code.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;StaxMate would also be a good choice but the ease of use compared to XStream or JAXB lacks a bit.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;XStream itself also has some additional features like:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;JSON support.&lt;/li&gt;&lt;li&gt;Streaming capabilities.&lt;/li&gt;&lt;li&gt;Ability to switch to other type of XML parser without changing the parsing code.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;So in general if you want fast XML parsing and an easy to use API I would recommend to use XStream. :-)&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-5746313319338469850?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/5746313319338469850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/fastest-xml-parser.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/5746313319338469850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/5746313319338469850'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/fastest-xml-parser.html' title='Fastest XML parser'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-472564107871333263</id><published>2009-02-13T11:17:00.000-08:00</published><updated>2009-02-13T11:31:12.252-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Cargo-itest continues</title><content type='html'>The 0.3 version of my cargo-itest project now also supports Tomcat. So now Tomcat users can also write integration tests with fairly little effort.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I am also extending it with an AbstractDefaultHibernateDeploymentTest which can be used to easily generate your database schema from your annotated classes. Before it wasn't possible to execute SQL scripts for test data. Now I added the functionality to enable you to execute SQL scripts before the deployment tests are run and also after. The execution of the SQL scripts will be before and after transaction so it will not be rolled back by the test case itself. Internally it uses the AbstractTransactionalJUnit4SpringContextTests but you only need to configure a list of file names in your itest-context.xml file which in turn will automatically be picked up by the test.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also added support for applications that don't use a database at all with the AbstractDefaultNoDbDeploymentTest class. In the near future I will also implement container utilies for:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Jetty&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Resin&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Jonas&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-472564107871333263?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/472564107871333263/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/cargo-itest-tomcat-support.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/472564107871333263'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/472564107871333263'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/02/cargo-itest-tomcat-support.html' title='Cargo-itest continues'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-5240054469544409264</id><published>2009-01-29T07:51:00.000-08:00</published><updated>2009-01-29T08:30:56.605-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Cargo-itest open source project</title><content type='html'>I recently started an open source project called &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;cargo-itest. &lt;/span&gt;This was started up because when I worked on several projects I needed to create integration tests for them which all had similarities. I was previously doing it with the maven2 cargo plug-in but wasn't really fond of it because it most of the times didn't work and when it worked it stopped working after editing the configuration. In other words it was very unstable. This initiated me to start to use the java API of Cargo instead of the maven plugin. By using the java API it already removes the dependency from your build system in this case Maven.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Having no dependency on the build system gives you a couple of advantages:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;You can run it in any IDE that supports JUnit.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;You can switch easily to another build system without changing your tests and test configuration.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;These are general advantages of just using the API but also part of using my open source project cargo-itest. This project enables you to easily start creating integration tests by just extending your unit test (JUnit 4.4) from a base class called AbstractDefaultDeploymentTest or AbstractDefaultHibernateDeploymentTest. These base classes provide you with out of the box functionality to start up a container and run integration tests on them. So to start up from scratch you need to do the following steps&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Extend from AbstractJBossContainerUtil&lt;/li&gt;&lt;li&gt;Create a context file called itest-context.xml in the root of the classpath&lt;/li&gt;&lt;li&gt;Configure the container utility in the itest-context.xml&lt;/li&gt;&lt;li&gt;Create your own JBoss configuration ZIP file by using the test-app.zip as template since this one already contains certain variables that are used by the AbstractJBossContainerUtil and put it on a server so the container utility can download it.&lt;/li&gt;&lt;li&gt;Put JBoss on a server in a ZIP file also so the container utility can download it.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;After these steps your container utility should be setup correctly and all is left is to create a unit test that either extends from the default tests that are supplied in the project or create your own test and start the container yourself.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are fully functional examples in the SVN repository which can be found here:&lt;/div&gt;&lt;div&gt;&lt;a href="http://cargo-itest.googlecode.com/svn/maven-repo/"&gt;http://cargo-itest.googlecode.com/svn/maven-repo/&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now there is only a JBossContainer utility available since I worked a lot with JBoss but in the near future I am planning to extend it with Tomcat and Jetty and maybe in the future some other utility containers. The important part is that you can actually do it yourself if you like in an easy way without influencing your tests.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So the overal benefits for using this projects are:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Without extensive knowledge of the cargo API you can start creating integration tests with fairly little effort.&lt;/li&gt;&lt;li&gt;You can create your own container utility if the container you are using is not supported yet.&lt;/li&gt;&lt;li&gt;You are not stuck to a build system so you can easily switch build systems without changing your tests&lt;/li&gt;&lt;li&gt;You can run the tests within your IDE which will speed up the development&lt;/li&gt;&lt;li&gt;It's open source so you can extend it in any way you like :-)&lt;/li&gt;&lt;/ol&gt;The project itself is hosted on Google code on this location:&lt;/div&gt;&lt;div&gt;&lt;a href="http://cargo-itest.googlecode.com/"&gt;http://cargo-itest.googlecode.com/&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-5240054469544409264?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/5240054469544409264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/cargo-itest-open-source-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/5240054469544409264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/5240054469544409264'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/cargo-itest-open-source-project.html' title='Cargo-itest open source project'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-5881393952120156868</id><published>2009-01-29T07:17:00.000-08:00</published><updated>2009-01-29T13:22:54.144-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Specify context name in Tomcat</title><content type='html'>When developing web applications that are distributed as WAR files running in Tomcat most of the times you want to be able to specify the context name to a nicer name than Tomcat provides by default. Which is the name of the WAR file itself. When i.e. you are keeping the version within the name of the WAR this will result in some weird name like myapp-1.2. This is most of the times not what you want.&lt;br /&gt;&lt;br /&gt;Most of the times you want a nice context name like myapp without the version in it. According to the Tomcat documentation you can do it in 3 ways:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Edit the server.xml&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Add a context.xml to the $CATALINA_HOME/conf/Catalina/localhost with the name of your context.&lt;/li&gt;&lt;li&gt;Add a context.xml to your META-INF directory in your WAR file&lt;/li&gt;&lt;/ol&gt;The first two options just work fine only the last one doesn't do the job for you for some reason.&lt;br /&gt;&lt;br /&gt;Personally the second option is the best option since it's not intrusive to your application and also not to Tomcat since you leave the server.xml alone. This way you define the context name in a separate configuration file and enables you to also keep the environment specific configuration out of the application. You can than simply provide this configuration file in a distribution package for installation. Another benefit is that you provide yourself with more flexibility since you can easily switch to EAR file distribution when running on an application server. On an application server you define your context within your EAR file which will only effect your distribution project and not your application.&lt;br /&gt;&lt;br /&gt;So why would you put a context.xml in your META-INF directory in your WAR file? Well it can be useful if you just want to expose some application specific JNDI resources for your application.&lt;br /&gt;&lt;br /&gt;So how can I achieve this? Here is a link to the Tomcat documentation where you can find out what exactly you should do to achieve this.&lt;br /&gt;&lt;a href="http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html"&gt;http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-5881393952120156868?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/5881393952120156868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/specify-context-name-in-tomcat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/5881393952120156868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/5881393952120156868'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/specify-context-name-in-tomcat.html' title='Specify context name in Tomcat'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-4952320819557071222</id><published>2008-11-27T06:56:00.000-08:00</published><updated>2009-01-07T10:27:15.208-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='postgreSQL'/><title type='text'>Setup Postgres on Fedora Linux 10</title><content type='html'>&lt;p&gt;Installing PostgreSQL on Fedora Linux 10 is pretty straight forward. You need to follow the following steps:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;#1 Initialize postgres&lt;br /&gt;initdb /var/lib/pgsql/data&lt;br /&gt;&lt;br /&gt;#2 Add the following line to pg_hba.conf:&lt;br /&gt;local all all trust&lt;br /&gt;&lt;br /&gt;#3 Switch to postgres user&lt;br /&gt;su postgres&lt;br /&gt;&lt;br /&gt;#4 Connect to PostgreSQL&lt;br /&gt;psql -d template1&lt;br /&gt;&lt;br /&gt;#5 Change password&lt;br /&gt;ALTER USER postgres WITH PASSWORD 'this_is_my_password';&lt;br /&gt;&lt;br /&gt;#6 Remove line from step 2&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-4952320819557071222?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/4952320819557071222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/setup-postgres-on-fedora-linux-10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/4952320819557071222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/4952320819557071222'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/setup-postgres-on-fedora-linux-10.html' title='Setup Postgres on Fedora Linux 10'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-7340089328263588097</id><published>2008-09-25T06:53:00.000-07:00</published><updated>2009-01-07T06:55:25.274-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='tomcat'/><title type='text'>Enabling GZIP compression on Tomcat</title><content type='html'>&lt;p&gt;Enabling GZIP compression for your web application is a good way to accelerate your web site. This can reduce the size of data being transferred and, consequently, speed your application.&lt;/p&gt; &lt;p&gt;Enabling compression on the web server will make data be transferred in compressed form. The browser will decompress the data on the fly, making the application faster. If your application uses Ajax, what usually increases the volume of data transferred from server to client, compression of data will significantly improve your application performance.&lt;/p&gt; &lt;p&gt;Here is how to enable GZIP compression on Tomcat: edit file /conf/server.xml and add to the HTTP Connector configuration something like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;        compression="on"&lt;br /&gt;        compressionMinSize="2048"&lt;br /&gt;        noCompressionUserAgents="gozilla, traviata"&lt;br /&gt;        compressableMimeType="text/html,text/xml"&lt;br /&gt;&lt;/code&gt;&lt;/p&gt; An example of a HTTP Connector configuration with compression enabled could be:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;      Connector port="8080" maxHttpHeaderSize="8192"&lt;br /&gt;              maxThreads="150" minSpareThreads="25" maxSpareThreads="75"&lt;br /&gt;              enableLookups="false" redirectPort="8443" acceptCount="100"&lt;br /&gt;              connectionTimeout="20000" disableUploadTimeout="true"&lt;br /&gt;              compression="on"&lt;br /&gt;        compressionMinSize="2048"&lt;br /&gt;        noCompressionUserAgents="gozilla, traviata"&lt;br /&gt;        compressableMimeType="text/html,text/xml"&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-7340089328263588097?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/7340089328263588097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/enabling-gzip-compression-on-tomcat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/7340089328263588097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/7340089328263588097'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2009/01/enabling-gzip-compression-on-tomcat.html' title='Enabling GZIP compression on Tomcat'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-9154624896274711256</id><published>2008-09-08T06:52:00.000-07:00</published><updated>2009-01-07T06:53:14.343-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><title type='text'>How to install Java in Fedora Core</title><content type='html'>&lt;p&gt;By default, Fedora Core 6 systems come with an old Java software installed, so you need to install a newer version of Java Runtime Environment to enjoy all the Java applications out there. In this quick guide, I will teach you how to update/install your Java Environment.&lt;/p&gt; &lt;p&gt;Let's begin by downloading the latest version of JRE (Java Runtime Environment) from here. Just click on the Download link where it says Java Runtime Environment (JRE) 5.0 Update, then you'll need to accept the license and download the Linux self-extracting file.&lt;/p&gt; &lt;p&gt;WARNING: Please remember to always replace the xx from the jre-1_5_0_xx-linux-i586.bin file with the latest version. At the moment of this guide's writing, the latest version was 09, so the file should look like this: jre-1_5_0_09-linux-i586.bin&lt;/p&gt; &lt;p&gt;After you have finished downloading the file, you need to move it into the /opt folder. Open a console and type:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;mv jre-1_5_0_xx-linux-i586.bin /opt&lt;br /&gt;&lt;/code&gt;&lt;/p&gt; &lt;p&gt;Now, you will need to make this file executable so you can extract it. Follow the commands below:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;cd /opt - so you can go into the /opt directory&lt;br /&gt;chmod x jre-1_5_0_xx-linux-i586.bin&lt;br /&gt;&lt;/code&gt;&lt;/p&gt; &lt;p&gt;And now, let's run the executable file with the following command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;./jre-1_5_0_xx-linux-i586.bin&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You'll be prompted with the License Agreement, hit space until you are asked if you agree or not. Type Yes and the extraction process will begin. After the extraction process is finished, just remove the binary file with the following command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;rm -rf jre-1_5_0_xx-linux-i586.bin&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now, let's put the Java plugin into your browser's plugin folder. Konqueror, Firefox and Mozilla browsers will all look into the same folder, for plugins. So type the following command:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ln -s /opt/jre1.5.0_xx/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Well, now you need to make the Java executable available for the whole system, so you can run all the Java applications you encounter. Create the following file with your preferred text editor:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;kwrite /etc/profile.d/java.sh&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now paste the following options into the file, remember to enter a carriage return after these lines, then save it. Remember to replace the xx with the latest version you have downloaded:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;export J2RE_HOME=/opt/jre1.5.0_xx&lt;br /&gt;export PATH=$J2RE_HOME/bin:$PATH&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Now, type the following command to make that file available:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;source /etc/profile.d/java.sh&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Then type this command to see if the path is correct:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;which java&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;You will see something like this: /opt/jre1.5.0_09/bin/java&lt;/p&gt; &lt;p&gt;Then type these commands:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.5.0_xx/bin/java 2&lt;br /&gt;/usr/sbin/alternatives --config java&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;After you have entered the last command, you'll be asked to choose which Java software you want for your system. Just press 2 key and hit enter.&lt;/p&gt; And finally, just type this command to see if everything looks good and your system has a new Java Environment:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/usr/sbin/alternatives --display java&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;And you can also type this command to see the version of your Java Runtime Environment:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;java -version&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Mine looks like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;java version "1.5.0_09"&lt;br /&gt;Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01)&lt;br /&gt;Java HotSpot(TM) Client VM (build 1.5.0_09-b01, mixed mode, sharing)&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-9154624896274711256?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/9154624896274711256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/09/how-to-install-java-in-fedora-core.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/9154624896274711256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/9154624896274711256'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/09/how-to-install-java-in-fedora-core.html' title='How to install Java in Fedora Core'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-1673831025790957975</id><published>2008-08-01T06:51:00.000-07:00</published><updated>2009-01-07T06:52:04.786-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Opening a PDF file in a Java Application</title><content type='html'>&lt;div class="content clear-block"&gt;     &lt;p&gt;PDF is a very common used file format for documents so quite often you need to develop applications that work with them. In Java it's fairly easy to open a PDF document using the runtime executer. Below you find a code snippet that does the job.&lt;/p&gt; &lt;p&gt;&lt;code&gt;&lt;br /&gt;Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + file);&lt;br /&gt;&lt;/code&gt;&lt;/p&gt; &lt;p&gt;This peace of code let's Windows deside what application to use to open the PDF file which is quite cool since most of the time you don't know what application users use to open PDF files. :-)&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-1673831025790957975?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/1673831025790957975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/08/opening-pdf-file-in-java-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/1673831025790957975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/1673831025790957975'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/08/opening-pdf-file-in-java-application.html' title='Opening a PDF file in a Java Application'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-7044643345777330236</id><published>2008-07-24T14:00:00.000-07:00</published><updated>2009-01-07T06:50:58.291-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='J2EE'/><category scheme='http://www.blogger.com/atom/ns#' term='JBoss'/><title type='text'>Remotely debugging JBoss</title><content type='html'>&lt;div class="content clear-block"&gt;     &lt;p&gt;When working with JBoss sometimes it's needed to debug your code while running instead of running your application in a lightweight servlet container like Jetty or Tomcat. This can be done by adding the following line to your run.bat or run.sh:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044&lt;br /&gt;&lt;/code&gt;&lt;/p&gt; &lt;p&gt;You need to add this to your JAVA_OPTS variable so it will be used when JBoss starts up. When starting up now you can attach a debugger i.e. in Eclipse to the port you specified. :-)&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-7044643345777330236?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/7044643345777330236/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/07/remotely-debugging-jboss.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/7044643345777330236'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/7044643345777330236'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/07/remotely-debugging-jboss.html' title='Remotely debugging JBoss'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-3196435528167799906</id><published>2008-07-23T22:00:00.000-07:00</published><updated>2009-01-07T06:49:21.439-08:00</updated><title type='text'>Hibernate LazyInitializationException</title><content type='html'>&lt;div class="content clear-block"&gt;     &lt;p&gt;People who use Hibernate will surely come across this irritating exception. In my whole career I have encountered this several times. Actually this problem is quite easily to fix. Let's start with when this exception can occur... Most of the time it has to do with a collection that is mapped to some objects that are lazily loaded. Lazy loading is used when you don't need the collection every time you retrieve the specific object. So i.e. you have an object called Person that can have multiple PhoneNumber objects. The objects will look something like this:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;public class Person {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;          private String name;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;          private Integer age;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;          private Set phoneNumbers;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; .....&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; }&lt;/span&gt;&lt;/code&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-style: italic;"&gt;public class PhoneNumber {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;         private String areaCode;&lt;/span&gt;&lt;a id="publishButton" class="cssButton" href="javascript:void(0)" onclick="if (this.className.indexOf(&amp;quot;ubtn-disabled&amp;quot;) == -1) {var e = document['stuffform'].publish;(e.length) ? e[0].click() : e.click(); if (window.event) window.event.cancelBubble = true; return false;}"&gt;&lt;div class="cssButtonOuter"&gt;&lt;div class="cssButtonMiddle"&gt;&lt;div class="cssButtonInner"&gt;Publish Post&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;         private String number;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;         private Person person;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; .....&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt; }&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Having mapped the collection as lazy (Hibernate3 defaults to lazy) the call to the collection will cause an LazyInitializationException when you try to call it after you retrieved in i.e. the GUI layer or in another service where you pass this object. This problem can easily be fixed by just calling the person.getPhoneNumbers() after you retrieved it with your DAO. This will cause Hibernate to retrieve the elements in the collection from the database. In the GUI now you can just use the collection to display the phone numbers i.e. So the key thing here is to initialize the collection that is lazy initialized.&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-3196435528167799906?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/3196435528167799906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/07/hibernate-lazyinitializationexception.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/3196435528167799906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/3196435528167799906'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/07/hibernate-lazyinitializationexception.html' title='Hibernate LazyInitializationException'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-4298956205245849516</id><published>2008-03-12T22:00:00.000-07:00</published><updated>2009-01-28T00:36:46.389-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><title type='text'>Testing your application</title><content type='html'>&lt;div class="content clear-block"&gt;     &lt;p&gt;Recently I finished a research about how to test an application. This was needed to have clear guidelines on how you should test your application and what kind of tools could be used for accomplishing that. The result of this research is spread out into the following paragraphs.&lt;/p&gt; &lt;br /&gt;&lt;h1&gt;What is testing?&lt;/h1&gt; &lt;p&gt;&lt;b&gt;The definition of testing&lt;/b&gt;&lt;/p&gt; &lt;p&gt;To keep it simple testing is making sure your application does what you expect it should do. This can be determined in different ways:&lt;br /&gt;- Unit isolation testing&lt;br /&gt;- Unit integration testing&lt;br /&gt;- Integration testing&lt;br /&gt;- Acceptance / functional testing&lt;/p&gt; &lt;p&gt;&lt;b&gt;Unit isolation testing&lt;/b&gt;&lt;br /&gt;Particularly useful when testing the logic of your application, like calculations etc. There shouldn’t be a lot of these kinds of tests in your code base. In other words, Mock tests.&lt;/p&gt; &lt;p&gt;&lt;i&gt;Goal&lt;/i&gt;&lt;br /&gt;The goal of this kind of test should be making sure the logic you have written doesn’t break and produces the right outcome.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Unit integration testing&lt;/b&gt;&lt;br /&gt;Used for testing your logic in its context. So only use mocks if it’s really necessary (i.e. for a web service, network resource etc.)&lt;/p&gt; &lt;p&gt;&lt;i&gt;Goal&lt;/i&gt;&lt;br /&gt;The goal of this kind of test should be making sure the logic you have written in combination with the context it is living in is producing the right out come and doesn’t brake.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Integration testing&lt;/b&gt;&lt;br /&gt;Useful for testing your whole application through all layers so you actually know that your application layers operate properly when joined together. The use of mocks should be prevented here.&lt;/p&gt; &lt;p&gt;&lt;i&gt;Goal&lt;/i&gt;&lt;br /&gt;The goal of this kind of test should be making sure the application as is working correctly when all layers are put together.&lt;/p&gt; &lt;p&gt;&lt;b&gt;Acceptance / functional testing&lt;/b&gt;&lt;br /&gt;These kinds of tests are almost the same as an integration test but more focused on the end user driving it.&lt;/p&gt; &lt;p&gt;&lt;i&gt;Goal&lt;/i&gt;&lt;br /&gt;The goal of this kind of test should be making sure all functional requirements are met.&lt;br /&gt;All these kind of tests can be done in an automated way. Of course there should be some sanity checks done during the Acceptance / functional testing. But most scenarios can be automated.&lt;/p&gt; &lt;h1&gt;How should I test?&lt;/h1&gt; &lt;p&gt;&lt;b&gt;When to use ‘Unit isolation testing’&lt;/b&gt;&lt;br /&gt;Using Unit isolation testing is useful to find out quickly where exactly the problem occurred when your tests fails. Generally these kinds of tests apply only on the service layer of your application where the logic of your application resides. Writing a mocked DAO isolation test doesn’t really make sense because writing a test for a DAO the goal is to know if the data can be retrieved from the data store as you expect it would be retrieved. Or knowing that the data put in is actually stored.&lt;/p&gt; &lt;p&gt;So in general use this one only if you have a class that has some logic that is worthy to test.&lt;/p&gt; &lt;p&gt;&lt;b&gt;When to use ‘Unit integration testing’&lt;/b&gt;&lt;br /&gt;These kinds of tests are very important because they actually test your code in the context it’s going to be used. It will test your logic with some real data preferably. Less mocks the better making it a better test because it’s actually testing your real code. Actually these kinds of tests kind off overrule the Unit isolation testing because it’s doing almost the same but closer to reality. These tests in general have more value than an isolated test because they are testing the real thing. It also lets you know when you break something in the code base. The Unit isolation testing is actually the start of these kinds of tests. I would recommend extending your isolation test into a unit integration test instead of writing a new one. But be careful with this because that doesn’t apply to all of the Unit isolation tests. It’s case specific. There is no general rule for doing this. It’s more a decision you should take when you are about to make such a test. Think about the following things:&lt;br /&gt;- How much effort does it cost me?&lt;br /&gt;- Does it give me more assurance?&lt;br /&gt;- What are the risks?&lt;br /&gt;- Do I expose too much?&lt;/p&gt; &lt;p&gt;Answering all these questions will give you a rough answer so you can decide to create a separate test or an extended one.&lt;/p&gt; &lt;p&gt;So in general this could be used when i.e. implementations of interfaces you use are available and you want to test the real thing and making sure your code base is stable.&lt;/p&gt; &lt;p&gt;&lt;b&gt;When to use ‘Integration testing’&lt;/b&gt;&lt;br /&gt;These kinds of tests should actually only be run on some continuous build server and not on your local machine to determine if you made the code base unstable. I would say that these kinds of tests are run when the application is actually running so you know that your code actually works when deployed. This is more like a live test not only testing your code but also the configuration of the application. A good example of an integration test would be testing your web services in an automated way, doing the actual web service calls exactly the way they are going to be made when your application is used in production.&lt;/p&gt; &lt;p&gt;So in general always do this to make sure your application actually still runs when you deploy it.&lt;/p&gt; &lt;p&gt;&lt;b&gt;When to use ‘Acceptance / functional testing’&lt;/b&gt;&lt;br /&gt;Actually most of these kinds of tests should be done by a separate test team. They have a more objective look on the application than the developers that worked on it. You could write some automated tests that use i.e. the GUI and write some common use cases for your application. This will cause the test team to focus on only specific things that can go wrong. It also provides you with some valuable information that use cases where you wrote tests for, actually still work and have the desired outcome.&lt;/p&gt; &lt;p&gt;So in general I see this more as an extra thing to make it all much nicer and of course you will be able to notice problem in much earlier stage. This does save time eventually and is recommended.&lt;/p&gt; &lt;h1&gt;Which tools to use for testing&lt;/h1&gt; &lt;p&gt;For writing tests in general people use JUnit. When using the Springframework note that this framework also provides some handy classes to use as your base class for testing. And of course the famous EasyMock is used a lot for creating mock objects in an easy way. Actually there isn’t much to tell about the ‘normal’ testing of your code if it comes to tools.&lt;/p&gt; &lt;p&gt;When it comes to integration testing there are some tools you could use:&lt;br /&gt;- Selenium&lt;br /&gt;- Cargo&lt;br /&gt;- JMeter&lt;br /&gt;- MultiThreadedTC&lt;/p&gt; &lt;p&gt;&lt;b&gt;Selenium&lt;/b&gt;&lt;br /&gt;This tool is for automated GUI tests. You can record your actions in your browser and create a JUnit test from it and alter it accordingly.&lt;/p&gt; &lt;p&gt;Website:&lt;br /&gt;&lt;a href="http://selenium.openqa.org/" title="http://selenium.openqa.org/"&gt;http://selenium.openqa.org/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;Cargo&lt;/b&gt;&lt;br /&gt;To be able to start-up an application server in your tests you can use this tool for the job. You can start-up your application server and deploy your application and run test on it. This can be included in your automated build environment so you know your application actually still works correctly when you plan to deploy it.&lt;/p&gt; &lt;p&gt;Website:&lt;br /&gt;&lt;a href="http://cargo.codehaus.org/" title="http://cargo.codehaus.org/"&gt;http://cargo.codehaus.org/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;JMeter&lt;/b&gt;&lt;br /&gt;To load test your application you can use JMeter from Apache. This is something that should be run for every release actually to see if your application still performs the same.&lt;/p&gt; &lt;p&gt;Website:&lt;br /&gt;&lt;a href="http://jakarta.apache.org/jmeter/index.html" title="http://jakarta.apache.org/jmeter/index.html"&gt;http://jakarta.apache.org/jmeter/index.html&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;b&gt;MultiThreadedTC&lt;/b&gt;&lt;br /&gt;MultithreadedTC is a framework for testing concurrent applications. It features a metronome that is used to provide fine control over the sequence of activities in multiple threads.&lt;/p&gt; &lt;p&gt;Website:&lt;br /&gt;&lt;a href="http://www.cs.umd.edu/projects/PL/multithreadedtc/index.html" title="http://www.cs.umd.edu/projects/PL/multithreadedtc/index.html"&gt;http://www.cs.umd.edu/projects/PL/multithreadedtc/index.html&lt;/a&gt;&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-4298956205245849516?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/4298956205245849516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/03/testing-your-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/4298956205245849516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/4298956205245849516'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/03/testing-your-application.html' title='Testing your application'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-2322247219985412111</id><published>2008-03-12T06:43:00.000-07:00</published><updated>2009-01-29T13:25:36.470-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='best practice'/><title type='text'>Why use interfaces for your domain objects?</title><content type='html'>&lt;div class="content clear-block"&gt;     &lt;p&gt;The opinions are spread about this subject. Some people even say that it's bad practice. I don't think it's bad practice but it might seem like overkill but I'll explain what the benefits are for doing this.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you i.e. use Hibernate in your application you probably use Hibernate annotations in your POJO's. Actually domain objects mapped with annotations aren't really POJO's anymore because they have Hibernate dependencies. So if you don't use an interface for your domain object your logic will be stuck to Hibernate specific implementations of your domain objects and thus have Hibernate dependencies. Reusing your logic with some other technology i.e. IBatis will cause you to change more code than necessary if you would have had interfaces for your domain classes. This will also affects a lot of other layers where your domain objects are used. This could also been prevented by using an interface for your domain object.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;The part in the application that will change the most and most likely will be reused in the future is the Service layer. To make sure it is easy to be reused it is better to use in interface for your domain object because this way the service layer is not coupled to anything at all. Only the interfaces he is talking to. This also makes sense because services don’t need to know to what kind of implementation he is talking to. He just wants to retrieve and manipulate data without worrying about i.e. Hibernate, IBatis etc. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;If you take a look at the DAO layer and you would use an interface for your domain objects this would mean that all your DAO interfaces can be reused. If you just have an implementation your interface is stuck to that implementation so reusing it becomes difficult. If you use an interface for your domain object you enable the DAO layer to be reused in a better way and makes it easier to use different kind of persistency technologies.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Another interesting reason for using an interface for your domain object is if you want a SOA architecture and you want to run your persistence and logic on a separate server than your GUI will not be dependent on i.e. Hibernate that would be the case if you just use the implementation. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;So if you sum all these things up you should see the benefits it will bring for you. If you are saying that it will cost to much time.. that's not really true. Because if you compare the time you will save in the future to the time you spend on only creating an interface this time can even be disregarded as most IDE's have features that make maintaining interfaces very easy. So I would say.. use it.. it will pay off.&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-2322247219985412111?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/2322247219985412111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/03/why-use-interfaces-for-your-domain.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/2322247219985412111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/2322247219985412111'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/03/why-use-interfaces-for-your-domain.html' title='Why use interfaces for your domain objects?'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-8815742182343416753</id><published>2008-02-23T14:58:00.000-08:00</published><updated>2009-01-07T06:37:27.503-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>JVM Memory usage</title><content type='html'>&lt;div class="content clear-block"&gt;     &lt;p&gt;During development of a J2EE application at my current employer I came across OutOfMemoryExceptions in the permGen space. The first thing we thought was that it was a memory leak in one of the applications where it occurred. After further investigation it seemed to be that we were pushing the limits of the JVM.&lt;/p&gt; &lt;p&gt;The big problem was that we had 3 EAR files deployed on a JBoss server that by itself already uses a lot of memory. Deploying so many EAR files in 1 JBoss instance is definitely not recommended when using the default JVM configuration. If you crank up the JVM max perm gen space than it is possible to have such a configuration. But keep in mind that if you crank up the permGen space other parts of the JVM memory have less. A better solution is trying to integrate your applications if possible so the common libraries are not loaded multiple times. If this is not possible try to deploy them on separate servers or undeploy some of the default applications of JBoss to save memory.&lt;/p&gt; &lt;p&gt;So when building web applications always make sure if it's really necessary to divide them into separate EAR files. Also check your memory usage of the application before releasing it live so you can prevent such problems.&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-8815742182343416753?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/8815742182343416753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/02/during-development-of-j2ee-application.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/8815742182343416753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/8815742182343416753'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/02/during-development-of-j2ee-application.html' title='JVM Memory usage'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8794747970423099262.post-6010258769817356671</id><published>2008-01-03T18:40:00.000-08:00</published><updated>2009-02-03T05:16:24.111-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>The Google Webtoolkit</title><content type='html'>&lt;div class="content clear-block"&gt;     &lt;p&gt;Developing web applications in Java for a couple of years now the big annoyance part always was the GUI part. Making it work in every browser, implementing AJAX, etc.. AJAX is hot nowadays and when demands are rising I started looking for an easy to use AJAX framework to build a web application GUI in. I came across many frameworks like YUI (Yahoo User Interfaces), DWR in combination with spring MVC, Wicket and many more. The one that stood out the most was GWT (Google Web Toolkit). The nice thing about this framework is that you only code in Java :-). No more HTML, Javascript etc.. But if you really want to use HTML and Javascript (In some specific cases) you can, so full flexibility is available.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;How does it work than? Your package structure needs to have a package called ...client and ...server. All code that is written in the client application is compiled to javascripts and HTML files are created where needed. The javascript that is created is compliant to the most used browsers like:&lt;br /&gt;IE, Firefox, Mozilla, Safari and Opera. So no need to focus on that part anymore ;-). It's also optimized already for you so it will work as fast as possible. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;Since this framework/toolkit is component oriented and implemented very nice it's much easier to reuse components. You can actually reuse components by using JAR files :-). Another great thing is that you don't have to do a mind switch because you are still coding Java with type checking etc. So you know what you write actually works. Something that you don't have when coding javascript. As we all know it's very error prone and hard to write good quality javascript that will work in every browser. The learning curve is therefore not steep at all. Coding with GWT looks and feels like coding a regular Swing application. I think this is the real power of GWT. Creating GUI's like you are used to be doing. Even if you didn't develop in Java it's the same principal i.e. in VB, Delphi, Borland C++ etc.. It's all roughly the same unlike using Struts, JSF, Spring MVC etc. Those are frameworks using a different approach and have a steep learning curve. Actually I wonder why no one else came up with this kind of technology earlier. It would have saved us a lot of headaches. At least that is my experience. I didn't come across any other framework that is as easy as the GWT. A lot off people think it's wonderful but I think they didn't really take a good look at GWT. I used Wicket and GWT both and must say that GWT is much better implemented and saves you more time in development.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;I must say that Wicket is much better than i.e. Struts or Spring MVC but it doesn't beat GWT. GWT has more capabilities. To make your application look good and have drag &amp;amp; drop etc.. you can use i.e. GWT-ext. This way you can use the Javascript Ext components in GWT without writing javascript! :-D It looks very nice: &lt;a href="http://code.google.com/p/gwt-ext/" title="http://code.google.com/p/gwt-ext/"&gt;http://code.google.com/p/gwt-ext/&lt;/a&gt;&lt;br /&gt;So on that part you also save a lot of time because this library has a lot of controls/widgets you can use out of the box like a sortable table, calendars and many more. GWT 1.5 will support Java 5 syntax so that will be no issue anymore for the people that use Java 5. It's already available but isn't released yet.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;There are also some nice Eclipse plug-ins for GWT like the GWT Designer from instantiations. You can take a look at it here:&lt;br /&gt;&lt;a href="http://www.instantiations.com/gwtdesigner/index.html" title="http://www.instantiations.com/gwtdesigner/index.html"&gt;http://www.instantiations.com/gwtdesigner/index.html&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;I recommend this one. It doesn't cost much and saves you a lot of time creating a GUI. Just drag &amp;amp; drop your components on to the screen and voila! &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt; &lt;p&gt;So I would say invest some time in the GWT and I am sure you will like it ;-)&lt;/p&gt;   &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8794747970423099262-6010258769817356671?l=salomo-petrus.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salomo-petrus.blogspot.com/feeds/6010258769817356671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salomo-petrus.blogspot.com/2008/01/google-webtoolkit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/6010258769817356671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8794747970423099262/posts/default/6010258769817356671'/><link rel='alternate' type='text/html' href='http://salomo-petrus.blogspot.com/2008/01/google-webtoolkit.html' title='The Google Webtoolkit'/><author><name>Salomo Petrus</name><uri>http://www.blogger.com/profile/00257326279834650754</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_DOdhAdUelSk/SWXh19TXoRI/AAAAAAAAAXc/MCG30siB_qM/S220/sape.jpeg'/></author><thr:total>0</thr:total></entry></feed>
