null错误
有什么地方出现null值了
是不是你连接没关掉,连接池满了哦?

解决方案 »

  1.   

    你是每此刷新的errlog或outlog里都有以上错误,还是弟10次才有?
    如果是第10次才有, 你用到数据库连接吗? 有的话, 可能就是没有释放数据库连接!
      

  2.   

    每次数据库操作完毕,在Finally里面请关闭Connection,或者释放回连接池
      

  3.   

    你有没有用session?如果用了可能会话过期了
      

  4.   

    很明显是index.jsp的第21行出现了NullPointerException
    看看是哪个对象为null了而调用了其方法
    每次刷新都会执行服务端的代码将index.jsp贴出来!!!!
      

  5.   

    <%
    /*
    作者:黄圣兵
    修改:翟耀纲
    修改描述:添加热点新闻的链接
    日期:2004-1-19
    */
    %><%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"  %>
    <%@ include file="inc/connlogin2.jsp"%><%
    ResultSet rs;
    String sql;
    sql="select * from setup ";
    rs=conn.executeQuery(sql);
    rs.next();
    String stop,StopMessage,Title,Description,Keywords,SendMail,Emailadd,BanStr;
    int Count,CountType;
    stop=rs.getString("stop").trim();
    StopMessage=rs.getString("StopMessage");
    Title=rs.getString("title");
    Description=rs.getString("description");
    Keywords=rs.getString("keywords");
    SendMail=rs.getString("sendmail");
    Emailadd=rs.getString("email");
    BanStr=rs.getString("BanStr");
    Count=rs.getInt("count");
    CountType=rs.getInt("counttype");
    if (stop.equals("1") )
        {out.print(StopMessage);
    return;} %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <META content="<%=Description%>"
    name=DESCRIPTION>
    <META content=<%=Keywords%>  name=keywords>
    <title><%=Title%></title>
    <link href="main.css" rel="stylesheet" type="text/css">
    <script language="javascript" src="inc/fly.js" ></script>
    <%
    rs.close();
    java.sql.ResultSet sqlRst; //结果集对象
    sqlRst=conn.executeQuery("select * from pop_win where is_use='1' order by pop_id desc");
    while(sqlRst.next())
    {%>
    <script>
    window.open ("popwin.jsp", "newwindow", "height=<%=sqlRst.getString("win_height")%>, width=<%=sqlRst.getString("win_height")%>, top=0, left=0, toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no")
    </script>
    <%}
    sqlRst.close();%>
    </head>
    <%java.sql.ResultSet sqlRst_fly; //结果集对象sqlRst_fly=conn.executeQuery("select * from fly_pic where is_use='1' order by link_id desc");
    if(sqlRst_fly.next())
    {%>
    <body onLoad="floater()" bgcolor=#cccccc>
    <div id=floater style="HEIGHT: 0px; POSITION: absolute; WIDTH: 0px; left: 185px; top: 73px; z-index:100" ><a href= target=_blank><img border=0 src=admin/flypic/pic/<%=sqlRst_fly.getString("pic_path")%> height="<%=sqlRst_fly.getString("pic_height")%>" width="<%=sqlRst_fly.getString("pic_width")%>"></a> 
    </div><%}
    else{%>
    <body bgcolor=#cccccc>
    <%}
    sqlRst_fly.close();%>
    <%@ include file="title.jsp"%>
    <table width="760"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      <tr valign="top"> 
        <td width="180" class="box1"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td class="box1-line-4"><img src="images/xxi.jpg" width="180" height="19" border="0"></td>
            </tr>
            <tr> 
              <td bgcolor="#E7E3E7" class="box1-line-4"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
                  <tr> 
      

  6.   

    <td> <img src="images/arrok.gif" width="10" height="11"><a href="cgs.jsp">车辆及驾驶员管理业务<br>
                      </a> 
                      <%@ include file="inc/bszn_bar.jsp"%>
                    </td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td bgcolor="#E7E3E7" class="box1-line-4"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
                  <tr> 
                    <td><%@ include file="inc/bszn_list.jsp"%> </td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td class="box1-line-4"><img src="images/arr5.gif" width="179" height="18" border="0"></td>
            </tr>
            <tr> 
              <td align="center" class="box1-line-4"><%@ include file="inc/pic_link_list.jsp"%>&nbsp; 
                
    </td>
            </tr>
            <tr> 
              <td><div align="center"> <script src="http://61.151.248.125/mystat.asp?style=counter&username=sitelogdemo"></script></div></td>
            </tr>
          </table>
        </td>
        <td width="10"><img src="images/spacer.gif" width="10" height="10"></td>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td background="images/do.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td><img src="images/arr2.gif" width="132" height="39" border="0"></td>
                    <td align="right"><font color="#333333"><a href="news.jsp">&gt;&gt;更多</a></font></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                 <%ResultSet rs_hot=conn.executeQuery("select * from info_details where mod_id=56 and not  (attachment is null) and status='3' and rownum<=1 order by  info_id desc");
    while(rs_hot.next())
    { String attachment;
       attachment=rs_hot.getString("attachment");
    %>
      <tr> 
                    <td width="130" align="center" class="box2-1"> <img src="admin/news/pic/<%=attachment%>" width="160" height="120">&nbsp; 
                    </td>
                    <td align="left" valign="top" class="box2-2"><a  href='show_news.jsp?info_id=<%=rs_hot.getString("info_id")%>'><strong><%=rs_hot.getString("subject")%></strong><br><br>
                      &nbsp;<%=getcontent(conn.clob2string(rs_hot.getClob("content2"))).substring(0,80)%> ...</a></td>
                  </tr><%}
      rs_hot.close();%>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                  <tr> 
                    <td class="newslist"></td>
                  </tr>
                </table>
                <%@ include file="inc/news_list.jsp"%>
                &nbsp; </td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellspacing="0" cellpadding="5">
                  <tr> 
                    <td align="left">  <jsp:include page="inc/show_ad.jsp" > 
      <jsp:param name="mod_id" value="99"/>
      <jsp:param name="width" value="350"/>
      <jsp:param name="height" value="35"/>
      </jsp:include>&nbsp; </td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td background="images/do.gif"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr> 
                    <td><img src="images/arr1.gif" width="132" height="39" border="0"></td>
                    <td align="right"><font color="#333333"><a href="doc.jsp">&gt;&gt;更多</a></font></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td class="newslist"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                  <tr> 
                    <td></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td><%@ include file="inc/law_list.jsp"%>&nbsp;</td>
            </tr>
          </table></td>
        <td width="180" bgcolor="#42AAF7"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
            <tr> 
              <td><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ADCBFF">
                  <tr> 
                    <td><img src="images/b1.gif" width="100" height="22" border="0"></td>
                    <td align="right"><FONT color="white">more</font></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellspacing="0" cellpadding="5">
                  <tr> 
                    <td height="200"><marquee onMouseOut=this.start() onMouseOver=this.stop() border="0" direction="up" scrolldelay="75" scrollamount="1" width="170" height="200"> <%@ include file="inc/bbs_list.jsp"%>
                       </marquee></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ADCBFF">
                  <tr> 
                    <td><img src="images/arr8.gif" width="100" height="22" border="0"></td>
                    <td align="right">&nbsp;</td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td> <table width="100%"  border="0" cellspacing="0" cellpadding="5">
    <form action=search.jsp name=search method="post">             
     <tr> 
                    <td>搜索: 
                      <input type="text" name="keyword" value="输入关键字" size="12"> 
                      <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="text-decoration:none;"> 
                      <select style="font-family:宋体; font-size:9pt; background-color:white; border-width:1px; border-color:yellow; border-style:solid;" size="1" name="type">
                        <option value="news.jsp" selected>新闻动态</option>
    <option value="doc.jsp" >政策法规</option>
    <option value="download.jsp" >常用表格</option>
    <option value="cljz.jsp" >车驾管理</option>
    <option value="bszn.jsp" >办事指南</option>
                      </select>
                      <br>
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><img src="images/chaxun.gif" width="46" height="17" border="0"onclick="search.action=type.value;search.submit()"> 
                    </td>
                  </tr></form>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ADCBFF">
                  <tr> 
                    <td><img src="images/arr3.gif" width="100" height="22" border="0" onclick="search.submit()"></td>
                    <td align="right"><FONT color="white">more</font></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellspacing="0" cellpadding="5">
                  <tr> 
                    <td></td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#ADCBFF">
                  <tr> 
                    <td><img src="images/arr6.gif" width="100" height="22" border="0"></td>
                    <td align="right">&nbsp;</td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td><table width="100%"  border="0" cellspacing="0" cellpadding="5">
                  <tr> 
                    <td><%@ include file="inc/link_list.jsp"%>&nbsp;</td>
                  </tr>
                </table></td>
            </tr>
            <tr> 
              <td>&nbsp;</td>
            </tr>
          </table></td>
      </tr>
    </table><%@ include file="inc/copyright.jsp"%>
      

  7.   

    你的哪个页面肯定从其它也面得到了数据,然后刷新后就null拉.
      

  8.   

    對數據庫操作完要rs.close();con.close();
      

  9.   

    ......从代码看没有一句错误处理的代码......正是老外所说的"典型的中国人的程序",也是中国软件被瞧不起的原因........最基本的要用一个不是才定义的对象的方法时,先判断是否是null,并做相应处理include 了inc/connlogin2.jsp,有可能错误在其中也不一定
    conn是connlogin2.jsp中定义的,可能是其有问题?想想表setup中要没有记录会是什么情况?????
    写代码要考虑所有可能的情况,并养成良好的错误处理习惯!!!!
      

  10.   

    或者你在页面之间,用到session传值,或其它方式传值,没有很好的控制。
    第二个,就是在连库文件中没很好的控制连接。
      

  11.   

    你在include中怎么创建的连接?又在include中怎么关闭的连接?能给贴出来看看吗?
      

  12.   

    估计不是资源耗尽的问题,如果是读写文件,那就肯定是指针下移的无法!
    或者你本身不支持回滚,你却硬要回滚就会造成这样如果是读取数据库,那这个问题很容易解释了,简单没有判断有无结果就NEXT,大概道理就是读取了没有的数据造成的,很容易理解,看看自己的循环,应该可以找到问题的根源