日期:2014-05-18  浏览次数:20662 次

帮我看看这个错误java.lang.NullPointerException
这个一个上传的例子:
帮我看看这个错误java.lang.NullPointerException

java.lang.NullPointerException
at   org.apache.commons.fileupload.DefaultFileItem.write(DefaultFileItem.java:442)
at   org.apache.jsp.demo2_jsp._jspService(demo2_jsp.java:80)
at   org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at   org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at   org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at   javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at   org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at   org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at   org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at   org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at   org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at   java.lang.Thread.run(Unknown   Source)

------解决方案--------------------
没代码不知道
------解决方案--------------------
你用system.out.println()找找看哪个对象是NULL的先
------解决方案--------------------
简直是java版的“唇典”
------解决方案--------------------
at org.apache.commons.fileupload.DefaultFileItem.write(DefaultFileItem.java:442)。。。。
这个是在上传文件时的问题吧。。lz是不是在实现文件上传功能。。没具体代码也不清楚!!
------解决方案--------------------
晕,光这些神仙也解决不了

------解决方案--------------------
demo2_jsp.java:80行,看看哪个对象为NULL就OK了
------解决方案--------------------
这个是空指针异常啊!代码呢??
------解决方案--------------------
huihui0103 说的对!
这是空指针异常
------解决方案--------------------
DefaultFileItem.java 442行有个对象的引用为null。
------解决方案--------------------
jsp页面一定有null,你的页面套了java其中有变量有null存在,之后又引用了!