Friday, January 16, 2009

Something funny has happened!

I am not sure why. Somehow the XML message that was passed to my request queue contains response tag which is not supposed to be attached to it.

What annoyed me was my WBI adapter for Kenan kept processing the same XML message over and over again! Thank to this and only i found out that there was one database connection remained opened thus causing more and more database sessions created!!! This could be a serious issue and luckily i tackled the problem before the system goes for production! However, i still need to find out why sometimes the XML message is redirected to the request queue even tough it has been processed by the adapter without encountering any Tuxedo connection error! The only clue i know now is this kind of 'problematic' XML message contains response tag! Could it be an error from the portal side? Could it be they acquired the processed XML message from response queue and then sent to request queue again? Well, it is doubtful.

Scratching head... continue tomorrow....

Wednesday, November 26, 2008

The Jar Manifest

Today i learned something about the Manifest file inside JAR file.

I found out that path for the Class-Path property starts from the path where the jar is located.

For example, if you place your JAR file at C:/myApp/service/myJar.jar, and you want to add a library (C:/myApp/lib/A.jar) to your manifest file, you will NOT be able to achieve that! Remember this!

The root path for the Class-Path property in the manifest.mf file starts with the path where the jar file installed.

In this case, if you want to put your classes into manifest.mf, you have to move the C:/myApp/lib/ to C:/myApp/service/lib

Correct me if i am wrong.

Friday, November 21, 2008

BEA Tuxedo Hack

I had a tricky problem with the Wepshere Business Integration(WBI) Adaptor. There was a error message saying that the jar file in my customized adaptor (tuxedo.jar) failed to load a 'so' file. It uses loadFile method from java.lang.System and somehow that particular file could not be found. I double checked the LIB_PATH(AIX machine) and java.lib.property and they are correct.

In the end i decompiled the particular class from the tuxedo.jar, modified the source code by using load method in java.lang.System instead of loadFile method. The load method will require us to specify the absolute file path. It works!!!

Sunday, November 2, 2008

IBM Websphere Business Integrator Adapter

My recent work is much on maintaining an adapter called Kenan Adapter deployed on an IBM product called IBM Websphere Business Integrator(WBI). This product basically picks up XML message in the queue and processes the particular messages. I was struggling on getting the web services call to work. I tried a few methods but the web services call just did not work. My project manager who has a very solid technical background could not provide a solution too. In the end he concluded that an RMI program cannot just call another RMI. The WBI framework itself is RMI based. Hence he helped me to build a standalone Java application that listens to the queue all the time, picks up messages then calls the web services. Last Friday i tested one round. The web service call was successful!

Sunday, June 22, 2008

About Hibernate Save and Delete parent children again

I want to add new child object into children collections and remove 'selected' existing child object from the same children collections.

  1. First, i get the collection from 'attached' parent. For e.g Set children = parent.getChildren()
  2. Add the new Child object. Of course please save the Child object first. children.add(newChild).
  3. Remove the 'selected' existing Child object. children.remove(removedChild)
  4. Finally, save the Parent object.

It is kind of fundamental. However sometimes we may get confused due to whatever reasons.

Wednesday, June 18, 2008

OpenOffice mail merge problems

I need to merge document B to document A(master document) using OpenOffice SDK.

My font in document B is 'Arial' and there are 3 paragrahs in it.

After merging, the font of the last paragrah somehow changed to 'Times New Roman'!

Another problem is, document A is formatted with numbering, document B is supposed to be inserted at the first line of the numbering. However, the 2nd paragraph from document B ends up a new number within the numbering format! To be more specific, document B's content should be positioned at number 5.1, but right now document B's content has been splited into 2: 5.1 which is the 1st paragraph from document B and 5.2 which is the 2nd paragraph from document B. My intention is to put all paragraphs from document B into 5.1!

After few days of searching, i discovered that it is actually a bug in OpenOffice!
  1. http://qa.openoffice.org/issues/show_bug.cgi?id=60475


  2. http://www.oooforum.org/forum/viewtopic.phtml?t=60268&highlight=insertdocumentfromurl+format
My solution:

  1. To solve the numbering problem, document B must always have an extra paragraph break after the last paragraph! (If you are using OpenOffice, click View from menu and choose to show "Nonprinting Characters")


  2. To solve the style problem, i adjust the styles in document A again after the merging is done.















Thursday, June 12, 2008

Differences between response.sendRedirect & response.forward methods

Came across one good explanation below, share with you guys out there:

Forwarding the Request and Re-Directing URL are two totally different animal. Your server gets the request from the browser..job of server is to send back the response. How how that response is generated is totally up to your server..you can process that request in one servlet or can process the same request using multiple sevlet...To process request using multiple servlet, you need to pass the request to another servlet...and ofcouse we do not want to loose the parameters/data set into the request otherwise that request does not make sense anymore.....This is all request forwarding!...Request forwarding is done during one HTTP request-response cycle..Once you return the response, you are done!

Now, In the response, you can tell your browser to do URL redirect to any other URL..this is HTTP header thing and browser will interprete the HTTP header and will send brand new request...