Re: Using Spring beans with session scope

2007-12-14 Thread Daniel Stoch
Have you defined RequestContextListener in your web.xml? It is
required for request scope and session scope beans:

listener
listener-class

org.springframework.web.context.request.RequestContextListener
/listener-class
/listener 

Daniel

On Dec 14, 2007 7:36 AM, Ravi_116 [EMAIL PROTECTED] wrote:


 Caused by: org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'inquiryEngine' defined in class path resource
 [lingo-context.xml]: Cannot resolve reference to bean 'userContext' while
 setting bean property 'userContext'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error creating bean
 with name 'userContext': 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? 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.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using Spring beans with session scope

2007-12-13 Thread Igor Vaynberg
i think it should work, you simply have to declare the bean as
scope=session in spring config

-igor


On Dec 13, 2007 3:57 PM, Ravi_116 [EMAIL PROTECTED] wrote:

 I am a newbie to wicket. Our wicket application is integrated with Spring
 using the SpringComponentInjector. Is it possible to set  a UserContext bean
 in Spring (scoped session) from the AuthenticatedWebSession ? Spring
 provides some nice AOP proxy services with spring beans.
 Ravi

 --
 View this message in context: 
 http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using Spring beans with session scope

2007-12-13 Thread Ravi_116

Igor,

The exception happens while loading the spring config files -

Caused by: java.lang.IllegalStateException: No thread-bound request found:
Are you referring to request attributes outside of an actual web request? 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.

Here is the definition of spring beans -

!-- a HTTP Session-scoped bean exposed as a proxy --
bean id=userContext class=com.foo.UserContext scope=session
  !-- this next element effects the proxying of the surrounding
bean --
  aop:scoped-proxy/
/bean

The init method the MyWebApplication.java (extends wicket
AuthenticatedWebApplication)

SpringComponentInjector springComponentInjector = new
SpringComponentInjector(this);
addComponentInstantiationListener(springComponentInjector);

From the exception, it seems like spring is not aware of the HttpContext
created by wicket.
Thanks,
Ravi



igor.vaynberg wrote:
 
 i think it should work, you simply have to declare the bean as
 scope=session in spring config
 
 -igor
 
 
 On Dec 13, 2007 3:57 PM, Ravi_116 [EMAIL PROTECTED] wrote:

 I am a newbie to wicket. Our wicket application is integrated with Spring
 using the SpringComponentInjector. Is it possible to set  a UserContext
 bean
 in Spring (scoped session) from the AuthenticatedWebSession ? Spring
 provides some nice AOP proxy services with spring beans.
 Ravi

 --
 View this message in context:
 http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330289.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using Spring beans with session scope

2007-12-13 Thread Igor Vaynberg
show us the complete stack trace

-igor


On Dec 13, 2007 9:08 PM, Ravi_116 [EMAIL PROTECTED] wrote:

 Igor,

 The exception happens while loading the spring config files -

 Caused by: java.lang.IllegalStateException: No thread-bound request found:
 Are you referring to request attributes outside of an actual web request? 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.

 Here is the definition of spring beans -

 !-- a HTTP Session-scoped bean exposed as a proxy --
 bean id=userContext class=com.foo.UserContext scope=session
   !-- this next element effects the proxying of the surrounding
 bean --
   aop:scoped-proxy/
 /bean

 The init method the MyWebApplication.java (extends wicket
 AuthenticatedWebApplication)

 SpringComponentInjector springComponentInjector = new
 SpringComponentInjector(this);
 addComponentInstantiationListener(springComponentInjector);

 From the exception, it seems like spring is not aware of the HttpContext
 created by wicket.
 Thanks,
 Ravi




 igor.vaynberg wrote:
 
  i think it should work, you simply have to declare the bean as
  scope=session in spring config
 
  -igor
 
 
  On Dec 13, 2007 3:57 PM, Ravi_116 [EMAIL PROTECTED] wrote:
 
  I am a newbie to wicket. Our wicket application is integrated with Spring
  using the SpringComponentInjector. Is it possible to set  a UserContext
  bean
  in Spring (scoped session) from the AuthenticatedWebSession ? Spring
  provides some nice AOP proxy services with spring beans.
  Ravi
 
  --
  View this message in context:
  http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

 --
 View this message in context: 
 http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14330289.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Using Spring beans with session scope

2007-12-13 Thread Igor Vaynberg
this is a spring error not a wicket one. im guessing there is some
sort of a filter you need to map to web.xml that lets spring retrieve
the http session.

-igor


On Dec 13, 2007 10:36 PM, Ravi_116 [EMAIL PROTECTED] wrote:


 Caused by: org.springframework.beans.factory.BeanCreationException: Error
 creating bean with name 'inquiryEngine' defined in class path resource
 [lingo-context.xml]: Cannot resolve reference to bean 'userContext' while
 setting bean property 'userContext'; nested exception is
 org.springframework.beans.factory.BeanCreationException: Error creating bean
 with name 'userContext': 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? 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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:274)
 at
 org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1274)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1042)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
 at java.security.AccessController.doPrivileged(Native Method)
 at
 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
 at
 org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
 at
 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
 at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
 at
 org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174)
 at
 org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:887)
 at
 org.apache.wicket.spring.SpringBeanLocator.lookupSpringBean(SpringBeanLocator.java:240)
 at
 org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:166)
 at
 org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.testLocator(AnnotProxyFieldValueFactory.java:126)


 Ravi



 igor.vaynberg wrote:
 
  show us the complete stack trace
 
  -igor
 
 
  On Dec 13, 2007 9:08 PM, Ravi_116 [EMAIL PROTECTED] wrote:
 
  Igor,
 
  The exception happens while loading the spring config files -
 
  Caused by: java.lang.IllegalStateException: No thread-bound request
  found:
  Are you referring to request attributes outside of an actual web request?
  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.
 
  Here is the definition of spring beans -
 
  !-- a HTTP Session-scoped bean exposed as a proxy --
  bean id=userContext class=com.foo.UserContext scope=session
!-- this next element effects the proxying of the surrounding
  bean --
aop:scoped-proxy/
  /bean
 
  The init method the MyWebApplication.java (extends wicket
  AuthenticatedWebApplication)
 
  SpringComponentInjector springComponentInjector = new
  SpringComponentInjector(this);
  addComponentInstantiationListener(springComponentInjector);
 
  From the exception, it seems like spring is not aware of the HttpContext
  created by wicket.
  Thanks,
  Ravi
 
 
 
 
  igor.vaynberg wrote:
  
   i think it should work, you simply have to declare the bean as
   scope=session in spring config
  
   -igor
  
  
   On Dec 13, 2007 3:57 PM, Ravi_116 [EMAIL PROTECTED] wrote:
  
   I am a newbie to wicket. Our wicket application is integrated with
  Spring
   using the SpringComponentInjector. Is it possible to set  a
  UserContext
   bean
   in Spring (scoped session) from the AuthenticatedWebSession ? Spring
   provides 

Re: Using Spring beans with session scope

2007-12-13 Thread Ravi_116


Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'inquiryEngine' defined in class path resource
[lingo-context.xml]: Cannot resolve reference to bean 'userContext' while
setting bean property 'userContext'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'userContext': 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? 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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:274)
at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1274)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1042)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:485)
at java.security.AccessController.doPrivileged(Native Method)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:169)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:174)
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:887)
at
org.apache.wicket.spring.SpringBeanLocator.lookupSpringBean(SpringBeanLocator.java:240)
at
org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:166)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.testLocator(AnnotProxyFieldValueFactory.java:126)


Ravi


igor.vaynberg wrote:
 
 show us the complete stack trace
 
 -igor
 
 
 On Dec 13, 2007 9:08 PM, Ravi_116 [EMAIL PROTECTED] wrote:

 Igor,

 The exception happens while loading the spring config files -

 Caused by: java.lang.IllegalStateException: No thread-bound request
 found:
 Are you referring to request attributes outside of an actual web request?
 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.

 Here is the definition of spring beans -

 !-- a HTTP Session-scoped bean exposed as a proxy --
 bean id=userContext class=com.foo.UserContext scope=session
   !-- this next element effects the proxying of the surrounding
 bean --
   aop:scoped-proxy/
 /bean

 The init method the MyWebApplication.java (extends wicket
 AuthenticatedWebApplication)

 SpringComponentInjector springComponentInjector = new
 SpringComponentInjector(this);
 addComponentInstantiationListener(springComponentInjector);

 From the exception, it seems like spring is not aware of the HttpContext
 created by wicket.
 Thanks,
 Ravi




 igor.vaynberg wrote:
 
  i think it should work, you simply have to declare the bean as
  scope=session in spring config
 
  -igor
 
 
  On Dec 13, 2007 3:57 PM, Ravi_116 [EMAIL PROTECTED] wrote:
 
  I am a newbie to wicket. Our wicket application is integrated with
 Spring
  using the SpringComponentInjector. Is it possible to set  a
 UserContext
  bean
  in Spring (scoped session) from the AuthenticatedWebSession ? Spring
  provides some nice AOP proxy services with spring beans.
  Ravi
 
  --
  View this message in context:
 
 http://www.nabble.com/Using-Spring-beans-with-session-scope-tp14327328p14327328.html
  Sent from the Wicket - User mailing list archive at Nabble.com.
 
 
  -
  To