Hibernate中 Not binding factory to JNDI, no JNDI name configured(开发错误记录)

  1. 信息: building session factory  
  2. 2017-08-04 8:24:11 org.hibernate.impl.SessionFactoryObjectFactory addInstance  
  3. 信息: Not binding factory to JNDI, no JNDI name configured  
  4. 2017-08-04 8:24:11 org.apache.catalina.core.ApplicationDispatcher invoke  
  5. 严重: Servlet.service() for servlet jsp threw exception  
  6. java.lang.NullPointerException  
  7.     at org.apache.jsp.index_jsp._jspInit(index_jsp.java:29)  
  8.     at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)  
  9.     at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)  
  10.     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)  
  11.     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)  
  12.     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)  
  13.     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)  
  14.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)  
  15.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
  16.     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)  
  17.     at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:445)  
  18.     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:379)  
  19.     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)  
  20.     at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:159)  
  21.     at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)  
  22.     at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:373)  
  23.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:277)  
  24.     at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)  
  25.     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)  
  26.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  27.     at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)  
  28.     at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)  
  29.     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)  
  30.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  31.     at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)  
  32.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  33.     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)  
  34.     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)  
  35.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  36.     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)  
  37.     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)  
  38.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  39.     at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)  
  40.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  41.     at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)  
  42.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  43.     at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)  
  44.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  45.     at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)  
  46.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  47.     at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)  
  48.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  49.     at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)  
  50.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  51.     at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)  
  52.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  53.     at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)  
  54.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  55.     at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)  
  56.     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)  
  57.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  58.     at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)  
  59.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  60.     at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)  
  61.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  62.     at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)  
  63.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  64.     at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)  
  65.     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)  
  66.     at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)  
  67.     at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)  
  68.     at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)  
  69.     at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)  
  70.     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)  
  71.     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)  
  72.     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)  
  73.     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)  
  74.     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)  
  75.     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)  
  76.     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)  
  77.     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)  
  78.     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)  
  79.     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)  
  80.     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)  
  81.     at java.lang.Thread.run(Thread.java:619) 

中文意思:不装订工厂对 JNDI,配置的没有 JNDI 名字


可能导致的原因:
1.
// 开启事务
Transaction tran = session.beginTransaction();

2.
造成原因:
查询的时候主键查到了,外键查不到。





你可能感兴趣的:(Hibernate中 Not binding factory to JNDI, no JNDI name configured(开发错误记录))