java.lang.IllegalStateException

Could not find current request via RequestContextHolder. Is this being called from a Spring MVC handler?

Samebug tips2

If you're using boot 1.4.x you need to modify the @springBootTest annotation to @SpringBootTest(classes = DataFlowServerConfiguration.class). 1.3.8 doesn't have this problem as well.


rafaelrafael

Spring Boot 1.4 changed their annotation system a little. Try using the @SpringBootApplication annotation for better results.


rafaelrafael

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web184

  • Stack trace

    • java.lang.IllegalStateException: Could not find current request via RequestContextHolder. Is this being called from a Spring MVC handler? at org.springframework.util.Assert.state(Assert.java:392)[spring-core-4.2.3.RELEASE.jar:4.2.3.RELEASE] at org.springframework.hateoas.mvc.ControllerLinkBuilder.getCurrentRequest(ControllerLinkBuilder.java:242)[spring-hateoas-0.19.0.RELEASE.jar:na] at org.springframework.hateoas.mvc.ControllerLinkBuilder.getBuilder(ControllerLinkBuilder.java:189)[spring-hateoas-0.19.0.RELEASE.jar:na] at org.springframework.hateoas.mvc.ControllerLinkBuilderFactory.linkTo(ControllerLinkBuilderFactory.java:121)[spring-hateoas-0.19.0.RELEASE.jar:na] at org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo(ControllerLinkBuilder.java:138)[spring-hateoas-0.19.0.RELEASE.jar:na]

    Write tip

    You have a different solution? A short tip here would help you and many other users who saw this issue last week.

    Users with the same issue

    ifercaiferca
    9 times, last one
    Unknown visitor
    Unknown visitorOnce,
    Unknown visitor
    Unknown visitorOnce,
    tvrmsmithtvrmsmith
    2 times, last one
    bernardpaulusbernardpaulus
    18 times, last one
    64 more bugmates