Two Laptop Bag
The moose likes Spring and the fly likes Spring session= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring session="scope"" Watch "Spring session="scope"" New topic

Spring session="scope"

samuel john

Joined: Aug 14, 2011
Posts: 3
Hi All,

am new to Spring framework, we are working on a project using Spring+BlazeDS+Flex.
So far integration with flex went through with out any issues.

We tried to use HttpSession to maintain userPreferences and found this link where by setting scope="session" will sort our needs.

but unfortunately we are facing below exception:

20:44:44,818 ERROR [STDERR] java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
20:44:44,819 ERROR [STDERR] at
20:44:44,819 ERROR [STDERR] at
20:44:44,819 ERROR [STDERR] at
20:44:44,819 ERROR [STDERR] at com.lynx.saw.spring.login.dao.LoginDAO.createMenu(
20:44:44,819 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
20:44:44,819 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(
20:44:44,820 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(
20:44:44,820 ERROR [STDERR] at java.lang.reflect.Method.invoke(
20:44:44,820 ERROR [STDERR] at
20:44:44,820 ERROR [STDERR] at
20:44:44,826 ERROR [STDERR] at flex.messaging.MessageBroker.routeMessageToService(
20:44:44,826 ERROR [STDERR] at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(
20:44:44,826 ERROR [STDERR] at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(
20:44:44,826 ERROR [STDERR] at flex.messaging.endpoints.amf.LegacyFilter.invoke(
20:44:44,826 ERROR [STDERR] at flex.messaging.endpoints.amf.SessionFilter.invoke(
20:44:44,826 ERROR [STDERR] at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(
20:44:44,827 ERROR [STDERR] at flex.messaging.endpoints.amf.SerializationFilter.invoke(
20:44:44,827 ERROR [STDERR] at flex.messaging.endpoints.BaseHTTPEndpoint.service(
20:44:44,827 ERROR [STDERR] at org.springframework.flex.messaging.servlet.MessageBrokerHandlerAdapter.handle(
20:44:44,827 ERROR [STDERR] at org.springframework.web.servlet.DispatcherServlet.doDispatch(
20:44:44,827 ERROR [STDERR] at org.springframework.web.servlet.DispatcherServlet.doService(
20:44:44,827 ERROR [STDERR] at org.springframework.web.servlet.FrameworkServlet.processRequest(
20:44:44,828 ERROR [STDERR] at org.springframework.web.servlet.FrameworkServlet.doPost(
20:44:44,828 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(
20:44:44,828 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(
20:44:44,828 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
20:44:44,828 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(
20:44:44,828 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(
20:44:44,828 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
20:44:44,829 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(
20:44:44,829 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(
20:44:44,829 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(
20:44:44,829 ERROR [STDERR] at
20:44:44,829 ERROR [STDERR] at
20:44:44,829 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(
20:44:44,829 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(
20:44:44,829 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(
20:44:44,829 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(
20:44:44,829 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(
20:44:44,830 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(
20:44:44,830 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(
20:44:44,830 ERROR [STDERR] at$
20:44:44,830 ERROR [STDERR] at

Below code is generating the exception:

Part of web-application-config.xml :

Kindly correct me if at all am doing some thing wrong.

samuel john

Joined: Aug 14, 2011
Posts: 3
Hi All,

Have tried changing this in my applicationContext files as

But the user Object returned in class GlobalLoggedIn is NULL. Kindly correct me if at all am missing any thing

Thanks again
samuel john

Joined: Aug 14, 2011
Posts: 3
Sorry all, just noticed have posted title wrongly as session="scope" instead of scope="session".
Tommy Delson
Ranch Hand

Joined: Apr 13, 2011
Posts: 206
Try to take out " <aop:scoped-proxy/>" since your "userPreference" bean is declared as "singleton".

See and recheck Spring document for details....

Here is the recap from Spring doc if you missed:


You do not need to use the <aop:scoped-proxy/> in conjunction with beans that are scoped as singletons or prototypes. It is an error to try to create a scoped proxy for a singleton bean (and the resulting BeanCreationException will certainly set you straight in this regard).

"Your life is in your hands, to make of it what you choose."
I agree. Here's the link:
subject: Spring session="scope"
It's not a secret anymore!