I am having a simple dynamic web project in Eclipse.
I've added the mysql-connector under WEB-INF/lib and then added to build path.
It seems strange to me, that as long as I run my project as Java Application, the driver is loaded correctly and everything works fine.
But when I deploy the project to Tomcat, it starts throwing SQLException saying No suitable driver found for jdbc:mysql://.....
When I add it explicitly using Class.forName("com.mysql.cj.jdbc.Driver");
it works.
I tried to debug it and indeed no drivers are loaded when the project is deployed, but everything is loaded correctly, when running locally.
Could somebody exaplain that to me?