[ https://issues.apache.org/jira/browse/WICKET-5135?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emond Papegaaij resolved WICKET-5135. ------------------------------------- Resolution: Fixed Fix Version/s: 6.10.0 7.0.0 I've added several checks in the initialization code. > wicket-atmosphere EventBus constructor throws NullPointerException under > invalid state > -------------------------------------------------------------------------------------- > > Key: WICKET-5135 > URL: https://issues.apache.org/jira/browse/WICKET-5135 > Project: Wicket > Issue Type: Bug > Components: wicket-atmosphere > Affects Versions: 6.6.0 > Reporter: Hendy Irawan > Assignee: Emond Papegaaij > Fix For: 7.0.0, 6.10.0 > > > With invalid configuration, like the WebApplication not yet associated with > the servlet, wicket-atmosphere throws NPE. > {code} > Caused by: org.springframework.beans.factory.BeanCreationException: Error > creating bean with name 'atmosphereEventBus' defined in class > id.co.bippo.springapp.AppConfig: Instantiation of bean failed; nested > exception is org.springframework.beans.factory.BeanDefinitionStoreException: > Factory method [public org.apache.wicket.atmosphere.EventBus > id.co.bippo.springapp.AppConfig.atmosphereEventBus()] threw exception; nested > exception is java.lang.NullPointerException > at > org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1031) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:927) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:314) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:910) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:853) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:768) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > ... 107 common frames omitted > Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: > Factory method [public org.apache.wicket.atmosphere.EventBus > id.co.bippo.springapp.AppConfig.atmosphereEventBus()] threw exception; nested > exception is java.lang.NullPointerException > at > org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:181) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > ... 117 common frames omitted > Caused by: java.lang.NullPointerException: null > at org.apache.wicket.atmosphere.EventBus.<init>(EventBus.java:113) > ~[wicket-atmosphere-0.8.jar:0.8] > at > id.co.bippo.springapp.SoluvasWebApplication.getEventBus(SoluvasWebApplication.java:296) > ~[SoluvasWebApplication.class:na] > at > id.co.bippo.springapp.AppConfig.atmosphereEventBus(AppConfig.java:270) > ~[AppConfig.class:na] > at > id.co.bippo.springapp.AppConfig$$EnhancerByCGLIB$$a9c1dc07.CGLIB$atmosphereEventBus$1(<generated>) > ~[spring-core-3.2.2.RELEASE.jar:na] > at > id.co.bippo.springapp.AppConfig$$EnhancerByCGLIB$$a9c1dc07$$FastClassByCGLIB$$40a0fc3e.invoke(<generated>) > ~[spring-core-3.2.2.RELEASE.jar:na] > at > org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) > ~[spring-core-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:286) > ~[spring-context-3.2.2.RELEASE.jar:3.2.2.RELEASE] > at > id.co.bippo.springapp.AppConfig$$EnhancerByCGLIB$$a9c1dc07.atmosphereEventBus(<generated>) > ~[spring-core-3.2.2.RELEASE.jar:na] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > ~[na:1.7.0_15] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > ~[na:1.7.0_15] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[na:1.7.0_15] > at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_15] > at > org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:160) > ~[spring-beans-3.2.2.RELEASE.jar:3.2.2.RELEASE] > ... 118 common frames omitted > {code} > It should wrap the NPE in a more descriptive error. Suggestion: "Provided > Wicket WebApplication is not associated with a ServletContext. Please ensure > Wicket application is fully initialized before creating Atmosphere EventBus." -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira