What happened to me is that, due to a connection problem, my download of postgresql-42.2.4.jar yielded an empty file, 0 bytes. I didn't notice it at first because the file was there, so I thought it was ok.
So just make sure that your postgresql-42.2.4.jar is OK. Maybe re-download it.