jsp调用jasper文件报空指针错误
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jsp调用jasper文件报空指针错误相关的知识,希望对你有一定的参考价值。
java.lang.NullPointerException
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
at net.sf.jasperreports.engine.JasperRunManager.runReportTohtmlFile(JasperRunManager.java:441)
at org.apache.jsp.text_jsp._jspService(text_jsp.java:80)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:332)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:237)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
你很有意思啊
参考技术B 空指针错误一般是那个变量没有初始化 你试着把变量print试试 参考技术C 把代码贴出来。。。jsoup解析本地html文件,老是报空指针错误,求大神指导,小菜鸟一枚,代码如下:
package jsouptest;
import java.io.File;
import java.io.IOException;
//import java.lang.*;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
public class test0
public static void main(String args[]) throws IOException
File input=new File("D:/maopu.html");
//File input=new File("maopu.html");
Document doc=Jsoup.parse(input, "UTF-8", "");
Element content=doc.getElementById("content");
Elements links=content.getElementsByTag("a");
for(Element link:links)
String linkHref=link.attr("href");
System.out.println("\n"+linkHref);
Elements links=content.getElementsByTag("a");
这一句
你的content没有被正确取出,所以content是空。
推荐你使用doc.select("#content").first();本回答被提问者和网友采纳 参考技术B File input=new File("D:/maopu.html");这个应该是错误的吧?能找到该文件?》?
还有就是你的每一个节点是否都有且没有拼写错误
还有每个对象在使用前判断不是null后,再对它引用就更加规范 参考技术C 确定你的Html里面有id=content这个东西吗
以上是关于jsp调用jasper文件报空指针错误的主要内容,如果未能解决你的问题,请参考以下文章
JSONObject.getString()报空指针错误,求帮助
终极解决方案 at org.apache.jsp.index_jsp._jspInit(index_jsp.java:22) 报空指针