Question: exception in thread main while running servlet
I got exception in thread main no such method error while running servlet. I have added servlet.api.jar file in classpath.my classpath is C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Demo\WEB-INF\lib\mysql-connector-java-5.1.22\mysql-connector-java-5.1.22-bin.jar
Put mysql-connector-java-5.1.22-bin.jar in tomcat lib also. Restart your server then run your code.
tnx for rply.my problem got solved when i set classpath=%classpath%;.; fom cmd prompt.Now this exception got resolved but browser doesnot show out put.When i tried database conn code in java pgm having main method it runs properly .But when i added same code to servlet browser doesn't show any output.control doesn't reach toward Class.forName(com.mysql.jdbcDriver).the line before class.forName got printed but line after not printed
May be becoz of mysql jar file.its not recognized by tamcat.can u show ur code?