JSP调用hibernate DAO 方法报空指针出错[无解]

HTTP Status 500 -


type Exception report

message

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 /stock/order2002.jsp at line 94

91: 	if(Integer.parseInt(request.getParameter("intableId"))!=0){
92: 		OrderDaoImpl dao = new OrderDaoImpl();
93: 		System.out.println("**********"+Integer.parseInt(request.getParameter("intableId")));
94: 		Intable inTable = dao.getInTableById(Integer.parseInt(request.getParameter("intableId")));
95: 		
96: 		Iterator it = inTable.getInClothmns().iterator();
97: 		Warehouse wareHouse = null;


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:416)

 

root cause

java.lang.NullPointerException
	net.itaem.dao.OrderDaoImpl.getInTableById(OrderDaoImpl.java:143)
	org.apache.jsp.stock.order2002_jsp._jspService(order2002_jsp.java:156)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:416)

 

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.


Apache Tomcat/6.0.35

 

#放弃吧#程序上,代码是没有问题的,但调了N久,始终没解决。后来去网上查了资料,也有人说过这个问题,但也是没有解决方案。初步猜想出错原因,有可能是JSP容器,没有为hibernate 初始化session,导致无法调用DAO方法。。如果你也跟我一样调了好几个小时,始终没头绪的,建议还是放弃这种写法,毕竟已经违背了MVC原则,更何况还使用了SSH框架,这更不值得了。。也希望有能人能解决这问题。。 

 

posted @ 2013-06-21 13:39  叶汉城  阅读(1400)  评论(0编辑  收藏  举报