[code="java"]
public Manuscript selectByMaid(int id) throws Exception {
Manuscript manuscript = (Manuscript) this.getHibernateTemplate().get(
Manuscript.class, id);
return manuscript;
}
[/code]
这段代码是运行成功的
[code="java"]
public void exportMan(int maid, String name, OutputStream os) throws Exception{
Manuscript m = (Manuscript) this.getHibernateTemplate().get(
Manuscript.class, maid);
}
[/code]
这两个方法是属于同一class里面的 但是报下列错误
[code="java"]
java.lang.NullPointerException
at com.kinrich.mediaStorage.daoimp.ManuscriptDaoImp.exportMan(ManuscriptDaoImp.java:99)
at com.kinrich.mediaStorage.action.ManuscriptAction.getDownloadFile(ManuscriptAction.java:266)
at org.apache.jsp.templates.downinfo_jsp._jspService(downinfo_jsp.java:93)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.kinrich.mediaStorage.Interceptor.CheckInterceptor.doFilter(CheckInterceptor.java:38)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:722)
[/code]
请问这个问题是出在哪里 我调试的时候显示的是this.getHibernateTemplate()为空 但是同一类里面 为什么会有两个结果呢?