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

Reply via email to