August 2012 Posts

Setting Up C3P0 Connection Pooling on Apache Tomcat

My using this configuration on my Apache Tomcat 7 for my heavy-load application, and it runs very well. I put this code on context.xml under Apache Tomcat’s conf folder.

<Resource name="myconnection" auth="Container"
	acquireRetryAttempts = "0"
	acquireRetryDelay = "3000"
	breakAfterAcquireFailure = "false"
	maxConnectionAge = "60"
	maxIdleTime = "30"
	maxIdleTimeExcessConnections = "10"
	idleConnectionTestPeriod = "15"
	testConnectionOnCheckout = "true"
	preferredTestQuery = "SELECT 1"
	debugUnreturnedConnectionStackTraces = "true"	

I use MySql’s command “SHOW PROCESSLIST” for checking on opened connection to MySql.

I hope it helped others.


Selamat Idul Fitri 1433H 2012AD

Let’s write all the mistakes down in the sand
And let the wind of forgiveness erase it away
Happy Idul Fitri, Minal Aidin wal Faidzin

Kartu Lebaran 1433H 2012AD


Menteri Sosial RI, Salim Segaf Al-Jufri yang Mirip dengan Admiral Kizaru

Sekedar iseng, entah kenapa waktu gw lagi liat-liat daftar Menteri di Wikipedia, perhatian gw tertuju kepada salah satu menteri di kabinet Indonesia Bersatu jilid 2, yaitu Bapak Salim Segaf Al-Jufri. Gw perhatikan sekilas beliau mirip-mirip dikit dengan Admiral Kizaru dari manga One Piece, berikut sekilas perbandingannya.

mirip kan? (Y)


Beginning Sitemesh

In this tutorial, im trying to create a simple application using Sitemesh. According to Wikipedia, Sitemesh is a web-page layout and decoration framework and web application integration framework to aid in creating large sites consisting of many pages for which a consistent look/feel, navigation and layout scheme is required. So basically, Sitemesh is a templating engine or a decorator pattern.

Let’s start with a simple application, first is a maven’s pom.xml

<project xmlns="" xmlns:xsi=""


    <name>SitemeshExample Web App</name>





and this is my web.xml file,

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="" xmlns:xsi="" xsi:schemaLocation="">

next step is creating decorators.xml under WEB-INF folder

<?xml version="1.0" encoding="UTF-8"?>
        <pattern>/index.jsp</pattern> <!-- exclude example -->
        <pattern>*.js</pattern> <!-- exclude css files -->
        <pattern>*.css</pattern> <!-- exclude js files -->
    <decorator name="basic-theme" page="/template/theme.jsp">        

and a base html template

<?xml version="1.0" encoding="UTF-8" ?>
<%@ taglib uri="" prefix="decorator" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
    <decorator:body />

And 2 .jsp files for example, index.jsp and dodol.jsp

    <h2>Hello WORLD...!! (Without Sitemesh)</h2>

and dodol.jsp

    <h1>Hello World! (With Sitemesh)</h1>

these is the screenshot when i deploy my application,

and this is my netbeans project structure


A Weird SpringSource Tool Suite (STS) Error, “No Java Virtual Machine was Found”

I had this weird error when i execute my Springsource Tool Suite, somehow it cannot found my JRE.

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run STS. 

It looks like my “-vm” argument in STS.ini file still pointing at my uninstalled JRE location. I just do some minor change and replace it to my existing JDK location and my STS is running again.

Simple isnt it?