JDBC and Tomcat

I am writing my first application with Vaadin. I am an experienced Java developer but new to Vaadin, Maven, Tomcat, …

My application is just a simple CRUD application which uses a JDBC driver to contact my PostgreSQL database. I have learned that I can easily add this driver to my project by adding the following dependency to the pom.xml file:

<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>postgresql</artifactId>
  <version>9.4.1212</version>
</dependency

When I make a war file and run it on a Jetty (v9) server everything works fine but when running the same war file on a TomCat (v8) server I get an error: “No suitable driver found for jdbc …”.

Someone who knows what I’m doing wrong?

Thanks in advance for your help

You might have to explicitely load the driver before using it, see https://jdbc.postgresql.org/documentation/81/load.html. Jetty might handle this automatically.

-Pontus

Thanks, this works for me