Hobione's Weblog

Living & Breathing in Web 2.0 Era

Balsamiq Mockups

What a cool way to mock up web app.  Here is my first design that I am about to work on.

Balsamiq Mockups

To, Balsamiq team: Keep up the good work, and probably need to give a catchy name.  Balsamiq is too hard to remember.  Really like the integration approach with Atlassian product like Jira and Confluence.  Thumbs UP!


November 3, 2009 Posted by | Mockup | 2 Comments

ICEFaces 1.8.1 migration

I have recently needed for upgrade to 1.8 from 1.7.2. The main reason I needed 1.8 is because my Auto Complete pop up list would not stay. It showed up for split of second and went away. It did not give me any chance to pick one from list. It worked perfectly on Firefox but not on IE 6 or 7. Here are some steps I had to take to make it work with my existing source.

Step 1:
First, I changed the pom.xml file to 1.8.1, it should be a piece of cake but apparently it did not do a thing.


Steps I had taken to make it work:

Stopped and started the Glassfish server.  Closed and restarted MyEclipse 7.1 with -clean command but still would not work.  Here are some sample errors I was getting:

<div id=":b0">IllegalArgumentException: Illegal null argument to ObjectInputStreamWithLoader

java.lang.RuntimeException: Cant copy Serializable object: Caused by: java.lang.IllegalArgumentException: Illegal null argument to ObjectInputStreamWithLoader

[#|2009-07-28T19:59:38.107-0500|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=11;_ThreadName=pool-1-thread-2;|19:59:38,107  INFO D2DViewHandler:84 -
ICEsoft Technologies, Inc.
ICEfaces 1.7.2
 Build number: 17
Revision: 17749</div>

As you may noticed that, even though I changed the pom to ICEfaces 1.8.1 but the server console showed 1.7.2.  I should thought about the server’s cache issue but instead I did these following long steps.

I installed MyEclipse 7.5 which I meant to install it anyway and also 1.8 comes with MyEclipse 7.5.  So after install the MyEclipse 7.5, I was still getting errors.  Then, I created a brand new project using MyEclipse 7.5 and copied src, web and pom.xml to the new project.

Eeeeh, still would not work.  Finally I logged in to the admin console for Glassfish and undeployed all old 1.7.2 related project, stopped the server, restarted the server but wait, still negative.  I was getting this weird error.

java.lang.OutOfMemoryError: PermGen space</div>
I Googled it and found out that “It’s easy to reproduce this problem by reloading the context over and over again until you get an OutOfMemoryError (10 times was enough for a simple app)”.  So, I had to take a break to deploy the app and at last, it worked. Thank you my LORD.

ICEfaces rock! MyEclipse rocks!! my application rocks!!!


July 29, 2009 Posted by | GlassFish, ICEfaces, MyEclipse IDE | 1 Comment

JavaOne 2009: Day four

This is it. Last day of JavaOne or may be the last JavaOne. No body knows what’s going to happen to JavaOne under Oracle umbrella. I just hope for the best and wising to come back again right here in San Francisco. The entire general session was hosted by James Gosling. He handed Duke awards to several outstanding project team include Terracotta.org and Grameen Foundation.org etc.  The project name for Grameen Foundation is MIFOS.  I do feel connected to Grameen foundation and their effort to defeat global poverty and also support Dr. Yunus.

IMG_0117 IMG_0118 IMG_0119

Conversations and Page Flows on the Java: I took this session with Dan Allen who is the author of Seam in Action book. He talked the concept that Seam and Spring Web Flow both introduce, a conversation context whose purpose is to maintain state that pertains to a use case across a series of pages. Dan also covered,

  • The definition of a page flow
  • How page flows are developed in Seam
  • How page flows are developed in Spring Web Flow
  • Seam’s ad hoc conversations

He recommended use Seam with ICEfaces since ICEfaces is a single page application but Spring will work as well.  In JSF 2.0, this conversation scope will be part of the framework.

One to one discussion with ICEfaces core Developer, Judy:  Here are some of her tips for my current HR training application:

  • Add a search to find a class
  • Eliminate white spaces
  • Break code to more XHTML files
  • Show stuff only it is needed on the page
  • Every action has to be happen in 1 (one) second

Here is the picture with me and Judy:  Thank you Judy for your helful tips and sat down with me while everyone was rushing to go home in Friday afternoon.  Appreciated.
Bye bye JavaOne, bye bye San Francisco.  It was such a quick 5 days for me.  My head is stuff full of good information, hopefully I get to use some these tips and techniques before I forget ’em.  Until next time I will be tune in Tony Bennett – I left my heart in San Francisco and Scott McKenzie or with Global Deejays.

June 5, 2009 Posted by | JavaOne | Leave a comment

JavaOne 2009: Day three

1. Unit Testing That Sucks Less: Small Things Make a Big Difference: Neal Ford talked about different testing tools like Jester, MockRunner, Hamcrest, Groovy, RSpec/EasyB, and Selenium. He showed how Groovy can help test java code. He also mentioned about Unitils.org as well with dbUnit.

2. Writing Killer JavaServer Faces 2.0 UI Components:   Kito Mann showed ease of use and component development in JSF 2.0.  He demoed and did walk through process of creating UI components.  He introduced few facelets tag like, <ui:repeat>, <f:ajax>.  He talked about annotation and resource hanler as well.

3. Visual JavaFX Techlonogy-Based Design with JFXBuilder:   I was very excited to take this session.  Josh Doenias and Jeff martin did an excellent job to demostrate thier live code demo.  They developed a movie database application using drag and drop JFXBuilder tool.  The tool only has been around six months but I do see a great future of this tool and looking forward to use it in near future. Here is the tuturioal for Databox.

4. Best Practices for Large-Scale Web Sites: Lessons from eBay: * Randy Shoup, had worked for Oracle in 8 year now Distinguished Architect in eBay.  He gave an outstanding presentation in Javaone.   Here are interesting inside information he gave us during the session:

  • Over 80 millions active users
  • 100,000 line of code get released every two weeks
  • 16,000 java application server a day
  • No HTTP session
  • No EJBs

Here are 5 best practices for Internet Scale:

  1. Partition Everything: If you cant split it, you cant scale it.
  2. Asynchrony Everywhere
  3. Automate Everything
  4. Remember Everything Fails
  5. Embrace Inconsistency
Randy Shoup RandyRandy @ eBay

5. Keeping a Relational Perspective for Optimizing the Java Persistence API (JPA):   Debu and Reza took a deep dive to JPA and explained how to use JPA in details.  Here some keynotes I jotted down from this session:

  1. De-normalize tables
  2. DDL runs faster then DML
  3. Lazy loading: How and When will it load:  Look for user name.  It is a good candidate for eager loading.  Searing for Blob, it could be a lazy loading candidate.
  4. Native query: Be careful.
  5. Name queries
  6. Why is caching important
  7. Add second level cache
  8. Locking table, use diagnostic tool (i.e. Terracotta)
Debu and Reza email Pavillion

My co-worker and I had a long discussion after took this session and here we came up with this desgin to share middle tier from different modules in iDMS application.

Share middle tier in between different modules.

June 4, 2009 Posted by | JavaOne | Leave a comment

JavaOne 2009: Day two

I was lazy this morning so I skipped the General Session.  They had a big announcement on Java 7 and JEE 6.  Oh well, I was tired.   So anyway, here are some of my favorite sessions of the day.

1. Maven:  Took this session with John F Smart, a New Zealand java geek.  It was very helpful session.  He talked about <exclusion> tag in maven and showed pom.xml in gui view.  He mentioned about project inheritance  in Maven.  Super pom file –> Child pom file.  So what kind of stuff can you put in super pom file?  Answer was, stuff you share across and easy to maintain.  He mentioned about centralize reporting and also talked about Inheritance: Bottom up and Aggregation: Up down.

Word of advice:  If you want to make it standard, you want to make it available everywhere.

2. Resfull Webservices:  Took this session with Marc Hadley and Paul Sandoz.  They have touched in various area using JAX-RS includes:

  • Mapping URLs to java class files and methods
  • Handling HTTP request for common HTTP methods
  • Obtaining parameters from the HTP request
  • Using MIME media types and mapping representations to MIME media types and Java Programming language types

Marc mentioned to be careful with regular expression.  He showed a sweet command for Firefox browser: about:config.
Future: Restful 2.0 is underway.  Mime multipart, templating and more integration with JSF 2.0.  Here is the slide show.

3. HtmlUnit: Testing Web app: Daniel Gredler and Ahmed Ashour explained how a top-to-bottom integration testing works and ensuring Web application quality.   HtmlUnit is a 7 years old product, 100% java, open source.  It runs inside the JVM.  It does integration testing, screen scrapting.  They also explained,

  • The two approaches to Web app integration testing: browser simulation and browser driving.
  • The cons of the browser simulation approach.
  • The pros of the browser simulation approach.
  • Key extension points provided by HtmUnit.

Daniel also mentioned about JSF Unit as well.

4. Coding Soap and Rest together (TS-4883): Martin Grebac and Jakub Podlesak explained when you need soap and when you need rest.


  • Contract already known
  • Security
  • QoS: No functionl requirement

Why Rest:

  • Simplicity
  • Scalability
  • Serendipity

They also mentioned about not to fall into RPC over HTTP and annotation.  He indicated Rest-RPC hybrid and gave a demo with JavaFX with webservices (soap).
Link: metro.dev.java.net

Java EE 6, Glashfish V3 and Hudson demo:  I have attended to a GlassFish 2009 unconference party at the Hotel St. Regis where they have a demo setup for all upcoming products.  I talked and networked with several Sun employees and product managers about their products.  It was very nice to meet them in person and discuss  as well.  I have brought up our Glassfish support issue with Glassfish product manager, Abijit and Nazrul.  Kohsuke Kawaguchi gave me a brief introduction on Hudson continuous integration and how to set up a test automation environment.  It was very informative.  BTW, Hudson has a plugin for CA Harvest as well.

Good News:  A hot development can be done with JavaEE with Glassfish V3 and light Ejb3 also available as well. *

Glassfish Unconference EE 6 Java = Everywhere

5. BOF: JavaServer Faces Platform and Ajax: State of Union:  This was my first Bird of Feather in this year.

  1. Ted Goddard (ICEfaces Framework)
  2. Andy Schwartz (Oracle ADF Faces / Trinidad)
  3. Alexandr Smirnov (RichFaces [Ajax4JSF])

Ted Godder-ICEFaces

Each of these individuals is a JavaServer Faces 2.0 Expert Group member who has contributed to the specification.  It was a demo and Q&A session.

6. BOF: Writing a JavaServer Faces 2.0 Compoenent:  Jim Driscoll and Ryan Lubke showed how easy to write fully reusable JSF composite component using Facelets, XHTML tags.

7.  BOF: SOA: Aaron Mulder* from Chariotsolutions explained many of the key open-source options: Java Architecture for XML binding (JAXB), SOAP and REST (CXF, Axis), ESBs (OpenESB, Mule, ServiceMix, JBossESB), messaging (ActiveMZ), goverance (Galaxy), BPEL (ActiveBPEL, ODE) and more.  Arron gave a big-picutre view of how you can start building an SOA with low-cost tools.  Click here for the slide.  I have discussed Arron with our current iDMS architecture and he suggested that adding web services in our service layer make things slow down unless we have a reason to have web services in place.  He also mentioned about Spring Web Services as well since we are already using Spring for our Service layer in iDMS.

June 2, 2009 Posted by | Java core | Leave a comment

JavaOne 2009: Day One

Attended the general session with Johathan Schwartz, chief executive officer and president of Sun Microsystems.  The highlight was, how Java has evolved in past 14 years.  Java is everywhere from a small device to all the way to Mars. He brought eBay as an example.  eBay is a 100% java shop, $60 billion merchandises were sold in 2008, 60 million transaction per second.  Other guest presenter were, Blackberry, Blue-ray, Intel (Atom processor).  JavaFx was big part of the whole session.  James Gosling showed about RuneScape game and mentioned about store.java.com. It was nice being witness of Larry Ellison and Scott McNealy‘s handshake to watch live.

What does a leadership mean? It means Courage.
1. Ejb 3.1
2. Servlet 3.0: Annotation was introduced, no web.xml, asynchronous servlet

Spent rest of the day in Java Pavillion to network and discussed issues with Icefaces, Liferay, Teracotta, Spring and many other vendors.  I had a face to face conversation with Brian Chan, the Liferay Portal inventor.  He gave few web urls as a Liferay real life example.   www.nba.com is one of them.  I met with Wesley Reisz in Liferay booth who is a contract employee for U.S Army and seriously thinking to use Liferay instead of  Glassfish Web Space.  By the way, Glassfish Web Space is built on Liferay portal.


I also met Judy Guglielmin, who is the core developer for ICEfaces api.  We had a great conversation about ICEfaces and also about my current application that I have been working on.  She gave me ICEFaces T-Shirt for all my teammates.  THANK U, Judy.

June 2, 2009 Posted by | JavaOne | Leave a comment

JavaOne 2009: Java University & CommunityOne

JavaOne! Wow!  What a kool place to be as a Java Developer.  Actually this is the best conference for any Java Developers that is loaded with stuff and not much fluff.  I have been pumped up to attend this year JavaOne since my Team Lead and Branch Manager have approved the request. This is my third years in JavaOne so my cohort and I’ve decided to come a day early to explore the beautiful San Francisco a little closer.  We wanted to take a bike ride yesterday (May 31, 2009) and cross the Golden Gate bridge but weather was not in our favor instead we went to see Coit tower, that was awesome.  We had some world best Clam Chowder at the Fishermen’s Whraf and smoke some good Cigar.  It was fun.

JavaOne has grown so much. They are adding more stuff every year. Today I have attended in general sessions for little bit with David Douglas.  Cloud computing was hot topic.

Cloud computing

I supposed to attend in whole day a special session on SOA but I only able to take the first half of the course. I think it was kind of boring because instructor chose to deliver the concept of SOA instead of how to do it method.  I do understand that SOA is a complicated concept to teach in eight hours but anyway, I have taken these following Community One sessions after lunch hour:

1. Glassfish application ServerAdam Bien gave us a tour of Glassfish Admin Gui for V3 and talked about how a Portal server can run in Glassfish.  He refused to make comments on Oracle app server vs future of Glassfish server.  www.glassfish.org/portal.  Adam also mentioned about jFluidProfiler, a new way to profile a java application.

2. JSF/Portlet/Ajex Push: Ed Burn and Neil Griffins talked about JSF 2.0 and how Icefaces will behave with this new version of JSF.  One good thing out of many in JSF 2.0, it has built in Facelets support, which is very cool.  Ed explained Inter Portlet communication VS. Inter Browser communication.   Neil showed that how easy to build composite components in JSF 2.0.  Question was asked about ICEfaces + Clustering, Neil told us to go look at his blog for it.

3. Hibernate ScalibilityTerracotta.org showed how it can help to high-scale Spring and Hibernate reference application.  Terracotta is a open source project and current version is 3.1.  Terracotta received Duke’s choice award in last day of conference. Highlights of topics are:

  1. When to use second level cache
  2. When to detach your conversation
  3. Recognize non-relational data
  4. Open session in view
  5. Examinator use case:
    • Password reset
    • Single signon

4. What do we need to know about creating and running a scalable websiteZembly.com presented some cool tricks and tips to create Facebook application.  Shared their experience of weekly one hour holistic testing before product gets released.

June 1, 2009 Posted by | JavaOne | 1 Comment

dataTable and radio button in JSF

Scenerio: Wanted to render the same radio button group for all rows in the table so that only one button can be selected at a time.  There seem to be no easy solution to that simple problem!

DataTable and RadioButton

Reason: The above plan apparently doesn’t work, because <h:selectOneRadio> renders an HTML “table” by itself, and that “messes up” the other “table” that the <h:dataTable> tag renders.

Solution:  One work around would be to use TomaHawk but instead of mixing two JSF implementations I went ahead to use command link.

Commnad Link2nd SoulutionThe key to getting this to work is to define the selectOneRadio component outside of the table. Then by setting the layout attribute to spread and using the ice:radio components inside the dataTable it gives you the rough layout/functionality.

<h2>Main Page</h2>
 <ice:panelGroup id="tablePanel">

 <ice:selectOneRadio id="trainingClassRadio"
 <f:selectItems value="#{testBean.radioItems}"/>

 <ice:dataTable var="class" value="#{testBean.trainingClassList}"
 <f:facet name="header">
 <ice:outputText value=""/>
 <ice:radio for="trainingClassRadio"

 <f:facet name="header">
 <ice:outputText value="Class Name"/>
 <ice:outputText value="#{class.className}"/>
 <f:facet name="header">
 <ice:outputText value="Class Number"/>
 <ice:outputText value="#{class.classNum}"/>
 <f:facet name="header">
 <ice:outputText value="Class Description"/>
 <ice:outputText value="#{class.classDesc}"/>

 <ice:panelGrid columns="2">
 <ice:outputText value="Selected Row - Class Name:"/>
 <ice:outputText value="#{testBean.selectedTraining.className}"/>
 <ice:outputText value="Selected Row - Class Number:"/>
 <ice:outputText value="#{testBean.selectedTraining.classNum}"/>
 <ice:outputText value="Selected Row - Class Description"/>
 <ice:outputText value="#{testBean.selectedTraining.classDesc}"/>


May 29, 2009 Posted by | Java Server Faces | 13 Comments

JSF: f:selectItem vs. javax.faces.model.SelectItem

Let me explain what works and then I will tell you what not works. ListModel has a list type of javax.faces.model.SelectItem:

public class TrainingSessionsListModel extends ListModel{

 private List<SelectItem> availableSlotSelectItems;

 public List<SelectItem> getSessionNumberSelectItems() {

 if (this.sessionNumberSelectItems == null){
    sessionNumberSelectItems = new ArrayList();
    for(int i = 100; i < 1000; i++){
       SelectItem selectItem = new SelectItem(i,Integer.toString(i));
 return sessionNumberSelectItems;

<p style="margin-bottom:12pt;">xhtml now referring to the above list model class to get the list and set the value to TrainingSessionsDTO.sessionNumber property:</p>

 <ice:selectOneMenu id="sessionNumber" partialSubmit="true" value="#{
trainingSessionsListModel.TrainingSessionsDTO.sessionNumber}" required="true">

<f:selectItem itemLabel="#{msgs.select}" itemValue="" />
 <f:selectItems value="#{trainingSessionsListModel.sessionNumberSelectItems}"/>


Here is the transfer object with getter and setter.

 public class TrainingSessionsDTO extends TransferSupport implements Transfer,
 Serializable {

 String sessionNumber;

 //getter and setter .......



The above works fine, no problem but if I change the xhtml to these it wont work.

<ice:selectOneMenu id="sessionNumber" partialSubmit="true" value="#{
trainingSessionsListModel.TrainingSessionsDTO.sessionNumber}" required="true">
 <f:selectItem itemLabel="#{msgs.select}" itemValue="" />

 <f:selectItem itemLabel="100" value="100" />
 <f:selectItem itemLabel="200" value="200" />
 <f:selectItem itemLabel="300" value="300" />

java.lang.String cannot be cast to javax.faces.model.SelectItem


<f:selectItem itemLabel="100" itemValue="100" />
<f:selectItem itemLabel="200" itemValue="200" />
<f:selectItem itemLabel="300" itemValue="300" />

The value is meant to send in a SelectItem object and not a String. This should eliminate the exception you are seeing. Here is my beautiful finished work (form and datatable):

May 1, 2009 Posted by | Java Server Faces | 4 Comments

JSF @PostConstruct

Scenario:  I needed to get some data for datatable when the bean get initiated.
So, I have tried these following code.

public TrainingClassForm() {  //constructor


me:  javax.faces.FacesException: Problem in renderResponse: javax.faces.FacesException: Cant instantiate class: gov.faa.amc.nas.hrtrainingview.bean.backing.TrainingClassForm.. null

Issue: Banging my head after few hours, then I have discussed with JSF Expert, Jason Lee who helped me to sort this out.   I was calling trainingListModel before it get initiated/born.  So I was getting a null pointer in TrainingListModel class.

Lesson to learn:  Use @PostConstruct instead.

1. If the bean has request scope, @PostConstruct will get executed every time.  It will be called after the managed bean is instantiated, but before the bean is placed in scope.   Such a method take no arguments, return void, and may not declare a checked exception to be thrown.  Method may be public, protected, private, or package private.  If the method throws an unchecked exception, the JSF implementation must not put the managed bean into service and no further menthods on that managed bean instance will be called.

// Constructor
    public TrainingClassForm() {

   public void init() {
       if (this.trainingListModel.getListDataModel() != null) {


2. @PreDestroy:Any scoped managed bean menthod annotated with @PreDestroy will be called before the bean is removed from the scope or before the scope in which the bean resides is destroyed, whichever comes first.  The constraints placed on the method are the same as with @PostConstruct.

Ref Book: The Complete Reference – JavaServerFaces  by Chris Schalk & Ed Burns

April 22, 2009 Posted by | Java Server Faces | 3 Comments