码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-04-14 12:50:20      阅读:828      评论:0      收藏:0      [点我收藏+]

标签:pos   pre   程序   listen   property   word   spring   stl   method   

在做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;
 }
      
      
 
}

 

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

标签:pos   pre   程序   listen   property   word   spring   stl   method   

原文地址:http://www.cnblogs.com/java-study-team-daydayup/p/6708132.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!