javaweb的一个问题,请各位大牛给看一下,下面上代码:

HTTP Status 500 - An exception occurred processing JSP page /ShowSongList.jsp at line 14

type Exception report

message An exception occurred processing JSP page /ShowSongList.jsp at line 14

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 /ShowSongList.jsp at line 14

11:


12: <%
13: SongDAO songDAO=SongDAOFactory.getSongDAOInstance();
14: List songList=songDAO.findAllSong();
15: pageContext.setAttribute("songList", songList);
16: %>
17:

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

root cause
java.lang.NullPointerException
com.sanqing.impl.SongDAOImpl.findAllSong(SongDAOImpl.java:65)
org.apache.jsp.ShowSongList_jsp._jspService(ShowSongList_jsp.java:84)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

4个回答

很明显的空指针异常,songDAO没获取到被

建议不要把java代码写在jsp中

SongDAOFactory工厂获取到了一个空的songDAO对象,看看你的工厂类是不是写错了

空指针异常。songDAO为空,查一下为什么获取不到

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问