|
From: Benoit X. (JIRA) <no...@sp...> - 2009-07-10 14:59:04
|
[ http://jira.springsource.org/browse/RCP-552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45415#action_45415 ]
Benoit Xhenseval commented on RCP-552:
--------------------------------------
Still an issue.
I'm unable to find which bean would be causing this premature instantiation.
In any case, this is not obvious for users of the library, therefore I'd recommend applying the patch (it is very basic!)
Thanks
Benoit
> NPE in MessagesDialogExceptionHandler
> -------------------------------------
>
> Key: RCP-552
> URL: http://jira.springsource.org/browse/RCP-552
> Project: Spring Rich Client Project
> Issue Type: Bug
> Components: Core
> Affects Versions: 1.0.0
> Environment: JDK5, WinXP
> Reporter: Benoit Xhenseval
> Assignee: Lieven Doclo
> Fix For: 1.x
>
> Attachments: AbstractDialogExceptionHandler.java.patch
>
>
> Hi
> I still get an NPE whenever I use MessagesDialogExceptionHandler.
> For some reason, may be due to my xml configuration (??), the method afterPropertiesSet is called before ApplicationServicesLocator.services() is fully setup:
> Caused by: java.lang.NullPointerException
> at org.springframework.richclient.exceptionhandling.AbstractDialogExceptionHandler.afterPropertiesSet(AbstractDialogExceptionHandler.java:51)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1390)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1359)
> I am using the sample configuration:
> <bean id="exceptionHandler" class="org.springframework.richclient.exceptionhandling.delegation.DelegatingExceptionHandler">
> <property name="delegateList">
> <list>
> <bean class="org.springframework.richclient.exceptionhandling.delegation.SimpleExceptionHandlerDelegate">
> <property name="throwableClassList">
> <list>
> <value type="java.lang.Class">org.acegisecurity.AuthenticationException</value>
> <value type="java.lang.Class">org.acegisecurity.AccessDeniedException</value>
> </list>
> </property>
> <property name="exceptionHandler">
> <bean class="org.springframework.richclient.exceptionhandling.MessagesDialogExceptionHandler">
> <property name="logLevel" value="WARN" />
> <property name="shutdownPolicy" value="NONE" />
> </bean>
> </property>
> </bean>
> <bean class="org.springframework.richclient.exceptionhandling.delegation.SimpleExceptionHandlerDelegate">
> <property name="throwableClass" value="java.lang.Error" />
> <property name="exceptionHandler">
> <bean class="net.objectlab.safemargin.gui.SafeMarginExceptionHandler">
> <property name="logLevel" value="FATAL" />
> <property name="shutdownPolicy" value="OBLIGATE" />
> <property name="issueReporter" ref="issueReporter" />
> </bean>
> </property>
> </bean>
> <!-- The order is important: if Throwable would be first then the others would be ignored -->
> <bean class="org.springframework.richclient.exceptionhandling.delegation.SimpleExceptionHandlerDelegate">
> <property name="throwableClass" value="java.lang.Throwable" />
> <property name="exceptionHandler">
> <bean class="net.objectlab.safemargin.gui.SafeMarginExceptionHandler">
> <property name="logLevel" value="ERROR" />
> <property name="shutdownPolicy" value="ASK" />
> <property name="issueReporter" ref="issueReporter" />
> </bean>
> </property>
> </bean>
> </list>
> </property>
> </bean>
> Any suggestion why this happens immediately at startup?
> <bean id="safemarginLifecycleAdvisor" class="net.objectlab.safemargin.gui.SafeMarginLifecycleAdvisor">
> ....
> <property name="registerableExceptionHandler" ref="exceptionHandler" />
> </bean>
> I will suggest a workaround and a patch that delays the access to ApplicationServicesLocator.services().
> Thanks
> Benoit.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.springsource.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|