it has nothing to do with the postgresql! It's your driver. Make sure you have the latest jdbc driver for PG!
since you are a java developer, it's no need to remind you the way to deal with jvm heap.
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size