Hendra,
You wrote:
But there are times I get this stack trace when accessing database
I understand then that the error you are getting is intermittent.
In that case, I'm guessing the problem is caused by a timeout that is configured in the connection pool.
From the stack trace you posted, I get the impression that you are keeping the database connection open while the user browses your Web page and sometimes the user browses for such a long time that you hit the connection pool timeout.
If that is the case, I suggest reviewing your code.
Obtain a database connection immediately prior to performing a database operation and release the connection as soon as the operation has completed.
Are you hanging on to the database connection because you think that by doing so you are improving performance?
That is precisely the reason for using a connection pool, so that you don't have to keep the database connection open all the time in your app code.
Good Luck,
Avi.