Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-18 Thread Sven Schliesing
I switched over to using an anonymous overridden WebApplication: -- WebApplication webApplication = new WebApplication() { @Override public Session newSession(Request request, Response response) { return new CustomSession(request); }

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Sven Schliesing
Neither the constructor of CustomSession nor the constructor of WebSession is called. The error occurs much earlier, as you can see in the stack trace posted in my first post. I think I will drop overriding the default session and work with setAttribute()/getAttribute() instead. Seems to save me

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Sven Schliesing
Yes, with a normal Wicket-Application it works just perfect. I'm using the SpringWebApplication cause of createSpringBeanProxy() and the automatic init of the configured ApplicationContext (http://cwiki.apache.org/WICKET/spring.html). Manually initializing would be a huge tradeoff for working

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Sven Schliesing
I'm referring to both. The CCE occurs if I construct the WicketTester without my application as an argument. If I do, I get the illegal state exception. Problem with this seems to be, that the ServletContext created at MockWebApplication:130 does not contain the required WebApplicationContext

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-17 Thread Timo Rantalaiho
On Sun, 17 Feb 2008, Sven Schliesing wrote: I'm using the SpringWebApplication cause of createSpringBeanProxy() and the automatic init of the configured ApplicationContext (http://cwiki.apache.org/WICKET/spring.html). Manually initializing would be a huge tradeoff for working tests. :) Hmm,

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-15 Thread Sven Schliesing
I think I don't get it :( I narrowed down the problem to this test case. It would be great if you could take a look: --- public class WebApplicationTest { public class CustomSession extends WebSession { public CustomSession(Request request) {

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-15 Thread Igor Vaynberg
you need to override newsession on the app and return your subclass -igor On Fri, Feb 15, 2008 at 2:00 AM, Sven Schliesing [EMAIL PROTECTED] wrote: I think I don't get it :( I narrowed down the problem to this test case. It would be great if you could take a look:

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-15 Thread Timo Rantalaiho
On Fri, 15 Feb 2008, Igor Vaynberg wrote: you need to override newsession on the app and return your subclass But he did it here, no? public class MyApplication extends SpringWebApplication { private SpringComponentInjector springComponentInjector;

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-15 Thread Igor Vaynberg
right, missed it. i guess the next step would be to set a breakpoint there and see if its ever called. if not, set a breakpoint in websession constructor and see why that is invoked instead of the overridden factory. -igor On Fri, Feb 15, 2008 at 10:25 AM, Timo Rantalaiho [EMAIL PROTECTED]

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-15 Thread Nino Saturnino Martinez Vazquez Wael
Yeah, put some break points in there, and if you still have trouble provide a quickstart... regards Nino Sven Schliesing wrote: I think I don't get it :( I narrowed down the problem to this test case. It would be great if you could take a look: --- public class

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-14 Thread Timo Rantalaiho
On Thu, 14 Feb 2008, Sven Schliesing wrote: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? Yep, you should provide it an ApplicationContext more suitable for testing. There is the handy MockContext in wicket-spring that you can use. We

Re: org.apache.wicket.protocol.http.WebSession cannot be cast to my.CustomSession

2008-02-14 Thread Nino Saturnino Martinez Vazquez Wael
You could also take a look at the blog tutorial, has the solution for this as I remember.. http://cwiki.apache.org/WICKET/blog-tutorial.html From another example here: final ApplicationContext context = new ClassPathXmlApplicationContext( applicationContext.xml);