ask a question

aodzl 2003-08-18 04:54:06
16:37:54,722 WARN [jbossweb] WARNING: Exception for /estore/version.jsp
java.lang.NullPointerException
at org.apache.jsp.version_jsp.getVersionNumberAndInfo(version_jsp.java:31)
at org.apache.jsp.version_jsp._jspService(version_jsp.java:142)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:360)
at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:558)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1714)
at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:507)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1664)
at org.mortbay.http.HttpServer.service(HttpServer.java:863)
at org.jboss.jetty.Jetty.service(Jetty.java:460)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:775)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:939)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:792)
at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:201)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:455)






...全文
117 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
aodzl 2003-08-19
  • 打赏
  • 举报
回复
哦,原来如此,谢谢大家哈~~~~~~
ouyangdong 2003-08-19
  • 打赏
  • 举报
回复
java.lang.NullPointerException //表示出现了什么异常。
at org.apache.jsp.version_jsp.getVersionNumberAndInfo(version_jsp.java:31)//表示这个异常出现在这个类的这个方法,在31行。
at org.apache.jsp.version_jsp._jspService(version_jsp.java:142)//表示这个类的这个方法在142行调用的getVersionNumberAndInfo所在的那个方法。下面的依次类推。
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
..............
hewei999 2003-08-18
  • 打赏
  • 举报
回复
看错误一般是第一个错误,你的第一个是 NullPointerException 这个用直译就是
“空 指针 异常”就是说你的程序中部分定义参数不可为NULL

你应该可以举一反三吧
aodzl 2003-08-18
  • 打赏
  • 举报
回复
哦。知道了。
不过,十八郎可不可以教我怎么看at 的错误信息?
呵呵,
谢谢先啦。
ouyangdong 2003-08-18
  • 打赏
  • 举报
回复
水晶?MM? 祝福...
ouyangdong 2003-08-18
  • 打赏
  • 举报
回复
at org.apache.jsp.version_jsp.getVersionNumberAndInfo(version_jsp.java:31):

这句话告诉你,你的空指针异常出现在方法getVersionNumberAndInfo里面,具体位置是31行。
你打开你的编辑器,看看31行是那一行,载你的代码哪儿也没有行的表示。调试的时候,你在代码中加入system.println("");语句,看看到那个地方的那个类是null.
zhousm6 2003-08-18
  • 打赏
  • 举报
回复
在version_jsp的getVersionNumberAndInfo里面函数找。
不过getVersionNumberAndInfo这个函数比较大,建议你分成几块打几个system.out出来,初步界定一下null的范围。
zhousm6 2003-08-18
  • 打赏
  • 举报
回复
在version_jsp的getVersionNumberAndInfo里面函数找。
aodzl 2003-08-18
  • 打赏
  • 举报
回复
原代码如下:(各位帮我看看,那错了。)
<%@ page language="java" %>
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.util.*,java.io.*,java.sql.*,com.hyi.cake.util.*" %>
<%!
private String versionInfo = "";
private String getVersionNumberAndInfo() {
String versionFileName = "version.htm";
String versionInfoFileName = "cstore.htm";
File versionFile = null;
File versionInfoFile = null;
Properties props = new Properties();
String version = null;
String version_main = null;
String version_detail = null;
String tmpPath = "tmp" + File.separator + "deploy" + File.separator
+ "Default" + File.separator + "estore.ear" + File.separator;
File jbossHomeDir = new File(".." + File.separator);
File deployDir = new File(jbossHomeDir, tmpPath);
String[] deployContent = deployDir.list();
File estoreWebRootDir = null;
for (int i = 0; i < deployContent.length; i ++) {
estoreWebRootDir = new File(deployDir, deployContent[i]);
if (estoreWebRootDir.isDirectory()) {
versionFile = new File(estoreWebRootDir, versionFileName);
versionInfoFile = new File(estoreWebRootDir, versionInfoFileName);
break;
}
}
if (versionFile != null) {
try {
FileInputStream in = new FileInputStream(versionFile);
props.load(in);
version_main = props.getProperty("version_main");
version_detail = props.getProperty("version_detail");
if (version_main != null && version_detail != null) {
version = version_main + "." + version_detail;
} else {
version = "Sorry, the version number can not be got!";
}
} catch (FileNotFoundException e) {
version = "Sorry, the version file is corrupt!";
} catch (IOException e) {
version = "Sorry, the IO exception found!";
}
} else {
version = "Sorry, the version file can not be found!";
}
if (versionInfoFile != null) {
try {
BufferedReader in = new BufferedReader(new FileReader(versionInfoFile));
String s = null;
while ((s = in.readLine()) != null) {
versionInfo += s + "<br>";
}
} catch (FileNotFoundException e) {
versionInfo = "Sorry, the version info file is corrupt!";
} catch (IOException e) {
versionInfo = "Sorry, the IO exception found!";
}
} else {
versionInfo = "Sorry, the version info file can not be found!";
}
return version;
}
%>
<%
String userID = (String)(session.getAttribute("userID"));
String userName = (String)(session.getAttribute("userName"));
// write log
Connection connLog = null;
java.sql.Statement stLog = null;
ResultSet rsLog = null;

Calendar curCalendarLog = Calendar.getInstance();
String nowLog = curCalendarLog.get(Calendar.YEAR)
+ "-" + (curCalendarLog.get(Calendar.MONTH)+1)
+ "-" + curCalendarLog.get(Calendar.DAY_OF_MONTH)
+ " " + curCalendarLog.get(Calendar.HOUR_OF_DAY)
+ ":" + curCalendarLog.get(Calendar.MINUTE)
+ ":" + curCalendarLog.get(Calendar.SECOND);

connLog = CakeConst.getJDBCConnection();
stLog = connLog.createStatement();
String sqlLog = "insert into log values(null,'"
+ nowLog +"','" + userName + "','0905','1')";
stLog.executeQuery(sqlLog);

try {
stLog.close();
connLog.close();
} catch (java.sql.SQLException se2) {
}
// end of log
%>
<p align=left>
CStore SC Version: <%= getVersionNumberAndInfo() %>
</p>
<br>
<p align=left>
<%=versionInfo%>
</p>
conning333 2003-08-18
  • 打赏
  • 举报
回复
空指针错误。应该是有对null对象的操作而引起。注意对变量的操作前先判断是否为null

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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