Uploaded image for project: 'ZK Spring'
  1. ZK Spring
  2. ZKSPRING-34

NullPointerException is sometimes thrown by ZkComponentFactoryBean

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Normal Normal
    • 3.1.1
    • 3.1
    • core
    • None

      When reloading a web-application we get the following NullPointerException logged by spring.

      11:16:27 WARN  FactoryBean threw exception from getObjectType, despite the contract saying that it should return null if the type of its object cannot be determined yet   (FactoryBeanRegistrySupport.java:70)
      java.lang.NullPointerException: null
      	at org.zkoss.spring.bean.ZkComponentFactoryBean.getObject0(ZkComponentFactoryBean.java:129) ~[zkspring-core-3.1.jar:na]
      	at org.zkoss.spring.bean.ZkComponentFactoryBean.getObjectType(ZkComponentFactoryBean.java:173) ~[zkspring-core-3.1.jar:na]
      	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getTypeForFactoryBean(FactoryBeanRegistrySupport.java:65) ~[spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryBean(AbstractAutowireCapableBeanFactory.java:715) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.AbstractBeanFactory.isTypeMatch(AbstractBeanFactory.java:519) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:342) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:320) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:187) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:861) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:735) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:484) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1102) [spring-context-3.2.0.BUILD-SNAPSHOT.jar:3.2.0.BUILD-SNAPSHOT]
      	at com.avanon.pmodel.gui.zk.PMUIDesktopContextCtrl.init(PMUIDesktopContextCtrl.java:92) [classes/:na]
      	at org.zkoss.zk.ui.util.Configuration.invokeDesktopInits(Configuration.java:829) [zk-6.0.1.jar:6.0.1]
      	at org.zkoss.zk.ui.impl.DesktopImpl.<init>(DesktopImpl.java:257) [zk-6.0.1.jar:6.0.1]
      	at org.zkoss.zk.ui.impl.AbstractUiFactory.newDesktop(AbstractUiFactory.java:85) [zk-6.0.1.jar:6.0.1]
      	at org.zkoss.spring.bean.ZkSpringUiFactory.newDesktop(ZkSpringUiFactory.java:126) [zkspring-core-3.1.jar:na]
      	at org.zkoss.zk.ui.http.WebManager.newDesktop(WebManager.java:480) [zk-6.0.1.jar:6.0.1]
      	at org.zkoss.zk.ui.http.WebManager.getDesktop(WebManager.java:461) [zk-6.0.1.jar:6.0.1]
      	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:186) [zk-6.0.1.jar:6.0.1]
      	at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:135) [zk-6.0.1.jar:6.0.1]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) [servlet-api-2.5.jar:2.5]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) [servlet-api-2.5.jar:2.5]
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:547) [jetty-servlet-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:481) [jetty-servlet-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520) [jetty-security-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:940) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:409) [jetty-servlet-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:874) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.Server.handle(Server.java:349) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:441) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:904) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:565) [jetty-http-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217) [jetty-http-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:46) [jetty-server-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:545) [jetty-io-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:43) [jetty-io-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598) [jetty-util-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533) [jetty-util-7.5.1.v20110908.jar:7.5.1.v20110908]
      	at java.lang.Thread.run(Thread.java:662) [na:1.6.0_31]
      

      We use a custome DesktopInit implementation that will trigger initialization of a spring bean, this bean wires other beans over an @Autowired annotation and will trigger the above exception while it tries to autowire by type.

      The method ZkComponentFactoryBean.getObject0(...) should return null if ((ExecutionCtrl)exec).getCurrentPage() returns null

            hawk hawk
            dtommasina dtommasina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: