• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DWR and Spring Scoped Beans

 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Thanks for reading my post; hopefully I'm in the right forum.

I'm having some intermittent issues getting a session from the WebContext; sometimes it's null. This seems to be related to concurrent users. So, I found this article: http://directwebremoting.org/dwr/documentation/server/integration/spring.html#springCreator and http://static.springsource.org/spring/docs/2.5.x/reference/beans.html#beans-factory-scopes-global-session which explains beans can be scoped. I tried to implement the solution provided on both of these links but this solution is working for me (see below). Am I missing something?

This is what I've done:



springbeans.xml
<bean id="orgDelegate" class="com.example.dwr.OrganizationDelegate" scope="session">
<dwr:remote javascript="OrganizationDelegate">
<dwr:include method="getOrgStreetName"/>
</dwr:remote>
<aop:scoped-proxy proxy-target-class="false" />
</bean>

web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>

Thanks inadvance for your help!
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, this should read:

I tried to implement the solution provided on both of these links but this solution is NOT working for me (see below).
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link helped me resolve my issue. Maybe this will help someone else who could also run into this issue: http://forum.springsource.org/archive/index.php/t-26302.html
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic