I faced the same problem about get the applicationContext from the business layer and i follow the solution above and it worked correctly, thank a lot for your help. But my question now is :
What if a want to get a session scoped bean from the application context in business layer
In other word and with some details:
My Application implements the 3 layers as follow:
Icefaces for presentation layerSpring for business layerHibernate for persistence layer
and i used acegi
security to secure my application...
Now after the user enter the login information the acegi
started the authentication process and i use a custom LDAP authentication provider to check the login information in the Active Directory, and this custom provider is registered in the applicationContext.xml
file.. In this case i suppose that this provider is in my business layer. In this provider and after he finish his work with Active Directory i need to get the application context and get the session scoped bean "user", and inside this bean i need to save my login information..
So what i did till now: create my custom provider which is worked successfully and I implement the Interface "ApplicationContextAware
" and override the method "setApplicationContext
" and I get a reference to the application context which held in the "appContext
" variable, after that I let the Provider to do his work and after that I invoke the method appContext.getBean("user")
and i got an error message that told me :
"Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to req....
So what is the solution .... ???
.. anyone can help my
.... every suggestion or help will be appreciated