AW: SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1

2008-11-12 Thread Agent Mahone
Hello Igor,
I just right now came back to my point.
Followed your hint and thinking once about it. You´re right, it works with 
vanilla spring :-)
Thank you very much for your great help!!!






Von: Igor Vaynberg [EMAIL PROTECTED]
An: users@wicket.apache.org
Gesendet: Dienstag, den 11. November 2008, 23:45:33 Uhr
Betreff: Re: SessionHandling: WicketRuntimeException: There is no application 
attached to current thread http-8080-1

you can retrieve the application context via the servlet context and
use vanilla spring to do whatever it is you are trying to do. you only
need the proxies when dealing from inside wicket - which you do not
appear to be doing.

-igor

On Tue, Nov 11, 2008 at 1:06 PM, Agent Mahone [EMAIL PROTECTED] wrote:
 Hello guys

 The only thing what I was trying to do was, to execute some code
 if a time out occurs. (mark that user is not anymore available or online).
 How then can I achieve this behaviour?

 Am I forced to use the classic instantiation through the new operator?
 Or is there any other solution?



 
 Von: Igor Vaynberg [EMAIL PROTECTED]
 An: users@wicket.apache.org
 Gesendet: Dienstag, den 11. November 2008, 18:48:24 Uhr
 Betreff: Re: SessionHandling: WicketRuntimeException: There is no application 
 attached to current thread http-8080-1

 wouldnt say its a bug, looks like a method invocation is done on a
 wicket-spring proxy outside a wicket request and it cannot find the
 application when it tries to resolve the application context. those
 proxies are not mean to be used outside wicket requests.

 -igor

 On Tue, Nov 11, 2008 at 7:11 AM, Martijn Dashorst
 [EMAIL PROTECTED] wrote:
 I guess 
 org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51)
 has a bug because it assumes it is always called inside the scope of a
 wicket request.

 Martijn

 On Tue, Nov 11, 2008 at 12:59 PM, Agent Mahone [EMAIL PROTECTED] wrote:
 Hi guys

 I´m just trying to execute some code after a session timeout occurs.
 I´m using spring / wicket / hibernate frameworks.
 Why do I get this error WicketRuntimeException: There is no application 
 attached to current thread http-8080-1?
 I´m not getting it...I appreciate any hints. Thanks in advance !!!

 Here is my application class:

 public class MyApplication extends SpringWebApplication implements 
 HttpSessionListener {

 protected void init() {
 //some code
 }

 public Session newSession(Request request, Response response) {
return new MySession(request);
 }

 public ClassIndexPage getHomePage() {
return IndexPage.class;
  }

 public Object getBean(Class? clazz, String beanName) {
return createSpringBeanProxy(clazz, beanName);
 }

  @Override
 public void sessionCreated(HttpSessionEvent arg0) {
//nothing sepcial
 }

 @Override
 public void sessionDestroyed(HttpSessionEvent arg0) {
  String sessionId = arg0.getSession().getId();

  IRegistrationLoginUseCase bean = 
 (ILoginService)getBean(ILoginService.class, loginService);

  bean.logout(sessionId);
 }

 Here is my error stack trace:

 org.apache.wicket.WicketRuntimeException: There is no application attached 
 to current thread http-8080-1
at org.apache.wicket.Application.get(Application.java:166)
at 
 org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51)
at 
 org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:176)
at 
 org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:162)
at 
 org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:412)
at org.apache.wicket.proxy.$Proxy3.logout(Unknown Source)
at 
 com.studentcv.web.MyApplication.sessionDestroyed(StudentCVApplication.java:82)
at 
 org.apache.catalina.session.StandardSession.expire(StandardSession.java:702)
at 
 org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2287)
at org.apache.catalina.connector.Request.getSession(Request.java:2075)
at 
 org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
at 
 org.apache.wicket.protocol.http.AbstractHttpSessionStore.getSessionId(AbstractHttpSessionStore.java:180)
at 
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:303)
at 
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 

AW: SessionHandling: WicketRuntimeException: There is no application attached to current thread http-8080-1

2008-11-11 Thread Agent Mahone
Hello guys

The only thing what I was trying to do was, to execute some code
if a time out occurs. (mark that user is not anymore available or online).
How then can I achieve this behaviour?

Am I forced to use the classic instantiation through the new operator?
Or is there any other solution?




Von: Igor Vaynberg [EMAIL PROTECTED]
An: users@wicket.apache.org
Gesendet: Dienstag, den 11. November 2008, 18:48:24 Uhr
Betreff: Re: SessionHandling: WicketRuntimeException: There is no application 
attached to current thread http-8080-1

wouldnt say its a bug, looks like a method invocation is done on a
wicket-spring proxy outside a wicket request and it cannot find the
application when it tries to resolve the application context. those
proxies are not mean to be used outside wicket requests.

-igor

On Tue, Nov 11, 2008 at 7:11 AM, Martijn Dashorst
[EMAIL PROTECTED] wrote:
 I guess 
 org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51)
 has a bug because it assumes it is always called inside the scope of a
 wicket request.

 Martijn

 On Tue, Nov 11, 2008 at 12:59 PM, Agent Mahone [EMAIL PROTECTED] wrote:
 Hi guys

 I´m just trying to execute some code after a session timeout occurs.
 I´m using spring / wicket / hibernate frameworks.
 Why do I get this error WicketRuntimeException: There is no application 
 attached to current thread http-8080-1?
 I´m not getting it...I appreciate any hints. Thanks in advance !!!

 Here is my application class:

 public class MyApplication extends SpringWebApplication implements 
 HttpSessionListener {

 protected void init() {
 //some code
 }

 public Session newSession(Request request, Response response) {
return new MySession(request);
 }

 public ClassIndexPage getHomePage() {
return IndexPage.class;
  }

 public Object getBean(Class? clazz, String beanName) {
return createSpringBeanProxy(clazz, beanName);
 }

  @Override
 public void sessionCreated(HttpSessionEvent arg0) {
//nothing sepcial
 }

 @Override
 public void sessionDestroyed(HttpSessionEvent arg0) {
  String sessionId = arg0.getSession().getId();

  IRegistrationLoginUseCase bean = 
 (ILoginService)getBean(ILoginService.class, loginService);

  bean.logout(sessionId);
 }

 Here is my error stack trace:

 org.apache.wicket.WicketRuntimeException: There is no application attached 
 to current thread http-8080-1
at org.apache.wicket.Application.get(Application.java:166)
at 
 org.apache.wicket.spring.SpringWebApplication$1.getSpringContext(SpringWebApplication.java:51)
at 
 org.apache.wicket.spring.SpringBeanLocator.getSpringContext(SpringBeanLocator.java:176)
at 
 org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:162)
at 
 org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:412)
at org.apache.wicket.proxy.$Proxy3.logout(Unknown Source)
at 
 com.studentcv.web.MyApplication.sessionDestroyed(StudentCVApplication.java:82)
at 
 org.apache.catalina.session.StandardSession.expire(StandardSession.java:702)
at 
 org.apache.catalina.session.StandardSession.isValid(StandardSession.java:592)
at org.apache.catalina.connector.Request.doGetSession(Request.java:2287)
at org.apache.catalina.connector.Request.getSession(Request.java:2075)
at 
 org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:833)
at 
 org.apache.wicket.protocol.http.AbstractHttpSessionStore.getSessionId(AbstractHttpSessionStore.java:180)
at 
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:303)
at 
 org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:124)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at 
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at 
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at 
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at 
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at 
 org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at 
 org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)






 --
 Become a Wicket expert,