Reputation: 518
I am trying to deploy an app with tomcat.Everything works fine, except that i expected to have an error after deleting the connector file(mysql-connector-java-5.1.40) from the WEB-INF>lib directory, but,surprise, is still working without it. So, my question is if Tomcat is saving the conector elsewhere(i ve searched in Tomcat directories and found nothing). To start the Tomcat i use the startup.bat from bin directory of Tomcat. My simple code for mysql db connection:
public void jspInit() throws JSPException{
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");
pst.con.prepareStatement("insert into employee values(?,?,?)");
}
catch(Exception e{
e.printStackTrace();
}
}
Upvotes: 0
Views: 77
Reputation: 386
You can try a jmap -histo <PID>
if you have jmap on your system to make sure your have MySQL driver class actually loaded .
While your application is running you can also try something like lsof |grep ".*mysql.*jar"
to see if there's a jar but remember you could have sources somewhere too. (in that case just grep or find
it )
Upvotes: 0
Reputation: 8446
If you left Tomcat running as you deleted the MySQL driver jar, Tomcat will nevertheless have the Java bytecode for it loaded in the JVM. Did you restart Tomcat when you deleted the jar?
UPDATE
Look for...
CLASSPATH
environment variable set on this machine? Perhaps from another project?Upvotes: 1