私はいくつかの同様の質問を見てきましたが、提案された解決策のどれも私を助けませんでした。
詳細、それは単純な例です:
ファイル:MandatTypeBean.xml
<bean id="mandatTypeDAO" class="gestint.data.dao.impl.MandatTypeDAOImpl">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<bean id="ActionMandatType" class="gestint.data.action.MandatTypeAction">
<property name="mandatTypeDAO" ref="mandatTypeDAO" />
</bean>
ファイル:HibernateSessionFactory.xml
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="DataSource"/>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>gestint/data/model/MandatType.hbm.xml</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
ファイル:MandatTypeDAO.java
public class MandatTypeDAOImpl implements MandatTypeDAO {
private SessionFactory sessionFactory;
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public List<MandatType> listMandatType() {
sessionFactory.getCurrentSession().isConnected();
return null;
}
}
ファイル:MandatTypeAction.java
public class MandatTypeAction extends ActionSupport{
private static final long serialVersionUID = 1L;
private MandatTypeDAO mandatTypeDAO;
private List<MandatType> mandatList = new ArrayList<MandatType>();
public void setMandatTypeDAO(MandatTypeDAO mandatTypeDAO) {
this.mandatTypeDAO = mandatTypeDAO;
}
public List<MandatType> getMandatTypeList() {
return mandatList;
}
public String listMandatType() {
mandatList = mandatTypeDAO.listMandatType();
return SUCCESS;
}
}
そして私のエラー..
public List<MandatType> listMandatType()
私がテストのために簡単な言葉でアクセスしようとすると
:
sessionFactory.getCurrentSession().isConnected();
このエラーが発生します:
17:02:28,062エラーディスパッチャ:38-リクエストの処理中に例外が発生しました:現在のスレッドorg.hibernate.HibernateExceptionのセッションが見つかりません:org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java)の現在のスレッドのセッションが見つかりません:97)org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:980)at gestint.data.dao.impl.MandatTypeDAOImpl.listMandatType(MandatTypeDAOImpl.java:21)at gestint.data.action.MandatTypeAction.listMandatType( MandatTypeAction.java:26)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java .lang.reflect.Method。invoke(Method.java:597)at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:446)at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:285)at com.opensymphony.xwork2.DefaultActionInvocation .invoke(DefaultActionInvocation.java:248)at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at com opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)atcom.opensymphony.xwork2.DefaultActionInvocation。invoke(DefaultActionInvocation.java:242)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:242)at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor。 :138)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:238)atcom.opensymphony.xwork2。インターセプター.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:238)at com .opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersIntercept :191)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)atcom.opensymphony.xwork2。DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at org.apache .struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java )com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)atcom.opensymphony.xwork2.DefaultActionInvocation。invoke(DefaultActionInvocation.java:242)at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)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:242)at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor。 java:164)com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation .java:242)at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)atorg.apache.struts2.impl。 StrutsActionProxy.execute(StrutsActionProxy.java:54)at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:544)at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) org.apache.struts2.dispatcher.ng.filterで。StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:74)at weblogic.servlet.internal.WebAppServletContext $ ServletInvocationAction.wrapRun(WebAppServletContext.java:3288)at weblogic.servlet .internal.WebAppServletContext $ ServletInvocationAction.run(WebAppServletContext.java:3254)at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) )at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2163)at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext。java:2089)at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074)at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1512)at weblogic.servlet.provider.ContainerSupportProviderImpl $ WlsRequestExecutor.run (ContainerSupportProviderImpl.java:254)at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)ExecuteThread.run(ExecuteThread.java:221)ExecuteThread.run(ExecuteThread.java:221)
誰かが私を助けることができますか?