When I try to get client IP address, I always get 127.0.0.1.
That is because the request when you see it in the servlet in Tomcat has been (reverse) proxied by the Apache front end, and the Apache <-> Tomcat traffic is going over the loopback network.
The solution is to check the headers added by the proxy; e.g. see @Alexey's answer.
A couple of things to note:
- This behaviour (proxies adding headers) is not specified by the HTTP specs. 
- Different proxies behave differently; e.g. they may add a different header. 
- A request may go through multiple proxies. 
- In general, there is no guarantee that a proxy is telling the truth, or that it will reveal the information at all. 
- The "ultimate" client IP address could be a NATed address ... meaning that you will have create difficulty identifying the true client.