首页 > 代码库 > SSH集成过程中遇到的问题及解决

SSH集成过程中遇到的问题及解决

1.出现了下面问题

页面显示为

  1 Struts Problem Report  2 Struts has detected an unhandled exception:   3   4 Messages: could not initialize proxy - no Session   5 could not initialize proxy - no Session - Class: org.hibernate.proxy.AbstractLazyInitializer File: AbstractLazyInitializer.java Method: initialize Line: 164 - org/hibernate/proxy/AbstractLazyInitializer.java:164:-1   6    7 File: org/hibernate/proxy/AbstractLazyInitializer.java   8 Line number: 164   9  10  11 -------------------------------------------------------------------------------- 12  13 Stacktraces 14 org.apache.jasper.JasperException: could not initialize proxy - no Session - Class: org.hibernate.proxy.AbstractLazyInitializer File: AbstractLazyInitializer.java Method: initialize Line: 164 - org/hibernate/proxy/AbstractLazyInitializer.java:164:-1  15     org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549) 16     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) 17     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) 18     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 19     javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 20     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 21     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 22     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 23     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 24     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 25     org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) 26     org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) 27     org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) 28     org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) 29     org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164) 30     org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) 31     com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371) 32     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275) 33     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100) 34     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 35     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100) 36     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 37     com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) 38     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 39     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) 40     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 41     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 42     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) 43     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 44     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 45     com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) 46     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 47     org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252) 48     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 49     com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) 50     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 51     com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) 52     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 53     com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) 54     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 55     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 56     org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) 57     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 58     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) 59     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 60     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 61     org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) 62     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 63     org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) 64     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 65     com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161) 66     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 67     com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) 68     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 69     com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) 70     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 71     org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) 72     org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563) 73     org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) 74     org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99) 75     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 76     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 77     org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) 78     org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) 79     org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) 80     org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) 81     org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 82     org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) 83     org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) 84     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 85     org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) 86     org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) 87     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441) 88     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430) 89     java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 90     java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 91     java.lang.Thread.run(Unknown Source) 92      93 could not initialize proxy - no Session - Class: org.hibernate.proxy.AbstractLazyInitializer File: AbstractLazyInitializer.java Method: initialize Line: 164 - org/hibernate/proxy/AbstractLazyInitializer.java:164:-1  94     org.apache.struts2.components.UIBean.end(UIBean.java:528) 95     org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) 96     org.apache.jsp.WEB_002dINF.views.emp_002dinput_jsp._jspx_meth_s_005fdebug_005f0(emp_002dinput_jsp.java:175) 97     org.apache.jsp.WEB_002dINF.views.emp_002dinput_jsp._jspService(emp_002dinput_jsp.java:140) 98     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 99     javax.servlet.http.HttpServlet.service(HttpServlet.java:727)100     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)101     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)102     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)103     javax.servlet.http.HttpServlet.service(HttpServlet.java:727)104     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)105     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)106     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)107     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)108     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)109     org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)110     org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)111     org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)112     org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)113     org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164)114     org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)115     com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)116     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)117     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100)118     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)119     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100)120     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)121     com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)122     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)123     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)124     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)125     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)126     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)127     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)128     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)129     com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)130     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)131     org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)132     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)133     com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)134     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)135     com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)136     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)137     com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)138     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)139     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)140     org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)141     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)142     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)143     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)144     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)145     org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)146     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)147     org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)148     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)149     com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)150     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)151     com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)152     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)153     com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)154     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)155     org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)156     org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)157     org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)158     org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)159     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)160     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)161     org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)162     org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)163     org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)164     org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)165     org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)166     org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)167     org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)168     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)169     org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)170     org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)171     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)172     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)173     java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)174     java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)175     java.lang.Thread.run(Unknown Source)176     177 org.hibernate.LazyInitializationException: could not initialize proxy - no Session 178     org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:164)179     org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:285)180     org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:185)181     com.atguigu.ssh.entities.Department_$$_javassist_1.toString(Department_$$_javassist_1.java)182     java.lang.String.valueOf(Unknown Source)183     java.lang.StringBuffer.append(Unknown Source)184     freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)185     freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)186     freemarker.core.Expression.getAsTemplateModel(Expression.java:89)187     freemarker.core.Expression.getStringValue(Expression.java:93)188     freemarker.core.StringBuiltins$StringBuiltIn._getAsTemplateModel(StringBuiltins.java:71)189     freemarker.core.Expression.getAsTemplateModel(Expression.java:89)190     freemarker.core.Expression.getStringValue(Expression.java:93)191     freemarker.core.DollarVariable.accept(DollarVariable.java:76)192     freemarker.core.Environment.visit(Environment.java:221)193     freemarker.core.IfBlock.accept(IfBlock.java:82)194     freemarker.core.Environment.visit(Environment.java:221)195     freemarker.core.MixedContent.accept(MixedContent.java:92)196     freemarker.core.Environment.visit(Environment.java:221)197     freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)198     freemarker.core.Environment.visit(Environment.java:428)199     freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)200     freemarker.core.Environment.visit(Environment.java:221)201     freemarker.core.MixedContent.accept(MixedContent.java:92)202     freemarker.core.Environment.visit(Environment.java:221)203     freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)204     freemarker.core.Environment.visit(Environment.java:428)205     freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)206     freemarker.core.Environment.visit(Environment.java:221)207     freemarker.core.MixedContent.accept(MixedContent.java:92)208     freemarker.core.Environment.visit(Environment.java:221)209     freemarker.core.Environment.include(Environment.java:1508)210     freemarker.core.Include.accept(Include.java:169)211     freemarker.core.Environment.visit(Environment.java:221)212     freemarker.core.MixedContent.accept(MixedContent.java:92)213     freemarker.core.Environment.visit(Environment.java:221)214     freemarker.core.Environment.process(Environment.java:199)215     freemarker.template.Template.process(Template.java:259)216     org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)217     org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:572)218     org.apache.struts2.components.UIBean.end(UIBean.java:526)219     org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)220     org.apache.jsp.WEB_002dINF.views.emp_002dinput_jsp._jspx_meth_s_005fdebug_005f0(emp_002dinput_jsp.java:175)221     org.apache.jsp.WEB_002dINF.views.emp_002dinput_jsp._jspService(emp_002dinput_jsp.java:140)222     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)223     javax.servlet.http.HttpServlet.service(HttpServlet.java:727)224     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)225     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)226     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)227     javax.servlet.http.HttpServlet.service(HttpServlet.java:727)228     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)229     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)230     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)231     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)232     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)233     org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)234     org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)235     org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)236     org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)237     org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164)238     org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)239     com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)240     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)241     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100)242     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)243     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100)244     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)245     com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)246     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)247     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)248     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)249     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)250     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)251     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)252     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)253     com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)254     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)255     org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)256     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)257     com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)258     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)259     com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)260     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)261     com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)262     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)263     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)264     org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)265     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)266     com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)267     com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)268     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)269     org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)270     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)271     org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)272     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)273     com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)274     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)275     com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)276     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)277     com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)278     com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)279     org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)280     org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)281     org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)282     org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)283     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)284     org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)285     org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)286     org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)287     org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)288     org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)289     org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)290     org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)291     org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)292     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)293     org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)294     org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)295     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)296     org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)297     java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)298     java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)299     java.lang.Thread.run(Unknown Source)300     301 302 --------------------------------------------------------------------------------303 304 You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set: 305 306   struts.devMode=false307 308 in your WEB-INF/classes/struts.properties file. 
View Code

控制台显示为

  1 org.hibernate.LazyInitializationException: could not initialize proxy - no Session  2     at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:164)  3     at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:285)  4     at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:185)  5     at com.atguigu.ssh.entities.Department_$$_javassist_1.toString(Department_$$_javassist_1.java)  6     at java.lang.String.valueOf(Unknown Source)  7     at java.lang.StringBuffer.append(Unknown Source)  8     at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)  9     at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) 10     at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) 11     at freemarker.core.Expression.getStringValue(Expression.java:93) 12     at freemarker.core.StringBuiltins$StringBuiltIn._getAsTemplateModel(StringBuiltins.java:71) 13     at freemarker.core.Expression.getAsTemplateModel(Expression.java:89) 14     at freemarker.core.Expression.getStringValue(Expression.java:93) 15     at freemarker.core.DollarVariable.accept(DollarVariable.java:76) 16     at freemarker.core.Environment.visit(Environment.java:221) 17     at freemarker.core.IfBlock.accept(IfBlock.java:82) 18     at freemarker.core.Environment.visit(Environment.java:221) 19     at freemarker.core.MixedContent.accept(MixedContent.java:92) 20     at freemarker.core.Environment.visit(Environment.java:221) 21     at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) 22     at freemarker.core.Environment.visit(Environment.java:428) 23     at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) 24     at freemarker.core.Environment.visit(Environment.java:221) 25     at freemarker.core.MixedContent.accept(MixedContent.java:92) 26     at freemarker.core.Environment.visit(Environment.java:221) 27     at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) 28     at freemarker.core.Environment.visit(Environment.java:428) 29     at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) 30     at freemarker.core.Environment.visit(Environment.java:221) 31     at freemarker.core.MixedContent.accept(MixedContent.java:92) 32     at freemarker.core.Environment.visit(Environment.java:221) 33     at freemarker.core.Environment.include(Environment.java:1508) 34     at freemarker.core.Include.accept(Include.java:169) 35     at freemarker.core.Environment.visit(Environment.java:221) 36     at freemarker.core.MixedContent.accept(MixedContent.java:92) 37     at freemarker.core.Environment.visit(Environment.java:221) 38     at freemarker.core.Environment.process(Environment.java:199) 39     at freemarker.template.Template.process(Template.java:259) 40     at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157) 41     at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:572) 42     at org.apache.struts2.components.UIBean.end(UIBean.java:526) 43     at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) 44     at org.apache.jsp.WEB_002dINF.views.emp_002dinput_jsp._jspx_meth_s_005fdebug_005f0(emp_002dinput_jsp.java:175) 45     at org.apache.jsp.WEB_002dINF.views.emp_002dinput_jsp._jspService(emp_002dinput_jsp.java:140) 46     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) 47     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 48     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) 49     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) 50     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 51     at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 52     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 53     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 54     at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 55     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 56     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 57     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) 58     at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) 59     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) 60     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) 61     at org.apache.struts2.dispatcher.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:164) 62     at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) 63     at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371) 64     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275) 65     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100) 66     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 67     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:100) 68     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 69     at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) 70     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 71     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) 72     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 73     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 74     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) 75     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 76     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 77     at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) 78     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 79     at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252) 80     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 81     at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) 82     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 83     at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) 84     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 85     at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) 86     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 87     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 88     at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) 89     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 90     at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239) 91     at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 92     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 93     at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73) 94     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 95     at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) 96     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 97     at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161) 98     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246) 99     at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)100     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)101     at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)102     at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)103     at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)104     at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)105     at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)106     at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)107     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)108     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)109     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)110     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)111     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)112     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)113     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)114     at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)115     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)116     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)117     at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)118     at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)119     at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)120     at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)121     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)122     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)123     at java.lang.Thread.run(Unknown Source)
View Code

2.解决方案

在web.xml中添加如下的配置信息

1 <filter>2         <filter-name>openSessionInView</filter-name>3         <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>4 </filter>5 <filter-mapping>6         <filter-name>openSessionInView</filter-name>7         <url-pattern>/*</url-pattern>8 </filter-mapping>
View Code