Right, here it is: https://issues.apache.org/jira/browse/WICKET-613
Thanks for checking this out. Rüdiger 2007/6/3, Eelco Hillenius <[EMAIL PROTECTED]>: > Could you please open up a JIRA issue for this with a link to this > discussion? I think it is something Igor might have an idea about (but > he's no a vacation now). > > Eelco > > > On 6/3/07, Rüdiger Schulz <[EMAIL PROTECTED]> wrote: > > I put a breakpoint in the constructor of my Form, which has the > > @SpringBean annotation on ia property named logic. > > > > Before the super() call, logic is null. > > > > After that, it is set to $Proxy39, with a h-attribute to a > > org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler. The target > > property of the handler is null. > > > > After the next line, where I call a method from logic, the target > > property is set to the bean instance. > > > > So it seems that the reference gets lost in the first call. > > > > > > But, as you said that the bean is transient anyway, I think that > > prototype beans could not be used that way for holding state of wicket > > components, because that state should certainly also be kept when > > using the back button. > > > > I'm not sure what is best then. I could get a reference to the spring > > bean directly from ApplicationContext, and just keep it. But then I > > would face the problem of serialization. > > > > The best thing would be IMHO if the proxy could somehow do an > > automatic re-lookup from Spring for prototype beans, so that not a new > > instance is fetched from the container, but the same as before. But I > > don't know enough about Spring to say if that is even possible. > > > > > > > > 2007/6/3, Eelco Hillenius <[EMAIL PROTECTED]>: > > > I'm not that familiar with the code, but the interesting thing is that > > > LazyInitProxyFactory$JdkHandler does cache the bean it located: > > > > > > if (target == null) > > > { > > > target = locator.locateProxyTarget(); > > > } > > > return proxy.invoke(target, args); > > > > > > The target is a transient member of JdkHandler and judging from the > > > code, once the bean is located it should just be reused until the page > > > is serialized/ deserialized (for backbutton support or when > > > clustered). > > > > > > Can you use you debugger to find out what exactly happens? > > > > > > Eelco > > > > > > On 6/1/07, Rüdiger Schulz <[EMAIL PROTECTED]> wrote: > > > > Right, forgot the Stacktraces: > > > > > > > > The first when calling super(): > > > > at KitManagementBean.<init>(KitManagementBean.java:34) > > > > at > > > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > > > > at > > > > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) > > > > at > > > > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) > > > > at > > > > java.lang.reflect.Constructor.newInstance(Constructor.java:513) > > > > at > > > > org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85) > > > > at > > > > org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) > > > > at > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:732) > > > > at > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:720) > > > > at > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386) > > > > at > > > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:270) > > > > at > > > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) > > > > at > > > > org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:707) > > > > at > > > > org.apache.wicket.spring.SpringBeanLocator.lookupSpringBean(SpringBeanLocator.java:240) > > > > at > > > > org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:163) > > > > at > > > > org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.testLocator(AnnotProxyFieldValueFactory.java:124) > > > > at > > > > org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:99) > > > > at > > > > org.apache.wicket.injection.Injector.inject(Injector.java:109) > > > > at > > > > org.apache.wicket.injection.ConfigurableInjector.inject(ConfigurableInjector.java:40) > > > > at > > > > org.apache.wicket.injection.ComponentInjector.onInstantiation(ComponentInjector.java:54) > > > > at > > > > org.apache.wicket.Application.notifyComponentInstantiationListeners(Application.java:916) > > > > at org.apache.wicket.Component.<init>(Component.java:708) > > > > at > > > > org.apache.wicket.MarkupContainer.<init>(MarkupContainer.java:111) > > > > at > > > > org.apache.wicket.markup.html.WebMarkupContainer.<init>(WebMarkupContainer.java:39) > > > > at org.apache.wicket.markup.html.form.Form.<init>(Form.java:233) > > > > at KitForm.<init>(KitForm.java:50) > > > > at KitEditPage.<init>(KitEditPage.java:45) > > > > > > > > And from the next line, where I call a method on the bean: > > > > > > > > at KitManagementBean.<init>(KitManagementBean.java:34) > > > > at > > > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > > > > at > > > > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) > > > > at > > > > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) > > > > at > > > > java.lang.reflect.Constructor.newInstance(Constructor.java:513) > > > > at > > > > org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:85) > > > > at > > > > org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) > > > > at > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:732) > > > > at > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:720) > > > > at > > > > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386) > > > > at > > > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:270) > > > > at > > > > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) > > > > at > > > > org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:707) > > > > at > > > > org.apache.wicket.spring.SpringBeanLocator.lookupSpringBean(SpringBeanLocator.java:240) > > > > at > > > > org.apache.wicket.spring.SpringBeanLocator.locateProxyTarget(SpringBeanLocator.java:163) > > > > at > > > > org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:389) > > > > at org.apache.wicket.proxy.$Proxy39.init(Unknown Source) > > > > at KitForm.<init>(KitForm.java:51) > > > > at KitEditPage.<init>(KitEditPage.java:45) > > > > > > > > > > > > 2007/6/1, Rüdiger Schulz <[EMAIL PROTECTED]>: > > > > > Hello everybody, > > > > > > > > > > I already tried to chat on ##wicket about this, but it's probably too > > > > > complex for IRC... > > > > > > > > > > I'm using Wicket 1.3.0 snapshot and Spring 2.0 on JDK6 / Jetty. For a > > > > > more complex form I wanted to use a "stateful" Springbean, to which I > > > > > applied scope="prototype". The idea is to have one bean instance for > > > > > every Form instance. I would access the bean with PropertyModels and > > > > > direct method calls during construction (i.e. setting initial state > > > > > from input parameters) and during events, which would alter the state. > > > > > I inject the bean into the Form with @SpringBean annotation. > > > > > > > > > > This works somehow, but sometimes, especially after using the > > > > > backbutton, I had the problem that the internal state was reset. So I > > > > > analyzed the stack in the constructor of the bean implementation, and > > > > > found out that it was called twice during construction of the Form. > > > > > First, during the super() call, and then again in the next line during > > > > > a method call on that bean. I appended both stacktraces below. The > > > > > proxy itself does not change. > > > > > > > > > > This happens again after going back and e.g. submitting again. This > > > > > results in a NPE, because the internal state is reset. > > > > > > > > > > I understand from reading the mailing list that the Wicket-Proxy does > > > > > nothing but a lookup in the Application context, and does not know or > > > > > care about spring scope. > > > > > > > > > > And here I'm a little stuck. I am already considering to put the state > > > > > into the Form, and make the Bean a singleton without any internal > > > > > state. As that would mean some heavy refactoring, I would prefer a way > > > > > where the Spring acces would work as I want. Or is this a wrong way > > > > > altogether? > > > > > > > > > > thanks in advance for any comments. > > > > > > > > > > -- > > > > > greetings from Berlin, > > > > > > > > > > Rüdiger Schulz > > > > > > > > > > www.2rue.de > > > > > > > > > > > > > > > > > -- > > > > greetings from Berlin, > > > > > > > > Rüdiger Schulz > > > > > > > > www.2rue.de > > > > > > > > ------------------------------------------------------------------------- > > > > This SF.net email is sponsored by DB2 Express > > > > Download DB2 Express C - the FREE version of DB2 express and take > > > > control of your XML. No limits. Just data. Click to get it now. > > > > http://sourceforge.net/powerbar/db2/ > > > > _______________________________________________ > > > > Wicket-user mailing list > > > > Wicket-user@lists.sourceforge.net > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > ------------------------------------------------------------------------- > > > This SF.net email is sponsored by DB2 Express > > > Download DB2 Express C - the FREE version of DB2 express and take > > > control of your XML. No limits. Just data. Click to get it now. > > > http://sourceforge.net/powerbar/db2/ > > > _______________________________________________ > > > Wicket-user mailing list > > > Wicket-user@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > -- > > greetings from Berlin, > > > > Rüdiger Schulz > > > > www.2rue.de > > > > ------------------------------------------------------------------------- > > This SF.net email is sponsored by DB2 Express > > Download DB2 Express C - the FREE version of DB2 express and take > > control of your XML. No limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > -- greetings from Berlin, Rüdiger Schulz www.2rue.de ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user