getHibernateTemplate 抛出NullPointer 异常 其中一个容易被忽略的原因

2012-1-31 16:15:45 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [action] in context with path [/address] threw exception [java.lang.NullPointerException] with root cause java.lang.NullPointerException at com.wl.addr.hibernate.dao.AddressDAO.delete(AddressDAO.java:104) at com.wl.addr.struts.actions.AddressAction.delete(AddressAction.java:171) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at


action里new了两个DAO,可能是直接new的,也可能是调用其他方法时又new了一次 , 导致错误

posted @ 2012-03-30 21:01  able锋  阅读(520)  评论(0编辑  收藏  举报