Wednesday, June 5, 2013

Attacking the legacy code:Buiding weblogic beehive application using ANT

Recently I started to investigate on writing an Ant script to build our J2EE web application. Right now we just export the WAR file using Eclipse IDE, but we plan to adopt Jenkins for the build automation, then we got a problem. I tried Eclipse Headless build, it did not working. So I decided to use Ant script to build our J2EE web application. Our application is based on Weblogic 10.3, it uses lots of weblogic portal library, netUI, and page flow. Through several times trial and error, finally I got my ant script works. It is a kind of tricky, here I would like to share my experience, show you how to write an ANT script to build the Weblogic beehive application.

1. Setup the environment variables in your ANT script file
 You need to setup following environment variables: WL_HOME, WORKSHOP_HOME, and BEA_HOME.
 In my computer weblogic was installed under C:\Oracle\Middleware, so these environment variables will look like this in my build.xml:

        <property environment="env"/>
<property name="env.WL_HOME" value="C:/Oracle/Middleware/wlserver_10.3"/>
<property name="env.WORKSHOP_HOME" value="C:/Oracle/Middleware/wlportal_10.3/workshop" />
<property name="env.BEA_HOME" value="C:/Oracle/Middleware" />

2. Import weblogic Ant task files into build.xml
   Based on this article, WebLogic Server ships with the following Ant files for building and deploying Beehive applications:
   In my computer, the ant script folder will be: C:\Oracle\Middleware\wlportal_10.3\workshop\weblogic-beehive\ant

   I found a bug, in weblogic-beehive-imports.xml:
   <property name="apache.xbean.jar" value="${env.BEA_HOME}/modules/com.bea.core.xml.xmlbeans_1.0.0.0_2-4-1.jar"/>
   <property name="bea.xbean.jar" value="${env.BEA_HOME}/modules/com.bea.core.xml.beaxmlbeans_1.0.0.0_2-4-1.jar"/>

   should be changed to:

   <property name="apache.xbean.jar" value="${env.BEA_HOME}/modules/com.bea.core.xml.xmlbeans_1.1.0.0_2-4-1.jar"/>
   <property name="bea.xbean.jar" value="${env.BEA_HOME}/modules/com.bea.core.xml.beaxmlbeans_1.1.0.0_2-4-1.jar"/>

   I just copied those 3 xml file into my project folder, so in my build.xml, add following after the property definition:
   <import file="weblogic-beehive-imports.xml"/>
   <import file="weblogic-beehive-tools.xml"/>
   <import file="weblogic-beehive-buildmodules.xml"/>

3. Write ant target to build web application
   Use weblogic "build-webapp" ant task, it will compile the source code, and it will generate the page flow xml, specifically it will generate those xml files under WEB-INF\classes\_pageflow folder, which took me a long time to figure out.
    Please note: to build successfully, you need to put the source code under the WEB-INF\src folder.
   The ant target will look like this:

   <target name="build-web" depends="init">
4. "Error running apt compiler" issue
   At first the ant script works in my local machine, but under windows server it failed with "Error running apt compiler", and the detailed error is like "CreateProcess error=87". After Google this error, and found out it is because the classpath is too long.
   To fix this, I checked my classpath library, and removed all the unnecessary files, and finally it is working.

1.  Building Beehive Applications

Tuesday, June 4, 2013

My Toastmaster Sergeant-At-Arms debrief

Now it comes to the toastmaster year end, and my role as SAA is almost finished. It is time for me have a debrief.

WHY I picked the Role of SAA
Last  year of this time, I just joined the Markham Toastmasters club for a couple month, I was very impressed by the highly structured meeting, I was really curious about what is the behind scene; and as a software developer I am very interested in self-organized team, toastmaster club is a good example of self-organized team, I really want to know more about it; the third reason is I thought SAA is the easiest job, if you can arrive earlier each time, then it is not a problem. Considering these reasons, which droves me to attend the executive team, take the role of SAA.

HOW I did my jobs and my achievements
When I started working, I realized I was wrong, there are lots of work - both visible and invisible jobs. At the beginning, I feel a kind of stressed, and even more the past SAA Hitesh did such a great job, he raised the bar, which made me nervous, how can I match that? My mentor Robert suggested me that just try my best, I will say I did that. I have a passion to do a better job, always try to come to the meeting at 6:30PM, this job needs focus on details, since any small mistake will cause the problem; and you have to keep multi-tasking, which means I need to do some sacrifice, focus on helping others without pay attention to the meeting.  I keep asking for help, Hitesh give me lots of tips, I really appreciate this guy.

What I am proud of myself is I applied what I learned from my career to the SAA role, for example, from Lean I learned value added system and eliminate waste - when I do my job of SAA, I keep asking my self, how can I add more value to the club? how to make it better? From Kanban, I create a Kanban board to visualize the guest list; From continuous improvement philosophy, I keep asking myself, how can I improve the process, make the process better? And from Scrum/Agile, I learned the concept of Servant leadership, which means a good leader is helping other better, removing the impediments which hold them back; all these helped me a lot to do my job.

Overall beside I did my job, I make the following achievements which I believe added the value to the club:
- Created a Kanban board using a software called Trello, which is lot easier to tracking the guest list and collaborate around the executive team;
- We stared recording video for speakers since February this year;
- Setup a facebook group for the club, trying to bring social media into club

Those are nobody asked you to do it, and neither will create benefit to myself, I don't even think about adding them to my CL manual, but I still want to do them? Why? because based on the lean thinking, they definitely add value to the customer - our club members, our job is delight customer, make them happy.

Overall I got positive feedback so far, which means my hard work was recognized.

The Benefit I got
I will say this is a great experience to me, the work itself is a reward. I can apply what I learned to the club, I had the autonomy to make changes, make improvement, and especially when you see your efforts can help others and make some influence, this is a great joy. I really appreciate I have this opportunity to bring my contribution and make our club better. Another great benefit is I have a chance to make friends, they inspire me and help me a lot, which is a great asset and will definitely help me in future.

Something BAD
The only BAD thing to me is I only make one speech this year, and my table topic skills is still not improved. Comparing to other executive members, I fell behind.
The reason is one: SAA job do take more time than I thought, and it will take me lots of time to prepare my speech, there is a conflict between these 2 things, I really admire other executive members, how can they finish 2 things at the same time?

Next step
Next year, I will focus on my speech, trying to finish my CC ASAP! I fell far behind with my fellow members, I need to catch up. I have bigger plans, but I realize the road block is my CC manual, it is the impediment to reach my goals. I really need help, I need mentor, I would really appreciate if anybody can help me.