Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5135

wicket-atmosphere EventBus constructor throws NullPointerException under invalid state

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.6.0
    • 6.10.0, 7.0.0-M1
    • wicket-atmosphere
    • None

    Description

      With invalid configuration, like the WebApplication not yet associated with the servlet, wicket-atmosphere throws NPE.

      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
      

      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."

      Attachments

        Activity

          People

            papegaaij Emond Papegaaij
            ceefour Hendy Irawan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: