ava.lang.NullPointerException异常

描述

HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception java.lang.NullPointerException cn.hrmzone.study.CodeReturn.doGet(CodeReturn.java:36) javax.servlet.http.HttpServlet.service(HttpServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.

原因

在servlet文件中,没有找到inputstream需要读入的文件。 这是因为在eclipse中,启动一个web后,读取文件是从exlipse的缓存中读取的,而不是直接从webcontent这个目录下读取的,因此,需要把相应的文件copy到: workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/hrblog