-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SPRING / STRUTS / HIBERNATE : Problème
PostPosted: Sat Oct 29, 2005 7:06 am 
Newbie

Joined: Sat Oct 29, 2005 7:01 am
Posts: 4
Salut à tous

J'utilise les framework suivants

Hibernate 3.0.5
Spring 1.2.5
Struts 1.2.7
Tomcat 5.0.28

J'ai essayé de configurer OpenInSessionViewFilter de spring qui permet de garder la session hibernate ouverte jusqu'à ce que la vue jsp soient totalement rendue. Cependant, malgré ma configuration, je tombe sur l'erreur :
org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed



Voici la façon dont j'ai configuré mes fichiers

web.xml (sorry for the indentation)
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-context.xml</param-value>
</context-param>
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.O penSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoade rListener</listener-class>
</listener>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/welcome.jsp</welcome-file>
</welcome-file-list>

struts-config.xml
<struts-config>
<form-beans>
...
</form-beans>

<global-exceptions />

<global-forwards>
<forward name="portal" path="/index.jsp" />
<forward name="loginPage" path="/login.jsp"/>
</global-forwards>

<action-mappings>
<action path="/toModule" type="org.springframework.web.struts.DelegatingAct ionProxy" />

<action path="/welcome" type="org.springframework.web.struts.DelegatingAct ionProxy" />
...
</action-mappings>

<controller processorClass="myApp.struts.main.RequestProcessor " />

<message-resources parameter="myApp.struts.ApplicationResources" />


<plug-in className="org.springframework.web.struts.ContextL oaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/application-context.xml" />
</plug-in>
</struts-config>

application-context.xml
<beans>

<import resource="controller.xml" />
<import resource="service.xml" />
<import resource="dao.xml" />
<import resource="persistence.xml" />
</beans>


persistence.xml
<beans>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean" singleton="true">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
...
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>java:/comp/env/myDS</value>
</property>
</bean>
</beans>

Quelqu'un pourrait-il m'indiquer quelle est mon erreur ?


Merci d'avance :)

Jay


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 1:06 pm 
Regular
Regular

Joined: Fri Sep 30, 2005 6:15 am
Posts: 50
Ouah enfin quelqu'un qui veut utiliser les mêmes framework que moi, qui a le même problème et qui parle la même langue :o)

par contre désolé, je nai pas la solution, mais je veux bien "bosser" avec toi pour trouver...le truc c'est que j'avais le même problème avec struts + hibernate et je pensais qu'en intégrant spring ça résolverait....

je crois avoir lu des truc s là dessus, je vais chercher et revenir vers toi

Si tu bosses sous eclipse et que tu pouvais m'envoyer un projet exemple de ton architecture ça serait pas mal, comme ça on pourrait avancer ensemble..dans le cas où tu es d'accord je te donne mon email : gaetmail@free.fr

bye!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.