java.lang.NullPointerException

Apereo Issues | Daniel Frett | 5 years ago
  1. 0

    for this spring config: <bean id="ldap.auth.handler" class="org.jasig.cas.adaptors.ldap.FastBindLdapAuthenticationHandler"> <property name="filter" value="${ldap.dn.authenticate}" /> <property name="contextSource"> <bean class="org.springframework.ldap.core.support.LdapContextSource"> <property name="urls"> <bean class="org.apache.commons.lang.StringUtils" factory-method="split"> <constructor-arg value="${ldap.url}" /> <constructor-arg value="," /> </bean> </property> <property name="userDn" value="${ldap.userdn}" /> <property name="password" value="${ldap.password}" /> <property name="baseEnvironmentProperties"> <map> <entry key="java.naming.security.authentication" value="simple" /> <entry key="com.sun.jndi.ldap.connect.timeout" value="2000" /> <entry key="com.sun.jndi.ldap.read.timeout" value="2000" /> </map> </property> <property name="pooled" value="false" /> </bean> </property> </bean> I get the following error: 2011-08-09 14:56:28,437 ERROR [org.apache.struts2.spring.StrutsSpringObjectFactory] - <Error creating bean with name 'ldap.auth.handler' defined in ServletContext resource [/WEB-INF/spring-configuration/thekey-ldap.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Bean state is invalid: ldapTemplate - may not be null> 2011-08-09 14:56:28,449 ERROR [org.apache.struts2.dispatcher.Dispatcher] - <Dispatcher initialization failed> java.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:220) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:530) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:501) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:457) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275) at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:195) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4542) at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5220) at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5215) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) The actual code for FastBindLdapAuthenticationHandler never utilizes the ldapTemplate set in the Abstract class. And it looks like there is code in afterPropertiesSet that should set it if it isn't set already, javax.validation must run before the spring afterPropertiesSet method. removing the @NotNull annotation from ldapTemplate should fix the bug.

    Apereo Issues | 5 years ago | Daniel Frett
    java.lang.NullPointerException
  2. 0

    for this spring config: <bean id="ldap.auth.handler" class="org.jasig.cas.adaptors.ldap.FastBindLdapAuthenticationHandler"> <property name="filter" value="${ldap.dn.authenticate}" /> <property name="contextSource"> <bean class="org.springframework.ldap.core.support.LdapContextSource"> <property name="urls"> <bean class="org.apache.commons.lang.StringUtils" factory-method="split"> <constructor-arg value="${ldap.url}" /> <constructor-arg value="," /> </bean> </property> <property name="userDn" value="${ldap.userdn}" /> <property name="password" value="${ldap.password}" /> <property name="baseEnvironmentProperties"> <map> <entry key="java.naming.security.authentication" value="simple" /> <entry key="com.sun.jndi.ldap.connect.timeout" value="2000" /> <entry key="com.sun.jndi.ldap.read.timeout" value="2000" /> </map> </property> <property name="pooled" value="false" /> </bean> </property> </bean> I get the following error: 2011-08-09 14:56:28,437 ERROR [org.apache.struts2.spring.StrutsSpringObjectFactory] - <Error creating bean with name 'ldap.auth.handler' defined in ServletContext resource [/WEB-INF/spring-configuration/thekey-ldap.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Bean state is invalid: ldapTemplate - may not be null> 2011-08-09 14:56:28,449 ERROR [org.apache.struts2.dispatcher.Dispatcher] - <Dispatcher initialization failed> java.lang.NullPointerException at com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:220) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:530) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:501) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:457) at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275) at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111) at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204) at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424) at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:195) at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4542) at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5220) at org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5215) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680) The actual code for FastBindLdapAuthenticationHandler never utilizes the ldapTemplate set in the Abstract class. And it looks like there is code in afterPropertiesSet that should set it if it isn't set already, javax.validation must run before the spring afterPropertiesSet method. removing the @NotNull annotation from ldapTemplate should fix the bug.

    Apereo Issues | 5 years ago | Daniel Frett
    java.lang.NullPointerException
  3. 0

    Exception while configuring Struts2.1.6 with Tomcat 5.0

    Stack Overflow | 7 years ago | Sid
    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 com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance()
    2. XWork
      XmlConfigurationProvider.loadPackages
      1. com.opensymphony.xwork2.spring.SpringObjectFactory.getClassInstance(SpringObjectFactory.java:220)
      2. com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyResultType(XmlConfigurationProvider.java:530)
      3. com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addResultTypes(XmlConfigurationProvider.java:501)
      4. com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:457)
      5. com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:275)
      5 frames
    3. Struts2
      StrutsXmlConfigurationProvider.loadPackages
      1. org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
      1 frame
    4. XWork
      ConfigurationManager.getConfiguration
      1. com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:204)
      2. com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
      2 frames
    5. Struts2
      FilterDispatcher.init
      1. org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)
      2. org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
      3. org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:195)
      3 frames
    6. Glassfish Core
      StandardContext$2.call
      1. org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:273)
      2. org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
      3. org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:372)
      4. org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:98)
      5. org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4542)
      6. org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5220)
      7. org.apache.catalina.core.StandardContext$2.call(StandardContext.java:5215)
      7 frames
    7. Java RT
      Thread.run
      1. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      2. java.util.concurrent.FutureTask.run(FutureTask.java:138)
      3. java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      5. java.lang.Thread.run(Thread.java:680)
      5 frames