访问jsp报错org.apache.jasper.JasperException: java.lang.NullPointerException的解决办法

访问jsp报错org.apache.jasper.JasperException: java.lang.NullPointerException的解决办法

 

问题描述:
将java web工程部署到tomcat中,启动tomcat打开jsp页面出现
org.apache.jasper.JasperException: java.lang.NullPointerException错误。

根本原因:
这是由于项目中build path中加载的一些包与tomcat中的包重复在项目中删除对应的包就行

问题详情:
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:416)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)

解决办法:
工程/WEB-INF/lib下面看有没有servlet-api.jar、jsp-api.jar 等在tomcat的lib目录下面已经存在的jar包, 如果有则删除。重启后,问题解决。

 

相关链接:
org.apache.jasper.JasperException: java.lang.NullPointerException的解决办法

 

 

HTTP Status 500 - An exception occurred processing JSP page /Student.jsp at line 34 type Exception report message An exception occurred processing JSP page /Student.jsp at line 34 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /Student.jsp at line 34 31: ResultSet rs=null; 32: //通过ConnDB创建一个Connection对象,用于执行对数据库的连接操作 33: conn=ConnDB.connection(); 34: stat=conn.createStatement(); 35: rs=stat.executeQuery("select * from Student"); 36: %> 37: <br> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:579) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.lang.NullPointerException org.apache.jsp.Student_jsp._jspService(Student_jsp.java:152) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/8.0.52 logs.
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值