java.lang.NullPointerException

Spring JIRA | Mike Youngstrom | 10 years ago
  1. 0

    I'm using a PropertyPlaceholderConfigurer and I'm using <null/> in some of my bean definitions. After upgrading to 2.0.3 I get the following exception for a configuration using the PropertyPlaceholderConfigurer I don't get this error with 2.0.2 If I don't pass in a <null/> property everything works fine: SomeBean.java public class SomeBean { public void setSomeProperty(Object obj) { } } applicationContext.xml <bean class="SomeBean"> <property name="testProperty"><null/></property> </bean> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" lazy-init="false"> <property name="locations"> <list> <value>classpath:property.properties</value> </list> <property/> </bean> Exception java.lang.NullPointerException at java.lang.StringBuffer.<init>(StringBuffer.java:104) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.parseStringValue(PropertyPlaceholderConfigurer.java:270) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingBeanDefinitionVisitor.resolveStringValue(PropertyPlaceholderConfigurer.java:401) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:143) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:89) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:59) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:246) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:422) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334) 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:585) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1185) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1147) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1110) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:431) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:221) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:111) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1047) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:843) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:254) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:683) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:394) at org.lds.stack.spring.context.WebContextSingletonBeanFactoryLocator.useBeanFactory(WebContextSingletonBeanFactoryLocator.java:38) at org.lds.stack.spring.context.BootstrapContextLoader.createWebApplicationContext(BootstrapContextLoader.java:30) 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:3764) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) 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:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

    Spring JIRA | 10 years ago | Mike Youngstrom
    java.lang.NullPointerException
  2. 0

    I'm using a PropertyPlaceholderConfigurer and I'm using <null/> in some of my bean definitions. After upgrading to 2.0.3 I get the following exception for a configuration using the PropertyPlaceholderConfigurer I don't get this error with 2.0.2 If I don't pass in a <null/> property everything works fine: SomeBean.java public class SomeBean { public void setSomeProperty(Object obj) { } } applicationContext.xml <bean class="SomeBean"> <property name="testProperty"><null/></property> </bean> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" lazy-init="false"> <property name="locations"> <list> <value>classpath:property.properties</value> </list> <property/> </bean> Exception java.lang.NullPointerException at java.lang.StringBuffer.<init>(StringBuffer.java:104) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.parseStringValue(PropertyPlaceholderConfigurer.java:270) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingBeanDefinitionVisitor.resolveStringValue(PropertyPlaceholderConfigurer.java:401) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:143) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:89) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:59) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:246) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:422) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334) 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:585) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1185) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1147) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1110) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:431) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:221) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:111) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1047) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:843) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:254) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:251) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:683) at org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:394) at org.lds.stack.spring.context.WebContextSingletonBeanFactoryLocator.useBeanFactory(WebContextSingletonBeanFactoryLocator.java:38) at org.lds.stack.spring.context.BootstrapContextLoader.createWebApplicationContext(BootstrapContextLoader.java:30) 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:3764) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardHost.start(StandardHost.java:736) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:448) at org.apache.catalina.core.StandardServer.start(StandardServer.java:700) at org.apache.catalina.startup.Catalina.start(Catalina.java:552) 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:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)

    Spring JIRA | 10 years ago | Mike Youngstrom
    java.lang.NullPointerException
  3. 0

    After upgrading from Spring 2.0.2 to Spring 2.0.3 I'm getting this error in the startup: java.lang.NullPointerException at java.lang.StringBuffer.<init>(StringBuffer.java:104) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.parseStringValue(PropertyPlaceholderConfigurer.java:270) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingBeanDefinitionVisitor.resolveStringValue(PropertyPlaceholderConfigurer.java:401) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:143) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:89) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:59) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:246) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:325) We have a custom ApplicationContext implementation and are using custom namespace handlers. They might have something to do with the problem. Any ways there could be some protective code in org.springframework.beans.factory.config.BeanDefitionVisitor's resolveValue method. These are the lines that could be changed: 141: else if (value instanceof TypedStringValue) { 142: TypedStringValue typedStringValue = (TypedStringValue) value; 143: String visitdString = resolveStringValue(typedStringValue.getValue()); 144: typedStringValue.setValue(visitdString); suggested change else if (value instanceof TypedStringValue) { TypedStringValue typedStringValue = (TypedStringValue) value; if (typedStringValue.getValue() != null) { String visitdString = resolveStringValue(typedStringValue.getValue()); typedStringValue.setValue(visitdString); }

    Spring JIRA | 10 years ago | Lari Hotari
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    After upgrading from Spring 2.0.2 to Spring 2.0.3 I'm getting this error in the startup: java.lang.NullPointerException at java.lang.StringBuffer.<init>(StringBuffer.java:104) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.parseStringValue(PropertyPlaceholderConfigurer.java:270) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingBeanDefinitionVisitor.resolveStringValue(PropertyPlaceholderConfigurer.java:401) at org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:143) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:89) at org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:59) at org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:246) at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:325) We have a custom ApplicationContext implementation and are using custom namespace handlers. They might have something to do with the problem. Any ways there could be some protective code in org.springframework.beans.factory.config.BeanDefitionVisitor's resolveValue method. These are the lines that could be changed: 141: else if (value instanceof TypedStringValue) { 142: TypedStringValue typedStringValue = (TypedStringValue) value; 143: String visitdString = resolveStringValue(typedStringValue.getValue()); 144: typedStringValue.setValue(visitdString); suggested change else if (value instanceof TypedStringValue) { TypedStringValue typedStringValue = (TypedStringValue) value; if (typedStringValue.getValue() != null) { String visitdString = resolveStringValue(typedStringValue.getValue()); typedStringValue.setValue(visitdString); }

    Spring JIRA | 10 years ago | Lari Hotari
    java.lang.NullPointerException
  6. 0

    1.2 for OSX even worse than 1.1

    Oracle Community | 9 years ago | 491831
    java.lang.NullPointerException

    1 unregistered visitors
    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 java.lang.StringBuffer.<init>()
    2. Java RT
      StringBuffer.<init>
      1. java.lang.StringBuffer.<init>(StringBuffer.java:104)
      1 frame
    3. Spring Beans
      PropertyResourceConfigurer.postProcessBeanFactory
      1. org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.parseStringValue(PropertyPlaceholderConfigurer.java:270)
      2. org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingBeanDefinitionVisitor.resolveStringValue(PropertyPlaceholderConfigurer.java:401)
      3. org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:143)
      4. org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:89)
      5. org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:59)
      6. org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:246)
      7. org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:75)
      7 frames
    4. Spring Context
      AbstractApplicationContext.refresh
      1. org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:422)
      2. org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:334)
      2 frames
    5. 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:585)
      4 frames
    6. Spring Beans
      AbstractBeanFactory.getBean
      1. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1185)
      2. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1147)
      3. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1110)
      4. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:431)
      5. org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:221)
      6. org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:111)
      7. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1047)
      8. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:843)
      9. org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
      10. org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:254)
      11. org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144)
      12. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:251)
      13. org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
      13 frames
    7. Spring Context
      AbstractApplicationContext.getBean
      1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:683)
      1 frame
    8. Spring Beans
      SingletonBeanFactoryLocator.useBeanFactory
      1. org.springframework.beans.factory.access.SingletonBeanFactoryLocator.useBeanFactory(SingletonBeanFactoryLocator.java:394)
      1 frame
    9. org.lds.stack
      BootstrapContextLoader.createWebApplicationContext
      1. org.lds.stack.spring.context.WebContextSingletonBeanFactoryLocator.useBeanFactory(WebContextSingletonBeanFactoryLocator.java:38)
      2. org.lds.stack.spring.context.BootstrapContextLoader.createWebApplicationContext(BootstrapContextLoader.java:30)
      2 frames
    10. Spring
      ContextLoaderListener.contextInitialized
      1. org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
      2. org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
      2 frames
    11. Glassfish Core
      Catalina.start
      1. org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
      2. org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
      3. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      4. org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
      5. org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      6. org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      7. org.apache.catalina.core.StandardService.start(StandardService.java:448)
      8. org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
      9. org.apache.catalina.startup.Catalina.start(Catalina.java:552)
      9 frames
    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:585)
      4 frames
    13. Glassfish Core
      Bootstrap.main
      1. org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
      2. org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
      2 frames