I was having this problem until I saw this post from newsgroup.
As famous Bruce Armstrong said,
You need to try avoiding doing things that cause focus change in events that are responses to focus changes. You might post from the rowfocusechanging event to your code, or post to another event that displays the error message *after* the rowfocusechanging event has finished.
So my final code in rowfocusechanging event looks like this,
li_rc = rte_body.event ue_checkLength() //No messagebox should popup in this event, otherwise it will pop twice.
if li_rc < 0 then
rte_body.event post ue_showErrMsg(li_rc)
// Do not change row focus.
Also, don’t try to test java class and dotnet assembly in the same page. I was confused sometimes even it works!