Category Archives: Java

Tomcat – Disable JSESSIONID in URL

When doing Testing to cover PCI Requirement 6, i face with issue exposed session id  in url, so i write this guie to help other one sort down their time to fix this issue. To fix this issue we have some solutions depend on environment.;jsessionid=557206C363324F1267A24AB769CA0DE4529.node01

1.Tomcat 6

In tomcat 6 we can disable by using disableURLRewriting. We create context.xml file and put following lines and make sure cookie is enable

<?xml version='1.0' encoding='utf-8'?>
<Context docBase="PATH_TO_WEBAPP" path="/CONTEXT" disableURLRewriting="true">

2 . Tomcat 7 or above

With Tomcat 7 or above we can add follow lines into web.xml


Or we can using programatic



java.lang.NoClassDefFoundError maven project

1. Symptom

Maven project build well but get failure when running in eclipse with the issue


2. Cause
This issue happen cause jars files is missing at run-time. It do not deploy properly in eclipse when running.

3. Fix
You can right click to project and choose Properties->Deployment Assembly and make sure Maven Dependencies in list


Spring security remember me

Follow the post about Spring Security, in this post I will guide how to implement Spring Security remember me to your spring web application. Remember me is a convenient feature that allow user automatically logged to application without need to enter username and password.

Spring security provide two difference implement of remember me service Token-based remember me and Persistent remember me service Continue reading Spring security remember me

How to configure Apache 2 with Tomcat

Today i will guide how to install and configure apache 2 with tomcat on Centos server using mod_proxy plugin

Scenario of this configuration:

  • Server A install web server apache and have domain domain already point to server A)
  • Server B install tomcat server listen on port 8080
  • We need allow user access application run on tomcat server in server B through  domain

Continue reading How to configure Apache 2 with Tomcat

Spring scheduler – cron expression

When working with spring scheduler, you will see we can use cron expression to configure when scheduled task will run. In this post  i will help you to know how cron expression work.

Cron expression is six fields that separate by single space. Below is ordinary of field from left to right with possible values.

Position Name Possible Values Special Character
1 Second 0-59 , / * -
3 Hour 0-23 , / * -
4 Day of month 1-31 , / * – ?
5 Month 1-12 or JAN-DEC , / * -
6 Week day 1-7 or MON-SUN , / * – ?


  • ,: list possible values
  • / sequence
  • *: every possible values
  • -: rage from two numbers
  • ?: unspecific value

Some examples:

  • 0/5 * * * * *: for every five second
  • * 0-59/2 * * * *: for every two minutes: 0,2,4,8…58
  • * * 2,14 * * MON-FRI: run on 2am and 2 pm from Monday to Friday