mysql - Unable to connect to database using jsp in ubuntu -
i trying connect mysql database in linux. know making mistake in including jar file. don't know how give reference jar files in linux way reference them in eclipse or netbeans. running jsp pages using tomat7.
type exception report
message exception occurred processing jsp page /first.jsp @ line 9
description server encountered internal error prevented fulfilling request.
exception
org.apache.jasper.jasperexception: exception occurred processing jsp page /first.jsp @ line 9
6: <% 7:
8: out.println("hello world!"); 9: class.forname("com.mysql.jdbc.driver"); 10: connection con=drivermanager.getconnection("jdbc:mysql://localhost:3306/meshliumdb","myuser","mypass"); 11: if(con!=null) 12: out.println("connection established");
stacktrace: org.apache.jasper.servlet.jspservletwrapper.handlejspexception(jspservletwrapper.java:568) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:455) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:727)
root cause
javax.servlet.servletexception: java.lang.classnotfoundexception: com.mysql.jdbc.driver org.apache.jasper.runtime.pagecontextimpl.dohandlepageexception(pagecontextimpl.java:916) org.apache.jasper.runtime.pagecontextimpl.handlepageexception(pagecontextimpl.java:845) org.apache.jsp.first_jsp._jspservice(first_jsp.java:86) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:727) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:727)
root cause
java.lang.classnotfoundexception: com.mysql.jdbc.driver org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1718) org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1569) org.apache.jasper.servlet.jasperloader.loadclass(jasperloader.java:126) org.apache.jasper.servlet.jasperloader.loadclass(jasperloader.java:63) java.lang.class.forname0(native method) java.lang.class.forname(class.java:191) org.apache.jsp.first_jsp._jspservice(first_jsp.java:73) org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) javax.servlet.http.httpservlet.service(httpservlet.java:727) org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:432) org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:390) org.apache.jasper.servlet.jspservlet.service(jspservlet.java:334) javax.servlet.http.httpservlet.service(httpservlet.java:727)
put mysql-connector-java-5.1.13-bin.jar file in web-inf/lib of directory present inside webapps of tomcat.
or
download mysql-connector-java-5.1.13-bin.jar , add using following procedure.
go project properties right clicking on project.
then click on libraries tab, see compile, run, compile tests, run tests tabs.
click on compile tab
click on add jar/folder button @ right
then browse , select jar files or folder want include. included jar files or libraries show on following box of compile tab.
click on ok button.
finished.
see link .
https://www.youtube.com/watch?v=vqhqy7u9rlc&feature=youtu.be
https://jsumon.wordpress.com/2009/11/24/adding-external-jar-or-library-to-netbeans-java-project/
Comments
Post a Comment