标题:[求助] 我的mysql和jsp怎么连不上?
取消只看楼主
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
 问题点数:0 回复次数:15 
[求助] 我的mysql和jsp怎么连不上?
大家好, 我的mysql数据库怎么和jsp 文件连不上呢? 数据装好了,是不是驱动装的有问题?我把驱动装在lib目录里.如果是这儿的错那具体该怎么作呢?
搜索更多相关主题的帖子: jsp mysql 
2006-09-08 12:35
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 

tomcat 提示如下:



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: student/conn
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:244)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NoClassDefFoundError: student/conn
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
java.lang.Class.getConstructor0(Class.java:2640)
java.lang.Class.newInstance0(Class.java:321)
java.lang.Class.newInstance(Class.java:303)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:137)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:307)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


我靠~~问题多得很!
2006-09-08 17:57
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 

我是用bean连接的...
是不是我的驱动放错了地方.我放在了lib下边.


我靠~~问题多得很!
2006-09-08 17:58
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 

那我先试一下....


我靠~~问题多得很!
2006-09-09 22:03
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 
以下是引用球球在2006-9-9 22:40:40的发言:
JspServlet.java:244
HttpServlet.java:802
检查这里

数据库都好者.用户名与密码都对者呢.....
球球,那两句代码是那错了? 我都弄好两天了,还没连上....快帮帮我吧..


我靠~~问题多得很!
2006-09-10 00:06
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 
我刚才把Tomcat 5.0\common\lib下的mysql驱动mysql-connector-java-3.1.11-bin.jar删了.然后运行时,抛出异常,在页面的最上边写了一句英文,意思是没找到驱动.

可是当我在把mysql-connector-java-3.1.11-bin.jar在放回去时,又是如下提示(以前没见过这种提示,整个页面只是这些):


com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: java.net.ConnectException: Connection refused: connect STACKTRACE: java.net.SocketException: java.net.ConnectException: Connection refused: connect at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156) at com.mysql.jdbc.MysqlIO.(MysqlIO.java:284) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2541) at com.mysql.jdbc.Connection.(Connection.java:1474) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:171) at org.apache.jsp.mysql.mysql_jsp._jspService(mysql_jsp.java:55) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683) at java.lang.Thread.run(Thread.java:595) ** END NESTED EXCEPTION ** Last packet sent to the server was 0 ms ago.

我靠~~问题多得很!
2006-09-10 00:36
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 
版主和球球快帮我看看吧..我都快风了..................

我靠~~问题多得很!
2006-09-10 00:38
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 

这是原文件,大家看一下.


<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>

<html>
<body>
<%
String sDBDriver="com.mysql.jdbc.Driver";
String sConnStr="jdbc:mysql://localhost:3306/chen";
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
try{
Class.forName(sDBDriver);
con=DriverManager.getConnection(sConnStr,"root","chenxfu");
stmt=con.createStatement();
rs=stmt.executeQuery("select * from book");
while(rs.next()){
out.println(""+rs.getString(1)+"");
out.println(":"+"<br>");
out.println(rs.getString(2));
out.println(rs.getString(3));
}
rs.close();
}
catch(Exception e){
out.println(e);
}
%>
</body>
</html>


我靠~~问题多得很!
2006-09-10 20:14
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 
以下是引用韩峰在2006-9-10 20:27:34的发言:

写在main程序里 看看能不能编译

什么意思呢?? 我不懂,说明白一点吧..谢谢了


我靠~~问题多得很!
2006-09-10 21:07
fengxfu
Rank: 1
等 级:新手上路
帖 子:180
专家分:0
注 册:2006-7-22
得分:0 

先谢谢各位了,我现在真的是无言了. 没连上,还是先放一段时间吧.这样下去我肯定会疯.谢谢各位的帮助!~~


我靠~~问题多得很!
2006-09-10 23:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-88818-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.185886 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved