Assert.notNull() has thrown an IllegalArgumentException

java.lang.IllegalArgumentException
Javadoc
Thrown to indicate that a method has been passed an illegal or inappropriate argument. @author unascribed @since JDK1.0
at org.springframework.util.Assert.notNull
(Source)

Typical Exception Messages

  1. A ServletContext is required to configure default servlet handling
  2. [Assertion failed] - this argument is required; it must not be null
  3. Cannot load an ApplicationContext with a NULL 'contextLoader'. Consider annotating your test class with @ContextConfiguration or @ContextHierarchy.
  4. @EnableAsync annotation metadata was not injected
  5. No SqlMapClient specified
  6. PersistentEntity must not be null!
  7. Class must not be null
  8. ResourceLoader must not be null
  9. WebApplicationContext is required
  10. An AuthenticationManager is required

Specific cases

We have seen this error pattern in the following webpages (598)

  1. Pierre-Etienne Poirotvia Ecosystem JIRA1 day ago
    URL must not be null
  2. No ConfigurationProperties annotation found on 'io.eventuate.local.java.kafka.EventuateKafkaConfigurationProperties'.
  3. ci-joevia Stack Overflow6 days ago
    ResourceLoader must not be null
  4. Error creating bean with name 'customConcurrentSessionFilter' defined in class path resource [com/cii/config/SecurityConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: SessionRegistry required
  5. WebApplicationContext is required
  6. Error creating bean with name 'projectingArgumentResolverBeanPostProcessor' defined in class path resource [org/springframework/data/web/config/ProjectingArgumentResolverRegistrar.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'metaDataSourceAdvisor': Cannot resolve reference to bean 'methodSecurityMetadataSource' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'aclMethodSecurityConfig': Unsatisfied dependency expressed through method 'setMethodSecurityExpressionHandler' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultMethodSecurityExpressionHandler' defined in class path resource [com/xyz/timetracker/config/AclMethodSecurityConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.access.expression.method.MethodSecurityExpressionHandler]: Circular reference involving containing bean 'aclMethodSecurityConfig' - consider declaring the factory method as static for independence from its containing instance. Factory method 'defaultMethodSecurityExpressionHandler' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aclService' defined in class path resource [com/xyz/timetracker/config/AclMethodSecurityConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.acls.jdbc.JdbcMutableAclService]: Circular reference involving containing bean 'aclMethodSecurityConfig' - consider declaring the factory method as static for independence from its containing instance. Factory method 'aclService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lookupStrategy' defined in class path resource [com/xyz/timetracker/config/AclMethodSecurityConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.acls.jdbc.LookupStrategy]: Circular reference involving containing bean 'aclMethodSecurityConfig' - consider declaring the factory method as static for independence from its containing instance. Factory method 'lookupStrategy' threw exception; nested exception is java.lang.IllegalArgumentException: DataSource required
  7. SFAHvia Stack Overflow3 weeks ago
    PersistentEntity must not be null!
  8. WebApplicationContext is required