jazzyjez
Sep 2nd, 2004, 10:01 AM
Hi there.
I have a class called LocaleInterceptor that implements HandlerInterceptor which filters some requests to the webapp. It has a dependency on a LocaleManager which looks like this:
<bean id="localeInterceptor" class="net.urbanguru.wanep.web.LocaleInterceptor">
<property name="localeManager"><ref bean="wanepLocaleManager" /></property>
</bean>
<bean id="wanepLocaleManager" class="net.urbanguru.wanep.dao.LocaleManager">
<property name="sessionFactory"><ref bean="wanepSessionFactory" /></property>
</bean>
<bean id="wanepSessionFactory" class="org.springframework.orm.hibernate.LocalSessionFact oryBean">
...CUT...
</bean>
There is another bean which has a dependency on LocaleManager:
<bean id="addCatr" class="net.urbanguru.wanep.web.AddCatController">
<property name="userManager"><ref bean="wanepUserManager" /></property>
<property name="localeManager"><ref bean="wanepLocaleManager" /></property>
</bean>
Both beans get populated with the LocaleManager at initialise time, but the LocaleInterceptor gets populated with null:
2004-09-02 14:52:02,315 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Getting BeanInfo for class [net.urbanguru.wan
ep.web.LocaleInterceptor]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Caching PropertyDescriptors for class [net.ur
banguru.wanep.web.LocaleInterceptor]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'class' of type [class java.la
ng.Class]; editor=[null]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'localeManager' of type [class
net.urbanguru.wanep.dao.LocaleManager]; editor=[null]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Class [net.urbanguru.wanep.web.LocaleIntercep
tor] is cache-safe>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Resolving reference from prop
erty 'localeManager' in bean 'localeInterceptor' to bean 'wanepLocaleManager'>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Returning cached instance of
singleton bean 'wanepLocaleManager'>
2004-09-02 14:52:02,322 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void net.urbanguru.
wanep.web.LocaleInterceptor.setLocaleManager(net.u rbanguru.wanep.dao.LocaleManager)] on object of class [net.urbanguru.wanep.web.Loca
leInterceptor]>
net.urbanguru.wanep.web.LocaleInterceptor@8deb8a
null
2004-09-02 14:52:02,322 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void net.urbanguru.wanep.we
b.LocaleInterceptor.setLocaleManager(net.urbanguru .wanep.dao.LocaleManager)] with value of type [net.urbanguru.wanep.dao.LocaleManage
r]>
whereas the AddCat bean gets populated successfully:
2004-09-02 14:52:02,370 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Getting BeanInfo for class [net.urbanguru.wan
ep.web.AddCatController]>
2004-09-02 14:52:02,374 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Caching PropertyDescriptors for class [net.ur
banguru.wanep.web.AddCatController]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'catManager' of type [class ne
t.urbanguru.wanep.dao.CatManager]; editor=[null]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'class' of type [class java.la
ng.Class]; editor=[null]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'localeManager' of type [class
net.urbanguru.wanep.dao.LocaleManager]; editor=[null]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Class [net.urbanguru.wanep.web.AddCatControll
er] is cache-safe>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Resolving reference from prop
erty 'catManager' in bean 'addCat' to bean 'wanepCatManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Returning cached instance of
singleton bean 'wanepCatManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Resolving reference from prop
erty 'localeManager' in bean 'addCat' to bean 'wanepLocaleManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Returning cached instance of
singleton bean 'wanepLocaleManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void net.urbanguru.
wanep.web.AddCatController.setCatManager(net.urban guru.wanep.dao.CatManager)] on object of class [net.urbanguru.wanep.web.AddCatContr
oller]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void net.urbanguru.wanep.we
b.AddCatController.setCatManager(net.urbanguru.wan ep.dao.CatManager)] with value of type [net.urbanguru.wanep.dao.CatManager]>
2004-09-02 14:52:02,376 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void net.urbanguru.
wanep.web.AddCatController.setLocaleManager(net.ur banguru.wanep.dao.LocaleManager)] on object of class [net.urbanguru.wanep.web.AddCa
tController]>
AddCatController: net.urbanguru.wanep.dao.LocaleManager@87d472
2004-09-02 14:52:02,376 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void net.urbanguru.wanep.we
b.AddCatController.setLocaleManager(net.urbanguru. wanep.dao.LocaleManager)] with value of type [net.urbanguru.wanep.dao.LocaleManager
]>
This means that as soon as I send a request to the web app I immediately get a NullPointerException as the LocaleInterceptor tries to access the LocaleManager, which is of course null.
Does anybody have any idea what's going on? I am going a bit crazy.
This happens with spring 1.0.2 and 1.1 RC2
Thanks in advance,
Jez.
I have a class called LocaleInterceptor that implements HandlerInterceptor which filters some requests to the webapp. It has a dependency on a LocaleManager which looks like this:
<bean id="localeInterceptor" class="net.urbanguru.wanep.web.LocaleInterceptor">
<property name="localeManager"><ref bean="wanepLocaleManager" /></property>
</bean>
<bean id="wanepLocaleManager" class="net.urbanguru.wanep.dao.LocaleManager">
<property name="sessionFactory"><ref bean="wanepSessionFactory" /></property>
</bean>
<bean id="wanepSessionFactory" class="org.springframework.orm.hibernate.LocalSessionFact oryBean">
...CUT...
</bean>
There is another bean which has a dependency on LocaleManager:
<bean id="addCatr" class="net.urbanguru.wanep.web.AddCatController">
<property name="userManager"><ref bean="wanepUserManager" /></property>
<property name="localeManager"><ref bean="wanepLocaleManager" /></property>
</bean>
Both beans get populated with the LocaleManager at initialise time, but the LocaleInterceptor gets populated with null:
2004-09-02 14:52:02,315 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Getting BeanInfo for class [net.urbanguru.wan
ep.web.LocaleInterceptor]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Caching PropertyDescriptors for class [net.ur
banguru.wanep.web.LocaleInterceptor]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'class' of type [class java.la
ng.Class]; editor=[null]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'localeManager' of type [class
net.urbanguru.wanep.dao.LocaleManager]; editor=[null]>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Class [net.urbanguru.wanep.web.LocaleIntercep
tor] is cache-safe>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Resolving reference from prop
erty 'localeManager' in bean 'localeInterceptor' to bean 'wanepLocaleManager'>
2004-09-02 14:52:02,321 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Returning cached instance of
singleton bean 'wanepLocaleManager'>
2004-09-02 14:52:02,322 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void net.urbanguru.
wanep.web.LocaleInterceptor.setLocaleManager(net.u rbanguru.wanep.dao.LocaleManager)] on object of class [net.urbanguru.wanep.web.Loca
leInterceptor]>
net.urbanguru.wanep.web.LocaleInterceptor@8deb8a
null
2004-09-02 14:52:02,322 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void net.urbanguru.wanep.we
b.LocaleInterceptor.setLocaleManager(net.urbanguru .wanep.dao.LocaleManager)] with value of type [net.urbanguru.wanep.dao.LocaleManage
r]>
whereas the AddCat bean gets populated successfully:
2004-09-02 14:52:02,370 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Getting BeanInfo for class [net.urbanguru.wan
ep.web.AddCatController]>
2004-09-02 14:52:02,374 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Caching PropertyDescriptors for class [net.ur
banguru.wanep.web.AddCatController]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'catManager' of type [class ne
t.urbanguru.wanep.dao.CatManager]; editor=[null]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'class' of type [class java.la
ng.Class]; editor=[null]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Found property 'localeManager' of type [class
net.urbanguru.wanep.dao.LocaleManager]; editor=[null]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.CachedIntrospectionResu lts] - <Class [net.urbanguru.wanep.web.AddCatControll
er] is cache-safe>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Resolving reference from prop
erty 'catManager' in bean 'addCat' to bean 'wanepCatManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Returning cached instance of
singleton bean 'wanepCatManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Resolving reference from prop
erty 'localeManager' in bean 'addCat' to bean 'wanepLocaleManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.factory.support.Default ListableBeanFactory] - <Returning cached instance of
singleton bean 'wanepLocaleManager'>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void net.urbanguru.
wanep.web.AddCatController.setCatManager(net.urban guru.wanep.dao.CatManager)] on object of class [net.urbanguru.wanep.web.AddCatContr
oller]>
2004-09-02 14:52:02,375 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void net.urbanguru.wanep.we
b.AddCatController.setCatManager(net.urbanguru.wan ep.dao.CatManager)] with value of type [net.urbanguru.wanep.dao.CatManager]>
2004-09-02 14:52:02,376 DEBUG [org.springframework.beans.BeanWrapperImpl] - <About to invoke write method [public void net.urbanguru.
wanep.web.AddCatController.setLocaleManager(net.ur banguru.wanep.dao.LocaleManager)] on object of class [net.urbanguru.wanep.web.AddCa
tController]>
AddCatController: net.urbanguru.wanep.dao.LocaleManager@87d472
2004-09-02 14:52:02,376 DEBUG [org.springframework.beans.BeanWrapperImpl] - <Invoked write method [public void net.urbanguru.wanep.we
b.AddCatController.setLocaleManager(net.urbanguru. wanep.dao.LocaleManager)] with value of type [net.urbanguru.wanep.dao.LocaleManager
]>
This means that as soon as I send a request to the web app I immediately get a NullPointerException as the LocaleInterceptor tries to access the LocaleManager, which is of course null.
Does anybody have any idea what's going on? I am going a bit crazy.
This happens with spring 1.0.2 and 1.1 RC2
Thanks in advance,
Jez.