Shammer's Philosophy

My private adversaria

PostgreSQL JDBC Driver on tomcat8

I setup DB Application on tomcat8, host OS is Debian Jessie and JavaVM is OpenJDK 1.7.0_151.
At first, I used JDBC Driver which can be installed with apt-get, but it doesn't work fine. I saw a stack trace which is began with "java.lang.AbstractMethodError: org.postgresql.jdbc3g.Jdbc3gConnection.isValid()".
Some user faced with the same problem, but no one seems to be able to resolve.

This error was caused by using wrong JDBC Driver. The guideline which JDBC driver should be used is provided by postgresql, the link is https://jdbc.postgresql.org/download.html.

According to this site, the JDBC Driver 4.1 should be used on OpenJDK 1.7.0_151. The filename is postgresql-42.2.2.jre7.jar. Downloading this file and saving this file at /usr/share/tomcat8/lib on my Debian Jessie and restarting tomcat8 made the problem resolved.

I learned it is not good idea to depend on the apt-get.