Search code examples
tomcatamazon-ec2amazon-web-servicesdatabase-connectionconnector-j

How to copy Connector/J Jar to lib folder of Tomcat7 on Amazon EC2?


I am using Connector/J as JDBC driver for setting up a connection pool between Tomcat7 and MySQL 5.5 installed on an Amazon EC2 instance. I am getting the following error when I am trying to access MySql from Java Servlet

Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

I think the error is because I have not copied the Connector/J in the lib folder of Tomcat7.

My Question

How to copy Connector/J Jar to lib folder of Tomcat7 on Amazon EC2?


Solution

  • Upload it into the relevant /lib folder, if it the servers common pool put it into /commons/lib of the server (or ask your administrator to put it into the servers /commons/lib as specified in its configuration info), If its loaded by the application with a dynamic connection pool and context then it goes in the applications home /WEB-INF/lib folder.