Assert.state() has thrown an IllegalStateException

java.lang.IllegalStateException
Javadoc
Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation. @author Jonni Kanerva @since JDK1.1
at org.springframework.util.Assert.state
(source)

Typical Exception Messages

  1. Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
  2. Cannot find migrations location in: [db/migration] (please add migrations or check your Flyway configuration)
  3. Cannot load driver class: com.mysql.jdbc.Driver
  4. Can't set AsyncWebRequest with concurrent handling in progress
  5. Unable to configure LocalContainerEntityManagerFactoryBean from @EntityScan, ensure an appropriate bean is registered.
  6. Cannot find changelog location: class path resource [db/changelog/db.changelog-master.yaml] (please add changelog or check your Liquibase configuration)
  7. There is not EC2 meta data available, because the application is not running in the EC2 environment. Region detection is only possible if the application is running on a EC2 instance
  8. Cannot find template location: classpath:/templates/ (please add some templates, check your Velocity configuration, or set spring.velocity.checkTemplateLocation=false)
  9. Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
  10. Could not find current request via RequestContextHolder

Specific cases

Solution

Nwabunnia, 6 months ago

You need to set the type property in your bean XML file. <property name="targetType" value="some value" />

External results for this pattern (207)

  1. yngwietigervia GitHub4 days ago
    Service id not legal hostname (${authserver.listOfServers})
    Show stack trace
  2. Request URI does not contain a valid hostname: http://hello_service/hello?name=Vasya
    Show stack trace
  3. Renuvia Stack Overflow2 weeks ago
    RedisConnectionFactory is required
    Show stack trace
  4. Rejivia Stack Overflow2 weeks ago
    ResponseBodyEmitter is already set complete
    Show stack trace
  5. I. Linvia Stack Overflow2 weeks ago
    Cannot load driver class: com.mysql.jdbc.Driver
    Show stack trace
  6. Krishasvia Stack Overflow2 weeks ago
  7. Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "true" to servlet and filter declarations in web.xml.] with root cause java.lang.IllegalStateException: Async support must be enabled on a servlet and for all filters involved in async request processing. This is done in Java code using the Servlet API or by adding "true" to servlet and filter declarations in web.xml.
    Show stack trace
  8. ZiOSvia Stack Overflow2 weeks ago
    Service id not legal hostname (${edgeServer})
    Show stack trace
  9. evenX86via GitHub2 weeks ago
    Cannot find changelog location: ServletContext resource [/db/changelog/db.changelog-master.xml] (please add changelog or check your Liquibase configuration)
    Show stack trace
  10. Marekvia Stack Overflow3 weeks ago
    Cannot load driver class: com.mysql.jdbc.Driver
    Show stack trace