Pessoal,
Tenho o Tomcat 6 e o MySql.
Quando rodo o código, abaixo, como uma aplicação java no eclipse tudo funciona Ok !
Mas quando conecto através de uma pagina .jsp dá erro !!!
O erro que dá está abaixo do código…
public class ConnectionFactory {
public static java.sql.Connection getConnection() throws SQLException
{
try {
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection("jdbc:mysql://localhost:3306/teste","root","");
} catch (ClassNotFoundException e) {
throw new SQLException(e.getMessage());
}
}
}
ERRO:
[color=red]29/06/2007 03:04:22 org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.sql.SQLException: com.mysql.jdbc.Driver
at br.com.caelum.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:13)
at br.com.caelum.jdbc.dao.ContatoDAO.(ContatoDAO.java:19)
at org.apache.jsp.listascriptlet_jsp._jspService(listascriptlet_jsp.java:60)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)[/color]
Onde está o problema ?
Obrigado