Stefano Cancedda
Aug 26th, 2009, 10:39 AM
hi, i'm using Spring flex integration in Jboss 4.3 AS. My application expose a bean as a remoting-destination. this bean look-up a stateful bean with a <jee-jndi-lookup> element:
<bean id="statisticsProvider" class="org.my.flex.services.StatisticXmlProvider">
<property name="statisticsService" ref="statistics" />
<flex:remoting-destination/>
</bean>
<jee:jndi-lookup id="statistics" jndi-name="ejb/StatisticsService" />
with this configuration my flex app respond that server throw a nullpointer 'cause cannot find the stateful bean. The refs are correctly listed inside both web.xml and jboss-web.xml descriptors.
I've tryed to add scope="session" and lazy-init="true" to statisticsProvider bean, but during the webapp startup spring tells me:
17:13:04,119 ERROR [DispatcherServlet] Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.flex.remoting.RemotingDestina tionExporter#0': Cannot resolve reference to bean 'statisticsProvider' while setting bean property 'service'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'statisticsProvider': 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 request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:315)
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:106)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1243)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1011)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:412)
at java.security.AccessController.doPrivileged(Native Method)
i'm using DispatcherServlet integration, and I've guessed that all calls to bean would be launched from an http request. Also including RequestContextLIstener in web.xml do not solve the problem.
is there a "correct way" to do what I want?
thank for any support
<bean id="statisticsProvider" class="org.my.flex.services.StatisticXmlProvider">
<property name="statisticsService" ref="statistics" />
<flex:remoting-destination/>
</bean>
<jee:jndi-lookup id="statistics" jndi-name="ejb/StatisticsService" />
with this configuration my flex app respond that server throw a nullpointer 'cause cannot find the stateful bean. The refs are correctly listed inside both web.xml and jboss-web.xml descriptors.
I've tryed to add scope="session" and lazy-init="true" to statisticsProvider bean, but during the webapp startup spring tells me:
17:13:04,119 ERROR [DispatcherServlet] Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.flex.remoting.RemotingDestina tionExporter#0': Cannot resolve reference to bean 'statisticsProvider' while setting bean property 'service'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'statisticsProvider': 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 request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:315)
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:106)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1243)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1011)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:475)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:412)
at java.security.AccessController.doPrivileged(Native Method)
i'm using DispatcherServlet integration, and I've guessed that all calls to bean would be launched from an http request. Also including RequestContextLIstener in web.xml do not solve the problem.
is there a "correct way" to do what I want?
thank for any support