• Enter Slide 1 Title Here

    This is slide 1 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 2 Title Here

    This is slide 2 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

  • Enter Slide 3 Title Here

    This is slide 3 description. Go to Edit HTML of your blogger blog. Find these sentences. You can replace these sentences with your own words.

Sunday, October 8, 2006

[JBoss] Logging JBoss CMP SQL

JBossIn many occassions developers tend to get errors when calling the CMP finders. The best method to fix such issues is to view the generated SQL queries, as it's easy to understand the error in terms of general SQL rather than looking at the EJB-QLs.

With the help of log4j, CMP generated SQLs can be logged into a file as follows.

1. Goto the conf folder inside your server instance.
2. Open the log4j.xml file and add the following two entries to it.

<appender name="CMP" class="org.jboss.logging.appender.RollingFileAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="File" value="/log/cmpSQL.log"/>
<param name="Append" value="false"/>
<param name="MaxFileSize" value="800KB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.xml.XMLLayout"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>

<category name="org.jboss.ejb.plugins.cmp">
<priority value="DEBUG" />
<appender-ref ref="CMP"/>
</category>

With the above given entries, a file named cmpSQL.log will be created inside the log folder. SQLs send to the server will be logged into this file. If required, name and place of the log file can be changed by changing the value in File param.
<param name="File" value="/log/cmpSQL.log"/>


Monday, September 11, 2006

[JBoss 4] How to change port 8080 in JBoss?

With default configurations, JBoss listens on port 8080 for web connections. But this can be changed easily as this port is defined in an configuration xml file.

This is how port 8080 is changed on JBoss 4.

1. Goto the deploy folder of the server instance you use.
2. Goto the jbossweb-tomcat55.sar inside that deploy folder.
3. Find the file named server.xml inside that folder. (tomcat service file).


Look for the HTTP Connector section inside the server.xml where 8080 configuration is available. Change the port value to what ever the required port number.

This change wiill be available when JBoss is restarted.

Related Articles

Wednesday, September 6, 2006

What is ACID?

In database world, ACID is an acronym. It stands for; Atomicity, Consistency, Isolation and Durability. Databases should have these four features for them to become a reliable databases. All of these four features relate with transactions.

  • Atomicity:
    A transaction has to be completely commited or roll-backed, a portion of the transaction should not be committed to the database due to any issue even on a hardware failure.
  • Consistancy:
    After any transaction the data in the database should be correct and vailid according to the requirements. Database should not be having any illegal data after a transaction.
  • Isolation:
    When two or more transactions exists, one's behaviour should not give invalid data for the other transaction. That is, when one transaction is in progress, the data alterations made by that transaction should not be visible to any other transactions.
  • Durability:
    After the commit operation is aknowledged by the database, the data inside that transaction should not be lost. The updating of those data into the database has to be guaranteed.

Related Posts:
What is CRUD?

Monday, August 28, 2006

Happy birthday to me

Birthday Cake
My 26th birthday

You know...
Leo Tolstoy one of greatest Russian authors was also born in the same day as myself, but in 1928. If he was here, he would have celebrate his 178th birthday.

I'm not a author like him, but a good logical thinker (as I feel).

Sunday, August 27, 2006

"I tried" Vs "I did"

Court
< in a court >

Judge : You have tried to kill him, and trying to kill is same as killing. So you have done a crime. I demand you to pay money of Rs: 1,000,000/=.

(Verdict thinks for a while.... Put his hand into his bag. Count cash and take Rs: 1,000,000/= to his hand and try to give it to the officer who waits to collect money. Then puts that money back into his bag).

Judge : Why? Don't you pay money? You have to pay it !

Verdict: (Softly) I tried to give him the money which is same as giving money.

Judge: (puzzled !!!!)


Even though this story is a bit debatable, there's something to learn.

I think TRYING IS CONSIDERABLE, BUT NOT IMPORTANT AS MUCH AS DOING SOMETHING.

So better to avoid saying "Yes I tried, but ...".
Say "Yes, I did it".

What do you feel?

Tuesday, August 22, 2006

Today's To Do List


This is a To Do list that matches many people who stay infront of a computer for the whole day. "Playing Solitaire" can be changed with what ever the game you play so that it can exactly match you. At the end of the day if you think a bit, you'll recognize that you haven't done anything valuable but just wasted the day.

If you are one of those, it's time to change the list and add something important to the list.

But this do not apply to all of you.

Wednesday, August 2, 2006

Four liquid stages of life

This is how life goes from birth to death of many people in this world.

Tuesday, August 1, 2006

My first ever article published

I'm really happy to announce that my first ever article (a tutorial) got published yesterday, which was related to JUnit one of the greatest unit testing tools for Java.

You can have a look the tutorial at JUnit - Getting Started

This was first published on my blog and due to the comments and appreciations from the readers, I decided to publish it.

World Record Test Cricket Partnership - 624

The two Sri Lankan cricketers Mahela Jayawardana (captain) and Kumara Sangakkara (vice captain) put a world record partnership - 624 for any wicket on last Saturday (29/07/2007) against South Africa, a leading cricket team. This is the first time a partnership grew over 600 mark in cricket history.

In this brilliant knock the scorecard of the two players;
  • Mahela J - 374 (752 mins, 572 balls) with 43x4 & 1x6
  • Sangakkara K - 287 (675 mins, 457 balls) with 35x4

This is Sangakkara's 4th double hundred (& carrier best) while Mahela's first ever 300. This is the 21st time a player passed the 300 mark ever in history.

Updates for record books

World
  1. Best partnership for any wicket - 624 runs (& so the best partnership for the 3rd wicket as well)

    • 576 - Sanath Jayasuriya & Roshan Mahanama (SL) v IND 1997
    • 467 - Andrew Jones & Martin Crowe (NZ) v SL 1990

  2. Best scores by two batsmen in the same innings.

    • Garfield Sobers (unbeaten 365) and Conrad Hunte (260) for the West Indies against Pakistan in 1958

  3. 4th best score by a player (374)

    • 400 - Brian Lara, WI v ENG (2003)
    • 389 - Mathiew Hayden, AU v ZIM (2003)
    • 375 - Brian Lara, WI v ENG (1993)

  4. 6th top score in a inning by a team

    • 952-6d SL v IND (1997)
    • 903-7d ENG v AU (1938)
    • 849 ENG v WI (1929)
    • 790-3d WI v PAK (1957)
    • 758-8d AU v WI (1954)
Sri Lankan
  1. Best score by a player (374)

    • Previously held by Sanath Jayasuriya - 340 SL v IND (1997)

  2. 2nd Best score in a inning

    • 957 - SL v IND (1997)

[I believe these statistics are correct and if there's something missing just remind me]

And.....Congradulations
SL won this match by an innings and 153 runs.


This is a wonderful time for Sri Lankan cricket which reminds the 1996 world cup tournament. All cricket fans are waiting to see the coming adventures of Sri Lankan team while wishing their success.

All the very best guys.

Tuesday, July 18, 2006

Mastering Enterprise JavaBeans 3.0


Mastering Enterprise JavaBeans 3.0 book is publshed. I still could not read it but must be a great book, same as Mastering EJB Third Edition which we usually read when ever small clarification is needed on EJB.

The book is available for download in PDF format at theserverside.

I feel this is really a great work.

Monday, June 26, 2006

What is CRUD?


The word 'CRUD' is a acronym in the computer world. It stands for Create, Read, Update and Delete. Sometimes R in 'CRUD' is used for the word Retrieve and D for Destroy.

Most of the time 'CRUD' is related to SQL database operations as follows.
  • C: INSERT
  • R: SELECT
  • U: UPDATE
  • D: DELETE