中彩了:"com.caucho.vfs.ClientDisconnectException: connection reset by peer"这是啥意思??请指教!!

FarStar 2003-09-27 10:39:24
说一下环境:winxp,mysql 1.4,resin 3.0.3

写了个update的更新SQL语句,显示更新OK,但是还出现了一个"com.caucho.vfs.ClientDisconnectException: connection reset by peer"的提示,并且实际上更新没有成功!!!
直接在mysql的命令行方式下执行该update语句,执行正常!

这是啥意思??仔细看了好几遍也没找出什么毛病!郁闷!!

请各位指教一下!!
...全文
124 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
FarStar 2003-10-11
  • 打赏
  • 举报
回复
找到原因了,不好意思,犯了一个比较低级的错误!!

在2.jsp中<input type="submit" value="添加" onclick="ss(11)"> type为submit类型的,而在他的ss()中又提交了一次:form.submit()
提交动作进行了两次所以导致com.caucho.vfs.ClientDisconnectException: connection reset by peer。

终于解决了!!
FarStar 2003-10-09
  • 打赏
  • 举报
回复
第二个文件: 2.jsp

<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "java.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>
添加页面
</title>
<%!
int runType;
String Name;
public int StringToInt(String str){
if(str==null||str=="")
return -1;
else
return Integer.parseInt(str);
}
%>
<%
runType = StringToInt(request.getParameter("runType"));
Name = request.getParameter("Name");
%>
<script>
function ss(i){
form = document.form2;
form.runType.value = i;
form.submit();
}
</script>
</head>
<body bgcolor="#ffffff">
<form name=form2>
<input type=hidden name=runType value=<%=runType%>>
<%switch(runType){
case 1:
%>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="18" colspan=2 align=center><h1>添加页面</h1></td>
</tr>
<tr>
<td nowrap>名称:</td>
<td><input type=input name=Name value="" size=15></td>
</tr>
<tr>
<td colspan=2 ><input type="submit" value="添加" onclick="ss(11)">
<input type="reset" value="重写" ></td>
</tr>
</table>
<%
break;
case 11:
%>
<table width=80% align=center>
<%System.out.println(Name);%>
<tr>
<td ><h1>添加 <%=Name%> 成功</h1></td>
</tr>
<tr><td><h2>请查看控制台的输出窗口中连接是否被重置,Name被输出了两次!!</h2></td></tr>
<tr>
<td >
<input type=button name=close value="继续添加" onclick="document.location.href='2.jsp?runType=1'">  
<input type=button name=close value="页面复位" onclick="parent.pagereset()">
</td>
</tr>
</table>
<%
break;
default:
%>
<h1>请大家看看这个问题到底是什么原因造成的!怎么改?</h1>
<%
}
%>
</form>
</body>
</html>
FarStar 2003-10-09
  • 打赏
  • 举报
回复
关于这个问题的新进展!!!

费了好长时间终于确定了不是数据库连接的问题,可能是在页面中加了iframe导致的。至于什么原因导致的?怎么改正小弟还是不知道,只好求助于各位大侠!!!

把页面简化了一下,虽然功能少了,但是问题依旧在,请大家看看
一共2个页面!!

源码如下:
第一个文件: 1.jsp

<%@ page contentType="text/html; charset=gb2312" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>主页面</title>
<script>
function pagereset(){
document.all.mainFrame.src = "2.jsp";
}
function ManagerButton(i){
document.form1.runType.value = i;
document.all.mainFrame.src = "2.jsp?runType=" + document.form1.runType.value;
}
</script>
</head>
<body>

<h1>主页面</h1>
<form name="form1" method="post">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><input type="button" name="add" value="添加" onClick="ManagerButton(1)">
<input type="hidden" name="runType" value=""></td>
</tr>
<tr>
<td><hr></td>
</tr>
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> <IFRAME name=mainFrame src="2.jsp" frameBorder=0
noResize width="100%" height="200" allowTransparency></IFRAME>
</td>
</tr>
</table></td>
</tr>
<tr>
<td><hr></td>
</tr>
</table>
</form>
</body>
</html>

Geranium 2003-09-28
  • 打赏
  • 举报
回复
至少要看下你的相关代码才知道什么情况
FarStar 2003-09-27
  • 打赏
  • 举报
回复
说一下我程序的结构吧:

两个bean,一个是数据库连接的bean0,一个是实现jsp页面显示功能的bean1;一个jsp页面。

数据库bean0的结果也就是网上教程常见的那种类结构:connect()、close()、一个返回查询结果的executeQuery(),一个返回SQL语句执行是否成功的executeUpdate();其中executeQuery()和executeUpdate()都调用了connect()和Close()。

程序调用的顺序是:jsp页面调用bean1中的一个事件方法,该事件又调用了bean0中的executeUpdate()。

奇怪的是执行select、insert语句都没有问题,但是执行update语句就出现了毛病,要知道insert和update可都是调用executeUpdate()呀 :((

FarStar 2003-09-27
  • 打赏
  • 举报
回复
没有
Yssss1980 2003-09-27
  • 打赏
  • 举报
回复
你使用了连接池么?
Geranium 2003-09-27
  • 打赏
  • 举报
回复
可能你connect在一次使用完没有及时close,再重新建个connect时就报错了
jokerjava 2003-09-27
  • 打赏
  • 举报
回复
connection reset by peer
这句话的意思是连接被重置了

原因很多
FarStar 2003-09-27
  • 打赏
  • 举报
回复
再说明一点:上面的 0 lines 中的 0 是executeUpdate()的返回值
FarStar 2003-09-27
  • 打赏
  • 举报
回复
在resin的窗口中显示:
executeSql ok! 0 lines had changed!!
[15.16.35.609] com.caucho.vfs.ClientDisconnectException: connection reset by peer
executeSql ok! 0 lines had changed!!

其中“executeSql ok! 0 lines had changed!!”是我让程序在执行成功后输出的,0 lines说明没有记录被更新,当执行一次后0行没更新连接就reset了,再执行一次,结果还是0 lines
别的提示就没了
连个异常都没出!!怎么回事,那位大侠知道!!
jokerjava 2003-09-27
  • 打赏
  • 举报
回复
你急 也得说清楚是怎么回事啊

从你给的信息只能得到这句话

--> 连接被重置了

FarStar 2003-09-27
  • 打赏
  • 举报
回复
大家帮忙看看呀,等了一天了,还没解决,急呀!!!!

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧