ssh整合案例出了could not initialize proxy - no Session 问题,那个大神帮我看看

在做SSH项目时,控制台出现这个错误,请大神帮忙看看啊
2017-04-14 11:15:57,902 DEBUG (org.springframework.beans.factory.support.DefaultListableBeanFactory:1140) - Added autowiring by name from bean name ‘cn.bdqn.jboa.action.EmployeeAction‘ via property ‘employeeBiz‘ to bean named ‘employeeBiz‘
2017-04-14 11:15:58,024 DEBUG (org.apache.struts2.interceptor.FileUploadInterceptor:72) - Bypassing //login
2017-04-14 11:15:58,032 DEBUG (org.springframework.beans.factory.support.DefaultListableBeanFactory:245) - Returning cached instance of singleton bean ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘
2017-04-14 11:15:58,032 DEBUG (org.springframework.beans.factory.support.DefaultListableBeanFactory:245) - Returning cached instance of singleton bean ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘
2017-04-14 11:15:58,065 DEBUG (org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor:72) - Validating //login with method login.
2017-04-14 11:15:58,133 DEBUG (org.springframework.orm.hibernate3.SessionFactoryUtils:322) - Opening Hibernate Session
2017-04-14 11:15:58,181 DEBUG (org.hibernate.impl.SessionImpl:248) - opened session at timestamp: 14921397581
2017-04-14 11:15:58,186 DEBUG (org.hibernate.loader.Loader:1877) - loading entity: [cn.bdqn.jboa.entity.Employee#017]
2017-04-14 11:15:58,192 DEBUG (org.hibernate.jdbc.AbstractBatcher:410) - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2017-04-14 11:15:58,193 DEBUG (org.hibernate.jdbc.ConnectionManager:444) - opening JDBC connection
2017-04-14 11:15:58,201 DEBUG (org.hibernate.SQL:111) -
    select
        employee0_.sn as sn5_0_,
        employee0_.position_id as position2_5_0_,
        employee0_.department_id as department3_5_0_,
        employee0_.password as password5_0_,
        employee0_.name as name5_0_,
        employee0_.status as status5_0_
    from
        sys_employee employee0_
    where
        employee0_.sn=?
Hibernate:
    select
        employee0_.sn as sn5_0_,
        employee0_.position_id as position2_5_0_,
        employee0_.department_id as department3_5_0_,
        employee0_.password as password5_0_,
        employee0_.name as name5_0_,
        employee0_.status as status5_0_
    from
        sys_employee employee0_
    where
        employee0_.sn=?
2017-04-14 11:15:58,468 DEBUG (org.hibernate.jdbc.AbstractBatcher:426) - about to open ResultSet (open ResultSets: 0, globally: 0)
2017-04-14 11:15:58,468 DEBUG (org.hibernate.loader.Loader:1197) - result row: EntityKey[cn.bdqn.jboa.entity.Employee#017]
2017-04-14 11:15:58,480 DEBUG (org.hibernate.jdbc.AbstractBatcher:433) - about to close ResultSet (open ResultSets: 1, globally: 1)
2017-04-14 11:15:58,480 DEBUG (org.hibernate.jdbc.AbstractBatcher:418) - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
2017-04-14 11:15:58,484 DEBUG (org.hibernate.engine.TwoPhaseLoad:130) - resolving associations for [cn.bdqn.jboa.entity.Employee#017]
2017-04-14 11:15:58,493 DEBUG (org.hibernate.engine.TwoPhaseLoad:226) - done materializing entity [cn.bdqn.jboa.entity.Employee#017]
2017-04-14 11:15:58,494 DEBUG (org.hibernate.engine.StatefulPersistenceContext:860) - initializing non-lazy collections
2017-04-14 11:15:58,494 DEBUG (org.hibernate.loader.Loader:1908) - done entity load
2017-04-14 11:15:58,495 DEBUG (org.hibernate.jdbc.ConnectionManager:325) - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
2017-04-14 11:15:58,495 DEBUG (org.springframework.orm.hibernate3.HibernateTemplate:389) - Eagerly flushing Hibernate session
2017-04-14 11:15:58,497 DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:134) - processing flush-time cascades
2017-04-14 11:15:58,501 DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:177) - dirty checking collections
2017-04-14 11:15:58,511 DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:108) - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
2017-04-14 11:15:58,511 DEBUG (org.hibernate.event.def.AbstractFlushingEventListener:114) - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
2017-04-14 11:15:58,513 DEBUG (org.hibernate.pretty.Printer:106) - listing entities:
2017-04-14 11:15:58,513 DEBUG (org.hibernate.pretty.Printer:113) - cn.bdqn.jboa.entity.Employee{position=cn.bdqn.jboa.entity.Position#1, sn=017, status=在职, department=cn.bdqn.jboa.entity.Department#1, name=zhangsan, password=123}
2017-04-14 11:15:58,514 DEBUG (org.springframework.orm.hibernate3.SessionFactoryUtils:800) - Closing Hibernate Session
2017-04-14 11:15:58,514 DEBUG (org.hibernate.jdbc.ConnectionManager:464) - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
2017-04-14 11:15:58,516 DEBUG (org.hibernate.jdbc.ConnectionManager:325) - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
zhangsan
2017-04-14 11:15:58,522 ERROR (org.hibernate.LazyInitializationException:42) - could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
 at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132)
 at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
 at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
 at cn.bdqn.jboa.entity.Position_$$_javassist_0.getNameCn(Position_$$_javassist_0.java)
 at cn.bdqn.jboa.action.EmployeeAction.login(EmployeeAction.java:31)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
 at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
 at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
 at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
 at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
 at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
 at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
 at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2536)
 at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2525)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Unknown Source)
2017-04-14 11:15:58,530 ERROR (org.apache.struts2.dispatcher.Dispatcher:38) - Exception occurred during processing request: could not initialize proxy - no Session
org.hibernate.LazyInitializationException: could not initialize proxy - no Session
 at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132)
 at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)
 at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
 at cn.bdqn.jboa.entity.Position_$$_javassist_0.getNameCn(Position_$$_javassist_0.java)
 at cn.bdqn.jboa.action.EmployeeAction.login(EmployeeAction.java:31)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
 at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
 at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
 at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
 at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
 at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
 at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
 at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
 at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
 at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
 at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
 at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2536)
 at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2525)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 at java.lang.Thread.run(Unknown Source)

问题是结果已经取到了,怎么会出现这个错误!!!!!

web.xml文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
 http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 <!-- <display-name></display-name> -->
   <!--/WEB-INF/applicationContext.xml如果放在以上路径则不需要以下配置  -->
   <listener>  
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
 
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
  </context-param>
 
  <filter>
   <filter-name>OpenSessionInViewFilter</filter-name>
   <filter-class>
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
   </filter-class>
  </filter>
  <filter-mapping>
   <filter-name>OpenSessionInViewFilter</filter-name>
   <url-pattern>*.action</url-pattern>
  </filter-mapping>
 
  <filter>
   <filter-name>struts2</filter-name>
   <filter-class>
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
   </filter-class>
  </filter>
  <filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>/*</url-pattern>
  </filter-mapping>
 
  <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
  </welcome-file-list>
 
  </web-app>

============================================

Employee.hbm.xml程序

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="cn.bdqn.jboa.entity">
 <class name="Employee" table="sys_employee" >
  <id name="sn" type="string"  >
   <column length="20" name="sn" />
   <generator class="assigned" />
  </id>
  <many-to-one class="Position" fetch="select" name="position" >
   <column name="position_id" not-null="true">
    <comment>职务编号</comment>
   </column>
  </many-to-one>
  <many-to-one class="Department" fetch="select" name="department">
   <column name="department_id" not-null="true">
    <comment>部门</comment>
   </column>
  </many-to-one>
  <property lazy="false" name="password"
   type="string">
   <column length="45" name="password" not-null="true">
    <comment>密码</comment>
   </column>
  </property>
  <property lazy="false" name="name" type="string">
   <column length="45" name="name" not-null="true">
    <comment>姓名</comment>
   </column>
  </property>
  <property lazy="false" name="status" type="string">
   <column length="20" name="status" not-null="true">
    <comment>状态</comment>
   </column>
  </property>
 </class>
</hibernate-mapping>

============================================

EmployeeAction.java内程序:

package cn.bdqn.jboa.action;
import cn.bdqn.jboa.biz.EmployeeBiz;
import cn.bdqn.jboa.entity.Employee;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class EmployeeAction extends ActionSupport {
    private  EmployeeBiz employeeBiz;
    private Employee  employee;
    private String message;

@Override
 public String execute() throws Exception {
  // TODO Auto-generated method stub
  return super.execute();
 }
       public String login(){
       
        Employee result=employeeBiz.checkLogin(employee);
        System.out.println(result.getName());
        if(result==null){
         this.message="用户名或密码错误";
         return "input";
        }else{
         ActionContext.getContext().getSession()
         .put("employee", result);
        
         ActionContext.getContext().getSession()
         .put("employee_position", result.getPosition().getNameCn());
        
         return "success";
        }
       
       }
      
       public void setEmployeeBiz(EmployeeBiz employeeBiz) {
     this.employeeBiz = employeeBiz;
    }
      
 public Employee getEmployee() {
  return employee;
 }
 public void setEmployee(Employee employee) {
  this.employee = employee;
 }
 public String getMessage() {
  return message;
 }
 public void setMessage(String message) {
  this.message = message;
 }
      
      
 
}

时间: 2024-10-05 04:27:33

ssh整合案例出了could not initialize proxy - no Session 问题,那个大神帮我看看的相关文章

org.hibernate.LazyInitializationException: could not initialize proxy - no Session

在<many-to-on>中这错误很常见,字面意义就是不能被初始化,因为session已经关闭了. 简单理解就是因为,你使用了lazy=true,这样hibernate在从数据库中调数据的时候是不会把关联的对象查出来的,而是保存一个获取值得方法,在你使用getXXX()调用的时候,hiberante会利用这个保存的方法去从数据库中取数据.而往往我们在jsp页面中使用getXXX()准备展示数据的时候,session早已经在dao中就关闭了,我们该如何解决这种异常呢? 简单的说有三种:1.把la

懒加载异常org.hibernate.LazyInitializationException: could not initialize proxy - no Session

错误页面提示 could not initialize proxy - no Session 控制台 org.hibernate.LazyInitializationException: could not initialize proxy - no Session 病症:这是一个lazy使用后的Exception,使用迟时加载,在session(hibernate里的session),关闭后使用该对象的未加载变量,也就是说session已经关闭,没有保存到内存中,然后你使用了,导致该异常. Q

【bug记录】jpa 解决org.hibernate.lazyinitializationexception could not initialize proxy - no session

前言 最近开发项目比较忙,springcloud的笔记得稍稍放放了,下午出来个bug,恶心的不行,功能很简单,也没有什么级联或复杂的映射关系,就是一直在报三个异常 Caused by: com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no propert

hibernate4 could not initialize proxy - no Session

相关代码链接: http://git.oschina.net/alexgaoyh/alexgaoyh 上周在编写hibernate4的相关代码的时候,出现异常 org.hibernate.LazyInitializationException: could not initialize proxy - no Session  网上出现最多的解决方案是  openSessionInViewFilter 形如: <!-- open session filter --> <filter>

NHibernate之&quot;Could not initialize proxy - no Session&quot; Bug

最近在看一个 叫 泰斗破坏神的项目 里面用到了 NHibernate 这里涉及到了 联表查询 我的映射是在类里面,和网上在XML里的不一样 当我运行时,它会报错  Could not initialize proxy - no Session 网上查了的意思是  数据还没找完 Session就已经销毁了 映射表默认的是lazy=true;就是延迟加载的意思,因为延迟加载导致Session销毁了,然后我在想能不能 找到一个修改lazy的方法,可是最后找不到. 所以最后想到一个简单的方法就是  既然

could not initialize proxy - no Session 问题解决

在使用spring+hibernate时,我们对实体的一对多,多对一和多对多的关联实体进行获取值的时候通常会使用懒加载的方式.这样做的好处就是在我们需要关联对象的属性的时候,再去查询数据库,以至于我们不用一次查询很多的数据出来. 这样做经常会遇到一个异常:could not initialize proxy - no Session,本文就对此异常做各种处理方式的总结,结合实际需求去排除错误. 具体原因:使用懒加载方式,第一次获取主体对象后session已经关闭了,所以再去查询关联对象的属性时,

懒加载的解决方法(全)org.hibernate.LazyInitializationException: could not initialize proxy - no Session

如下错误:org.hibernate.LazyInitializationException: could not initialize proxy - no Session 原因是懒加载的问题,因为hibernate的机制是当我们查询一个对象的时候,在默认情况下,返回的只是该对象的普通属性,当用户去使用对象属性的时候,才会向数据库再一次查询,可以这时session已经关闭了,无法对数据库进行查询. 举例:在界面显示雇员所在的部门名称${loginuser.department.name } 解

SSH整合案例

整合 Hibernate5, Struts2, Spring4 步骤 一. 添加 Spring4 到项目中 1. 添加 jar 包 2. 添加 Spring 的配置文件(applicationContext.xml) 3. 配置 web.xml 配置启动 web 应用的时候进而启动 Spring的IOC容器. 二. 添加 Hibernate5 到项目中, 并与 Spring 进行整合 1. 添加 jar 包 2. 新建 hibernate.cfg.xml 把 一些配置信息放在这里面, 如: 表策

SSH整合案例注解式

首先准备一个实体:注解 @GeneratedValue:指定主键的生成策略.            IDENTITY:支持数据库字段自增长            SEQUENCE:支持数据库序列自增长            AUTO:使用Hibernate中的高低位算法. dao的实现类 @Repository自动装配到Spring的容器 @Resource:不用get set ,底层反射,直接就是按照名称注入. 指定bean的id的属性:name service的实现层 @Service:标识