Monday, December 6, 2010

Thoughts on recent Hudson trademark issues

Recently I have seen several tweets and blogs on forking Hudson and I also come across this article on how Oracle is trying to assert its trademark on Hudson. This trademark thing simply disgusts me to say the least.

I have been involved with Hudson from very early days and I think my first post to Hudson's user mailing list was in early 2007 and I even wrote a little portlet that aggregated data from Hudson. I am not a kind of guy who tries to get his head around copyright issues and different OSS licenses but I always understood that

  • Hudson started as Kohsuke Kawaguchi's pet project and he worked on top of his regular day job
  • Kohsuke did and still does an awesome job of being involved with community and as a result got several committers and plugin developers
  • Hudson got popular enough that Sun thought it deserved Kohsuke's full attention and they also started selling support for it.
So more or less Hudson has been a perfect example of OSS where both project and community have had mutual relationship. Why would anyone want to impose a trademark on it? Oracle has been in news mainly for bad reasons among java community and this simply asserts why java community does not trust Oracle to be a good steward for Java. Leave Hudson as it is Oracle and start working with community, not against it. !!

Wednesday, November 17, 2010

Richfaces : ReThink Before ReRender

Sometimes when you go deeper into a framework or a tool , you tend to take beginner stuff for granted. That bit me today for a while before I could get my head around it.  ;-)

When using Ajax, it's a well known fact that for you to manipulate a DOM element, that element needs to be present. Same rule applies when you are using reRender in Richfaces as well. Let's take a look at following code snippet:

<rich:panel header="Add New Application">
   <h:outputText value="App Name " />
   <h:inputText size="20" id="appNameInput" value="#{appConfigBean.currentApp.appName}" />
   <a4j:commandButton id="new_app_submit" action="#{appConfigBean.addNewApp}"     
    value="Add" reRender="appDetails" />

<h:panelGrid columns="2" id="appDetails" 
      <h:outputText value="Some stuff"/>

The addNewApp method in backing bean sets renderDetail to true which initially was false. So when you click Add button, you would expect reRender to kick in and show the panelGrid with id appDetails. Nope. It does not happen. From second paragraph you might have understood the reason already. But here is a more detailed explanation.

Since initially, renderDetail boolean is set to false, when the page is first loaded, the html for panelGrid never gets rendered hence there does not exist a DOM element with id appDetails and reRender does not know what to update.

To fix this, the easiest and probably the best solution is to surround panelGrid with a4j:outputPanel and you would put this output panel's id for reRender to do its magic.  Here is the updated code:

<a4j:commandbutton id="new_app_submit">
                      action="#{appConfigBean.addNewApp}" value="Add"
                      reRender="appDetailOutputPanel" /&gt; 

<a4j:outputpanel id="appDetailOutputPanel"> 
     <h:panelgrid columns="2" id="appDetails">
          <h:outputtext value="Some stuff"></h:outputtext>

Tuesday, November 2, 2010

Tips when using AWS sdk with JBoss AS + GateIn

While working on a really cool portlet for GateIn that uses Quartz scheduler and AWS sdk which I am going to unveil to the rest of the world in few days ;-), I came across a weird problem. :

Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.xml.xpath.XPath.setNamespaceContext(Ljavax/xml/namespace/NamespaceContext;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/quartz/xml/XMLSchedulingDataProcessor, and the class loader (instance of ) for resolved class, javax/xml/xpath/XPath, have different Class objects for the type javax/xml/namespace/NamespaceContext used in the signature

This kind of error obviously suggests some conflict with classloader and that was the case in this scenario too. I initially thought it must be something with quartz because I am using Quartz's XMLSchedulingDataProcessorPlugin but looks like that dependency comes from AWS sdk. To get it working, I simply removed stax-api-1.0.1.jar from WAR file and portlet deployed fine. The conflict happens because GateIn 3.0.1.GA + JBoss AS 5 combination has stax-api.jar under GateIn-3.1.0-GA/lib/endorsed which means StAX library is a system-wide library.

Tuesday, September 21, 2010

How to configure GateIn with Amazon RDS !!

Couple of weeks back JBoss Stormgrind project created an AMI (ami-0cda3165) for GateIn  3.1.0.Final . If you have created an Amazon's EC2 instance from existing AMI before, creating a GateIn EC2 instance is no different. When  an instance is running, you can access the default portal at URL which will look something like Don't try accessing the URL, it will go to /dev/null ;-) If you ssh into your instance, you can see JBoss+GateIn bundle at /opt/gatein-3.1.0.FINAL. By default, GateIn comes bundled with HSQLDB but normally people have a separate instance of DB such as MySQL running on separate server so here I am going to show you how you can configure Amazon RDS aka MySQL 5.1 with your GateIn instance running in cloud.

1. In AWS management console, search for Gatein or you can directly enter ami-0cda3165. In subsequent window pick your availability zone and select instance type as "Small" which is enough to use GateIn for smaller use case and lighter load. Then select your key-pair, security group. Make sure your security group has port 8080 turned on. Ultimately, the details of instance should look similar to following screenshot:

2. Launch your instance and when AWS console says instance is running, you should be able to access the GateIn's landing page at This verifies that we have GateIn AMI working properly which is running atop HSQL.

3. Now, let's create a RDS instance. Launch DB instance wizard under Amazon RDS tab, select instance class as small, size 5G,  give a name to your DB instance (this is not the schema name in case you are wondering) e.g. gateinmysql and of course master userid and password. In next window of wizard, give a DB name which is schema name. For availability zone, select the same zone you selected in step 1. This means that both GateIn and DB servers are collocated which will give you a better network QoS. Your configuration should look something like following:
Launch the DB, go get a cup of coffee because it takes a while for Amazon to launch a DB instance. When it's runnig, your DB server name should look like

4.  Now we need to hook 1 & 3 together. For this, let's ssh into the GateIn instance and stop GateIn server. We then modify the file, /opt/gatein-3.1.0.FINAL/server/default/conf/gatein/ with the details from screenshot in 3. You can see complete detail of configuring GateIn with MySql at GateIn 3.1 reference guide. 

5. Copy (scp or wget) MySQL jdbc driver to /opt/gatein-3.1.0.FINAL/server/default/lib

6. Delete data, log, tmp, work folders from /opt/gatein-3.1.0.FINAL/server/default so that we have a clean server again.

7. Start GateIn server by doing "bash -c default -b". After couple of minutes depending on how good network connection between GateIn & RDS is, you should be able to see your portal running again at the URL you saw in 2. You can also use mysql-administrator in your laptop/desktop to see the tables and data GateIn created during startup.

Unless you are a zombie, you would not want to repeat this process every time you need to run GateIn with RDS. You should create your own GateIn AMI based on all modifications you have done. The feature I liked about RDS is that you can take a snapshot of database and relaunch again. Amazon preserves the RDS public server name which means that configuration changes that you made on 4 would continue to work.

Please let me know if you run into any problem when you to try to do yourself and I will update this blog accordingly. Happy clouding and portaling.
Help me in my mission at

Sunday, September 12, 2010

How to debug a portlet in GateIn !!

Lately I have  seen few questions on how to use an IDE to develop and debug a portlet in GateIn user forum. The simplest answer is: it's similar to how you develop and debug a regular (jsp, servlet, jsf etc) web application. But I am going to walk you through one example of doing the same using plain Eclipse (or JBoss Tools ) and GateIn Portal using remote debugging of the upcoming Jasper portlet that is still a work in progress.

1. Import or create a project in eclipse

Nothing much to add's like any standard java project. You can see further details for creating a new project at In this example, I am going to import the mavenized jasper project from

2. Deploy the portlet into GateIn

Since this is a maven project, doing a maven install will create a .war file which we will deploy or copy to $GATEIN_HOME/server/default/deploy.

3. Preapre GateIn for debugging
Uncomment JPDA section for remote socket debugging in $GATEIN_HOME/bin/run.conf

JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket, address=8787, server=y,suspend=n"

Please note the port number here. You can change it if you have any conflict on that port.

4. Start GateIn
You simply do "bash" on Linux/Unix or run.bat on Windows.

5. Hook up Eclipse with GateIn server
 In eclipse, select Run->Debug Configurations->Remote Java application and click on "New Launch Configuration Icon" which should show the following screen. Please change the port number from Step 3.
Click Debug. You should not get an error if eclipse is able to connect to the socket on port 8787.

6. Add portlet to a page
As of GateIn 3.1.0, there is no "simple" way of adding a portlet to a page using XML similar to how it was in JBoss Portal so we are going to use GateIn's user interface to do that. You can see how to do that at Please ask in user forum if you need help with this. In my case, I added this to home page. I can see the portlet when I visit the home page. However since we did not put any break point, eclispe does not care at this point

7.  Add a break point

I am going to add a break point on the first line of code in doView method of JasperPortlet class knowing that this method is always going to be called for normal viewing of this portlet.

8. See it in action

Let's refresh the page which should call doView method again and eclipse should prompt me to go to Debug perspective. Here is screenshot.

Happy debugging.
Please help me in my effort of computer literacy in Nepal at

Thursday, August 19, 2010

Hot eclipse tip of the day

In eclipse, when you hit F3 while your cursor is over some code in .java file, it will jump to its declaration. It's all good except in the case of an interface. For a method in interface, most of time you want to see its implementation not its declaration. There are few ways to work around this:

- Ctrl+mouse over the text will show options to jump to declaration or implementation.

- Ctrl+t will also show you options for both interface and its implementation.

First one requires me to use mouse, second one is not intuitive because I am used to hitting F3 to do similar operation. Ideally, you would like to see some combination of F3 doing its job. The Implementors plugin does exactly that. Now when I hit, ALT+F3 it goes directly to its implementation.

Friday, August 6, 2010

Some new kind of entertainment for your portal

Most of us like and love movies and we have some favourite stars and sometimes we even hang their posters. Even folks at prison get to do that; remember Rita Hayworth in Shaswshank Redemption. Now if you don't know who Rita Hayworth is and which movie I am talking about, you would probably google it and your search would more likely take you to IMDB or Wikipedia - yaaaawn ;-) Now imagine not having to do that and getting those information in your own portal. YE !!

Introducing Netflix portlet. Since picutures are worth thousand words, here are some screenshots with details of Shawshank Redemption. For a movie and TV series, the portlet currently shows its synopsis, cast, ratings, awards, poster if available.

For an actor, it shows his/her biography, filmography and of course a picture if available. Here is a screen shot of portlet with details of one of the actors I like.

Now some interesting details: Portlet consumes data using Netflix's webservices API hence to have this portlet running on your server you need to have proper key which you can get from Neflix's Dev page and when you start your server, you simply add -Dnetflix.consumer.key=blah -Dnetflix.consumer.secret=blahblah as JVM parameters. Portlet is based on JBoss Richfaces 3.3.3.Final, JBoss PortletBridge 2.0.0.Final and has been tested with GateIn Portal and JBoss Enteprise Portal Platform 5. The source code of this portlet can be downloaded from

Disclaimer: This portlet is not officially supported by JBoss, by Redhat.

Help support my mission:

Friday, June 25, 2010

Richfaces Presentation at Austin JUG

I will be giving a 45-min presentation on JBoss Richfaces at Austin JUG on June 29 starting at 7 PM. More details at I hope to see you there if you are in town.

Friday, April 23, 2010

Java's Language discrimination against Nepali

I will let following code and it's output do the talking:

System.out.println ("Korean testing: ");
Locale locale = new Locale("ko");
System.out.println("DisplayName in current locale:" + locale.getDisplayLanguage());
System.out.println("Display Name in Native: " + locale.getDisplayLanguage(locale));

System.out.println ("\n French testing: ");
locale = new Locale("fr");
System.out.println("DisplayName in current locale:" + locale.getDisplayLanguage());
System.out.println("Display Name in Native: " + locale.getDisplayLanguage(locale));

System.out.println ("\n Hindi testing: ");
locale = new Locale("hi");
System.out.println("DisplayName in current locale:" + locale.getDisplayLanguage());
System.out.println("Display Name in Native: " + locale.getDisplayLanguage(locale));

System.out.println ("\n Nepali testing: ");
locale = new Locale("ne");
System.out.println("DisplayName in current locale:" + locale.getDisplayLanguage());
System.out.println("Display Name in Native: " + locale.getDisplayLanguage(locale));

Here is the output:
Korean testing:
DisplayName in current locale:Korean
Display Name in Native: 한국어

French testing:
DisplayName in current locale:French
Display Name in Native: français

Hindi testing:
DisplayName in current locale:Hindi
Display Name in Native: हिंदी

Nepali testing:
DisplayName in current locale:Nepali
Display Name in Native: Nepali
What the heck?? I understand that Nepali is not as widely spoken as other languages that are shown above but given that you can show Hindi in "Devnagiri script" and Nepali also shares the same script, why would Java not apply that to Nepali as well? Do I smell discrimination here? ;-)

Just for curious mind, this came up when I was trying to see why Nepali is not written as नेपाली in "Change Language" dialog box in GateIn.

Monday, April 12, 2010

Tips when adding extra memory to your laptop

I recently got a new Lenovo T500 that had 2G RAM into it. I installed 32-bit Fedora 12 on it which worked flawlessly, even dual monitor. Then I got an extra 2G RAM which meant that I needed to open laptop case to install it. It gave me some jitters given that I have not unscrewed any laptop before. The last time I did something close to this was way back in 2000 when I put extra hard disk into my Dell Desktop to have dual boot with Windows ME and Red Hat Linux 6. Fedora was not born then.

I followed T500 hardware maintenance manual at, rushed to Radioshack to get screw driver for 14 mm screws and with some fiddling, snapped the thing in its slot. Reboot and

[prabhat@eejot ~]$ more /proc/meminfo
MemTotal: 3057360 kB
MemFree: 2192648 kB
Buffers: 45864 kB

What? Should not MemTotal be somewhere close to 4194304 kB? Then I come to know about PAE, did a 'sudo yum install kernel-PAE', reboot and Voila. Now I see

[prabhat@eejot ~]$ more /proc/meminfo
MemTotal: 4013920 kB
MemFree: 2397700 kB

which looks much better. Thanks Matt for pointers. :-)

Thursday, April 1, 2010

Saga of Lawn Mowers

My wife and I bought a house in November last year. We are slowly getting used to all chores that come with buying a house. Since we bought it towards the beginning of winter, I did not have to worry about mowing my lawn. Now that winter is already over and Texas summer has already announced its arrival, I need to start taking out weeds, mowing our lawn and watering it.

For mower, I tweeted and facebooked asking opinions of my friends. Not surprisingly, I got good feedbacks with both gas and electric motor getting equal and majority of votes and couple going for reel mower which I did not even know that it existed. A reel mower does not have an engine and it's run by your sweat and blood and that sounded promising to me. I finally got one on last Monday from Lowe's and it looks like it does its job well. Assembly required about 20 mins. I have 30 days to return it which means it has to pass my tests at least two more times and I hope that it lasts longer. Now let's come to the main point:

  • Having a gym membership and not been there for past 6 months -> Waste of Money
  • Buying a reel mower for $100 and cancelling gym membership -> Sweet and you do the math.
  • Buying a reel mower and enjoying the outdoor -> Very sweet
  • Buying a reel mower and doing tiny bits to help the environment -> Priceless

Wednesday, March 10, 2010

What? You can tictactoe in GateIn Portal?

If you thought Portal was only about serious stuffs such as content aggregation, integration of different applications, out of box personalization and natural front end to SOA etc then think again. Using GateIn's gadgets, you already could import different cool gadgets say from Google to your dashboard and page. Now you can tic-tac-toe as well. Here is a screen shot from GateIn Portal for you i-dont-believe-until-i-see kinds.

And if you are i-want-to-checkout-code-and-try kind, you can do so from . It's tested with Richfaces 3.3.-SNAPSHOT, JBoss PortletBridge 2.0.0.CR1 and the latest and greatest GateIn Portal. By the way, this portlet works flawlessly on JBoss Portal 2.7 and Enterprise Portal Platform 4.3 as well.

If you have been following my blog, then last week I blogged about few Richfaces examples that my team members wrote. . It took a while to port tic-tac-toe to GateIn running with JBoss AS 5 because I ran into this nasty bug which has been fixed in Richface 3.3.3-SNAPSHOT and should be available in upcoming 3.3.3.GA release. Please watch this space for more cool portlets that are on the way.

Visit and help me raise some funds.

Thursday, March 4, 2010

New Richfaces examples

We have created some new Richfaces examples for people to get started with. We had very simple goal in our mind when we created these example applications that the examples should be easy enough for people to understand and to see some most popular Richfaces components in use. We did not want to bore you all with yet another set of manuals. Instead there is a simple README if needed. All of these apps are tested with Richfaces 3.3.3.CR1 which has a partial support for JSF2. Richfaces 4.x series will have full JSF2 support.

Tic-Tac-Toe hardly needs an explanation and is the simplest of three examples. Please get the code from Pavol-Tictactoe-Code/ Here you see a4j:support and a4j:params in use with graphicImage and selectBooleanCheckbox and as well as examples of a4j:commandButton and Richfaces's Tab Panel, DataTable. This is JSF1.2 based and should run fine on both JBoss AS5 and Tomcat6.

Richrates converts Euros to about 30 foreign currencies and vice versa. The application gets data from European Central Bank on the fly. It is based on JSF2 and has been tested on JBoss AS6 M2 but it should run fine on Tomcat6 as well with proper jsf jars. Here you can see some JSF2 features in action such as bean annotation, implicit navigation. Richfaces components in use are Graph Validator, Calendar, Datagrid, Drag Indicator etc. Please see the code at Pavol-Richrates-Code/.

Ribber is Richfaces XMPP client. It is based on JSF2, Weld and Smack and has been tested on JBoss AS6 M2. Grab the code from Lukas-Ribber-Code Here you will see some JEE6 features in use such as javax.enterprise.event.*, javax.inject.* and Richfaces components in use are rich:tree, rich:jquery, rich:hotkey, rich:message, a4:push, a4j:poll. This app is quite cutting edge and if you have just started on CDI, this example will serve you well as well.

The complete credit for these apps goes to my team members Lukas Fryc and Pavol Pitonak. If you have any question, please free to join Richfaces User Forum.

Wednesday, February 17, 2010

GateIn Portal now available in Nepali

Thanks to Mr. Bimal Thapa, an OSS contributor from Nepal, GateIn portal project is now partially translated into Nepali. Here is one screen shot:

Of course being a Nepali, I am really proud of this but what makes it even sweeter is that I met Bimal as part of my Open Source Software (OSS) event during my last visit to Nepal. I would like to think that the event is partially responsible to bring Bimal jee on board. ;-) Please help me spread the word.

If you want to join the fun, please contact me. There are still some polishing to do.

Wednesday, January 13, 2010

Looking for Volunteers to Translate GateIn into Nepali

This message goes out to all Nepali OSS community. Currently a open source portal project called GateIn ( is looking for volunteers to translate GateIn into many languages. Being somebody who is involved with this project and being a Nepali, it will give me an immense pleasure to see GateIn translated to Nepali as well. The details of task is at . Please shoot me an email if you are interested.

Your rewards:
1. You can call yourself a OSS committer and brag about it.
2. Feel good that you are able to do a bit to expand Nepal's footprint in OSS community
3. Acknowledgment from the project lead
4. A project T-Shirt