tomcat的报错问题,谁看的懂啊 ?难 !
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
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)
root cause
java.lang.NullPointerException
org.pan.web.bookclasslist.excute(bookclasslist.java:38)
org.apache.jsp.index_jsp._jspService(index_jsp.java:97)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
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.
出错的地方是不是 bookclasslist.java:38 index_jsp.java:97
可是我的程序里只有 bookclasslist.java和 index.jsp 并没有index_jsp.java:97
请问这是怎么回事 ? 急 !
下面是bookclasslist.java的代码 第38句是 rs=stmt.executeQuery(getSql());
package org.pan.web;
import java.sql.*;
import java.util.Vector;
import org.pan.util.*;
import org.pan.web.book.bookclass;
/**
* Title: 商品类别列表
* Description:
* Copyright: Copyright (c) 2007
* Company: 湖南农大信息学院
* @author: sushengwei
*/
public class bookclasslist extends DataBase {
private Vector classlist;//商品类别向量数组
public bookclasslist() throws Exception{
super();
}
public Vector getClasslist() {
return classlist;
}
public String getSql() {
sqlStr = "select id,classname from my_Bookclass order by id ";
return sqlStr;
}
public boolean excute() throws Exception {
int id = 0;
String classname = " ";
int rscount = 0;
try {
rs = stmt.executeQuery(getSql());
rscount = stmt.getMaxRows();
classlist = new Vector(rscount+1);
classlist.clear();
while (rs.next()){
id = rs.getInt( "id ");
classname = rs.getString( "classname ");
bookclass bc = new bookclass(id,classname);
classlist.addElement(bc);
}
rs.close();
return true;
}
catch (SQLException sqle){
System.out.println(sqle);
return false;
}
}
};
[解决办法]
就是这两个文件,bookclasslist.java和 index.jsp
文件编译后会成为上面的那种格式,你可以C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\risenetoabjcz\org\apache\jsp\riseway
到你的相关的路径去看编译运行后的文件就是这个样子。
[解决办法]
java.lang.NullPointerException
跟一下吧,看看那个变量,为空的时候你调用了它的方法。
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.myexception.cn/java-web/317.html