java.lang.IllegalStateException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

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.

tip

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


rafaelrafael

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

  • We tried to upgrade from 3.2.0 to 3.2.2, and our integration tests started failing with an IllegalStateException. This problem also exists in 3.2.1. Adding this test to RequestMappingInfoHandlerMappingTests will reproduce the problem: {code:java} @Test public void bestMatchingPatternAttributeWithParameters() { PatternsRequestCondition patterns = new PatternsRequestCondition("/site/*/{id}.p;jsessionid=*", "/site/*/{id}.p"); RequestMappingInfo key = new RequestMappingInfo(patterns, null, null, null, null, null, null); MockHttpServletRequest requestWithJsession = new MockHttpServletRequest("GET", "/site/Apple/3107695.p;jsessionid=123"); this.handlerMapping.handleMatch(key, "/site/Apple/3107695.p;jsessionid=123", requestWithJsession); assertEquals("/site/*/{id}.p;jsessionid=*", requestWithJsession.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE)); MockHttpServletRequest requestWithoutJsession = new MockHttpServletRequest("GET", "/site/Apple/3107695.p"); this.handlerMapping.handleMatch(key, "/site/Apple/3107695.p", requestWithoutJsession); assertEquals("/site/*/{id}.p", requestWithoutJsession.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE)); } {code} If you swap the order of the strings to PatternsRequestCondition, it will change the location of the failure. Please let me know if I can provide any more info. The abbreviated stacktrace is: {noformat} java.lang.IllegalStateException: Pattern "/site/*/{id}.p;jsessionid=*" is not a match for "/site/Apple/3107695.p" at org.springframework.util.Assert.state(Assert.java:385) at org.springframework.util.AntPathMatcher.extractUriTemplateVariables(AntPathMatcher.java:287) at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleMatch(RequestMappingInfoHandlerMapping.java:102) ... {noformat}
    via by Jason Terhune-Wold,
  • We tried to upgrade from 3.2.0 to 3.2.2, and our integration tests started failing with an IllegalStateException. This problem also exists in 3.2.1. Adding this test to RequestMappingInfoHandlerMappingTests will reproduce the problem: {code:java} @Test public void bestMatchingPatternAttributeWithParameters() { PatternsRequestCondition patterns = new PatternsRequestCondition("/site/*/{id}.p;jsessionid=*", "/site/*/{id}.p"); RequestMappingInfo key = new RequestMappingInfo(patterns, null, null, null, null, null, null); MockHttpServletRequest requestWithJsession = new MockHttpServletRequest("GET", "/site/Apple/3107695.p;jsessionid=123"); this.handlerMapping.handleMatch(key, "/site/Apple/3107695.p;jsessionid=123", requestWithJsession); assertEquals("/site/*/{id}.p;jsessionid=*", requestWithJsession.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE)); MockHttpServletRequest requestWithoutJsession = new MockHttpServletRequest("GET", "/site/Apple/3107695.p"); this.handlerMapping.handleMatch(key, "/site/Apple/3107695.p", requestWithoutJsession); assertEquals("/site/*/{id}.p", requestWithoutJsession.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE)); } {code} If you swap the order of the strings to PatternsRequestCondition, it will change the location of the failure. Please let me know if I can provide any more info. The abbreviated stacktrace is: {noformat} java.lang.IllegalStateException: Pattern "/site/*/{id}.p;jsessionid=*" is not a match for "/site/Apple/3107695.p" at org.springframework.util.Assert.state(Assert.java:385) at org.springframework.util.AntPathMatcher.extractUriTemplateVariables(AntPathMatcher.java:287) at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleMatch(RequestMappingInfoHandlerMapping.java:102) ... {noformat}
    via by Jason Terhune-Wold,
  • Error while Implementing HATEOAS in Spring
    via Stack Overflow by Sunil Ks
    ,
    • java.lang.IllegalStateException: Pattern "/site/*/{id}.p;jsessionid=*" is not a match for "/site/Apple/3107695.p" at org.springframework.util.Assert.state(Assert.java:385) at org.springframework.util.AntPathMatcher.extractUriTemplateVariables(AntPathMatcher.java:287) at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleMatch(RequestMappingInfoHandlerMapping.java:102)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    tvrmsmithtvrmsmith
    23 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    AxeloAxelo
    1 times, last one,
    olle.hallinolle.hallin
    2 times, last one,
    62 more bugmates