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 app.devjav.com(this 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 app.devjav.com

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

XML Schema elementFormDefault meaning

When working with XML or Web service sometime you will get issue with namespaces  To make more clear and solve some issues relate this i will explain on this post the use of elementFormDefault on XML Schema

To understand how elementFormDefault affect to our XML document on validate with XML schema we need to understand following concepts:

  • Namespace
  • Global vs. Local elements
  • Qualified vs. Unqualified Elements

Continue reading XML Schema elementFormDefault meaning

java httpurlconnection 403 but not on web browser

Today i face with a issue when i use java HttpUrlConnection to connect to a site i alway get http code 403. I finally over come that issue after loose a couple of hours. So i write down here  a post and hope can help much people on this prolem. When you search and come to this post i think you can quickly find out solution here.


Some sites will enable to reject when connect to by none browser tool and our connect using HttpUrlConnection violate this rule so the site do not allow to connect.


To solve this issue we can bypass the rule by setting agent header for our connect to those sites

URL url= new URL("site you need connect here");

HttpURLConnection hConnection = (HttpURLConnection) url.openConnection();

hConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");



Maven to download dependencies

When you use maven to build and manage dependencies on a project and you want supply that project to other project without maven, i am sure you will get a question how i can copy all libraries this project depend on? In this post i will show you how to use maven to download dependencies.
To do that i using maven plugin Copying project dependencies. I add following lines to my pom.xml file

        <!--other plugin--->

With this config when we do maven -install command it will  copy all libraries that project is depended to target/lib folder.

org.hibernate.hql.ast.QuerySyntaxException: Class-name is not mapped

In this post i will guide you through how to solve below hibernate exception when using HQL

org.hibernate.hql.internal.ast.QuerySyntaxException: Class-name is not mapped

In my experience has many reasons for that exception. I will guide you step by step to check the issue

1. Check your hibernate config file hibernate.cgf.xml, do you have define that class yet or not in that file.  If you already define please go to next step

2. If you using hibernate mapping file, please naming for that file same as Class name.

3. If your persistence class define with annotation @Entity(name=’entity_name’) so please use that in HQL in case that you use unqualified name for example if your class is SystemParameter but you annotation @Entity(name=’param’) please use param name. Cause hibernate will use this alias name instead of class name.

4. If all above not work for you so please use full qualified name for example com.devjav.SystemParameter instead SystemParameter