java.lang.NullPointerException

Spring JIRA | Andrzej Dengusiak | 1 decade ago
  1. 0

    I'm trying to create a pool of Converter objects, so I won't have to initialize them every time, but Spring throws NullPointerException on context initialization. My config is 1:1 copy from documentation but it doesn't work. Tested on Spring 2.0 RC1 and Spring 2.0 RC2 <bean id="converterTarget" class="xxx.openoffice.Converter" singleton="false" /> <bean id="converterCommonsPoolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource"> <property name="maxSize" value="10" /> <property name="targetBeanName" value="converterTarget" /> </bean> <bean id="openOfficeConverter" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="targetSource" ref="converterCommonsPoolTargetSource" /> </bean> 2006-07-07 12:01:45,256 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openOfficeConverter': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException Caused by: java.lang.NullPointerException at org.springframework.util.ClassUtils.getAllInterfacesForClassAsSet(ClassUtils.java:486) at org.springframework.util.ClassUtils.getAllInterfacesForClass(ClassUtils.java:464) at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance(ProxyFactoryBean.java:300) at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:253) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromFactoryBean(AbstractBeanFactory.java:991) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:960) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:215) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:609) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:277) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:188) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:181) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findMatchingBeans(DefaultListableBeanFactory.java:325) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:648) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:571) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:257) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.AbstractBeanFactory.getType(AbstractBeanFactory.java:392) at org.springframework.beans.factory.support.DefaultListableBeanFactory.isBeanTypeMatch(DefaultListableBeanFactory.java:228) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:141) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:188) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:181) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findMatchingBeans(DefaultListableBeanFactory.java:325) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:648) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:571) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:257) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:254) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:332) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503) at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.apache.catalina.core.StandardContext.init(StandardContext.java:5116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503) at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at [...]

    Spring JIRA | 1 decade ago | Andrzej Dengusiak
    java.lang.NullPointerException
  2. 0

    I'm trying to create a pool of Converter objects, so I won't have to initialize them every time, but Spring throws NullPointerException on context initialization. My config is 1:1 copy from documentation but it doesn't work. Tested on Spring 2.0 RC1 and Spring 2.0 RC2 <bean id="converterTarget" class="xxx.openoffice.Converter" singleton="false" /> <bean id="converterCommonsPoolTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource"> <property name="maxSize" value="10" /> <property name="targetBeanName" value="converterTarget" /> </bean> <bean id="openOfficeConverter" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="targetSource" ref="converterCommonsPoolTargetSource" /> </bean> 2006-07-07 12:01:45,256 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openOfficeConverter': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException Caused by: java.lang.NullPointerException at org.springframework.util.ClassUtils.getAllInterfacesForClassAsSet(ClassUtils.java:486) at org.springframework.util.ClassUtils.getAllInterfacesForClass(ClassUtils.java:464) at org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance(ProxyFactoryBean.java:300) at org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:253) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromFactoryBean(AbstractBeanFactory.java:991) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:960) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:215) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:609) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:566) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:277) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:199) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:188) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:181) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findMatchingBeans(DefaultListableBeanFactory.java:325) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:648) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:571) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:257) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.AbstractBeanFactory.getType(AbstractBeanFactory.java:392) at org.springframework.beans.factory.support.DefaultListableBeanFactory.isBeanTypeMatch(DefaultListableBeanFactory.java:228) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:141) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:188) at org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:181) at org.springframework.beans.factory.support.DefaultListableBeanFactory.findMatchingBeans(DefaultListableBeanFactory.java:325) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:648) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:571) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:257) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:254) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:332) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503) at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at org.apache.catalina.core.StandardContext.init(StandardContext.java:5116) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503) at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659) at [...]

    Spring JIRA | 1 decade ago | Andrzej Dengusiak
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.util.ClassUtils.getAllInterfacesForClassAsSet()
    2. Spring Core
      ClassUtils.getAllInterfacesForClass
      1. org.springframework.util.ClassUtils.getAllInterfacesForClassAsSet(ClassUtils.java:486)
      2. org.springframework.util.ClassUtils.getAllInterfacesForClass(ClassUtils.java:464)
      2 frames
    3. Spring AOP
      ProxyFactoryBean.getObject
      1. org.springframework.aop.framework.ProxyFactoryBean.getSingletonInstance(ProxyFactoryBean.java:300)
      2. org.springframework.aop.framework.ProxyFactoryBean.getObject(ProxyFactoryBean.java:253)
      2 frames
    4. Spring Beans
      DefaultListableBeanFactory.preInstantiateSingletons
      1. org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromFactoryBean(AbstractBeanFactory.java:991)
      2. org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:960)
      3. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:215)
      4. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)
      5. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:609)
      6. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:566)
      7. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389)
      8. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:277)
      9. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)
      10. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:199)
      11. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:188)
      12. org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:181)
      13. org.springframework.beans.factory.support.DefaultListableBeanFactory.findMatchingBeans(DefaultListableBeanFactory.java:325)
      14. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:648)
      15. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:571)
      16. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389)
      17. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:257)
      18. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)
      19. org.springframework.beans.factory.support.AbstractBeanFactory.getType(AbstractBeanFactory.java:392)
      20. org.springframework.beans.factory.support.DefaultListableBeanFactory.isBeanTypeMatch(DefaultListableBeanFactory.java:228)
      21. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:141)
      22. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:194)
      23. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:188)
      24. org.springframework.beans.factory.BeanFactoryUtils.beansOfTypeIncludingAncestors(BeanFactoryUtils.java:181)
      25. org.springframework.beans.factory.support.DefaultListableBeanFactory.findMatchingBeans(DefaultListableBeanFactory.java:325)
      26. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:648)
      27. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:571)
      28. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:389)
      29. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:257)
      30. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:168)
      31. org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:254)
      31 frames
    5. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:332)
      1 frame
    6. Spring
      ContextLoaderListener.contextInitialized
      1. org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
      2. org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
      3. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
      4. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
      4 frames
    7. Glassfish Core
      StandardHost.addChild
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
      2. org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
      3. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
      4. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
      5. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
      5 frames
    8. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:324)
      4 frames
    9. Commons Modeler
      BaseModelMBean.invoke
      1. org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
      1 frame
    10. JBoss Application Server J2SE
      MBeanServerImpl.invoke
      1. org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      2. org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      2 frames
    11. Glassfish Core
      StandardContext.init
      1. org.apache.catalina.core.StandardContext.init(StandardContext.java:5116)
      1 frame
    12. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:324)
      4 frames
    13. Commons Modeler
      BaseModelMBean.invoke
      1. org.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
      1 frame
    14. JBoss Application Server J2SE
      MBeanServerImpl.invoke
      1. org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
      2. org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      2 frames