精华内容
下载资源
问答
  • 主要介绍了Android异常 java.lang.IllegalStateException解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
  • 异常:Caused by: java.lang.IllegalStateException: Method has too many Body parameters Caused by: java.lang.IllegalStateException: Method has too many Body parameters: public abstract ...
  • NULL 博文链接:https://anminer.iteye.com/blog/845067
  • IllegalStateException

    千次阅读 2019-04-15 14:19:00
    解释:在不合理或不正确时间内唤醒一方法 例如:在 JSP / Servlet 编程中,服务器已经开始把数据发回客户端了,你却想改动字符集encoding参数,就会报这个错,因为开始回复数据到客户端后就不能再修改任何 ...

    解释:在不合理或不正确时间内唤醒一方法

    例如:在 JSP / Servlet 编程中,服务器已经开始把数据发回客户端了,你却想改动字符集encoding参数,就会报这个错,因为开始回复数据到客户端后就不能再修改任何 Http header 内容。

    简单来说,多用于覆水难收却硬要改变的情形

    转载于:https://www.cnblogs.com/yanze/p/10710405.html

    展开全文
  • NULL 博文链接:https://hw1287789687.iteye.com/blog/1925191
  • 这个存储库提供了一种在处理片段传输和后台任务时避免“java.lang.IllegalStateException:Can not perform this action after onSaveInstanceState”的方法。 您可以在的非常权威的阅读有关该问题和可能的解决方案...
  • 纠结了半天的 java.lang.IllegalStateException: getOutputStream() has already。这个问题困扰了半天,在网上查阅了大量资料 出这个错误一般就是下面2个.....
  • java.lang.IllegalStateException: No instances available for user 这里的user是在eureka上注册的spring.application.name 解决思路: 在学习springcloud,学到ribbon时,遇到这个问题,原因是我用的 springboot...

    如下

    java.lang.IllegalStateException: No instances available for user
    

    这里的user是在eureka上注册的spring.application.name

    解决思路:

    在学习springcloud,学到ribbon时,遇到这个问题,原因是我用的
    springboot是2.2.4.RELEASE,springcloud版本Hoxton.SR1,
    而视频教程springboot版本是1.4.7,springcloud版本Camden.SR7,
    在写NewRuleConfig类时,里面有个方法如下:

    	/**
    	 * 每隔10秒执行一次ping命令,可以指定ping命令指向端点的path
    	 * @param config
    	 * @return
    	 */
    	@Bean
    	public IPing ribbonPing(IClientConfig config){
    		// PingUrl  是让我们指定一个url路径,每次执行健康检查的时候,就发送URL请求
    		return new PingUrl(false,"/health");
    	}
    

    改成下面这样,即增加一个/actuator,这是因为springboot2.x之后,健康检查路径都加了/actuator

    	/**
    	 * 每隔10秒执行一次ping命令,可以指定ping命令指向端点的path
    	 * @param config
    	 * @return
    	 */
    	@Bean
    	public IPing ribbonPing(IClientConfig config){
    		// PingUrl  是让我们指定一个url路径,每次执行健康检查的时候,就发送URL请求
    		return new PingUrl(false,"/actuator/health");
    	}
    
    java.lang.IllegalStateException: No instances available for user
    	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:119) ~[spring-cloud-netflix-ribbon-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    
    
    
    java.lang.NullPointerException: null
    	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:192) ~[guava-15.0.jar:na]
    	at com.google.common.cache.LocalCache.get(LocalCache.java:3931) ~[guava-15.0.jar:na]
    	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936) ~[guava-15.0.jar:na]
    	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806) ~[guava-15.0.jar:na]
    	at com.netflix.loadbalancer.LoadBalancerStats.getServerStats(LoadBalancerStats.java:185) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.LoadBalancerStats.getSingleServerStat(LoadBalancerStats.java:372) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.AvailabilityPredicate.apply(AvailabilityPredicate.java:73) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.AvailabilityPredicate.apply(AvailabilityPredicate.java:35) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.CompositePredicate.apply(CompositePredicate.java:52) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.CompositePredicate.apply(CompositePredicate.java:40) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.AvailabilityFilteringRule.choose(AvailabilityFilteringRule.java:86) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.BaseLoadBalancer.chooseServer(BaseLoadBalancer.java:755) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at com.netflix.loadbalancer.ZoneAwareLoadBalancer.chooseServer(ZoneAwareLoadBalancer.java:113) ~[ribbon-loadbalancer-2.3.0.jar:2.3.0]
    	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.getServer(RibbonLoadBalancerClient.java:189) ~[spring-cloud-netflix-ribbon-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:117) ~[spring-cloud-netflix-ribbon-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:99) ~[spring-cloud-netflix-ribbon-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:58) ~[spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:93) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:77) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:742) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:677) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:615) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at com.example.house.apigateway.config.GenericRest.get(GenericRest.java:38) ~[classes/:na]
    	at com.example.house.apigateway.dao.UserDao.getUserName(UserDao.java:21) ~[classes/:na]
    	at com.example.house.apigateway.service.UserService.getUsername(UserService.java:14) ~[classes/:na]
    	at com.example.house.apigateway.controller.ApiUserController.getUsername(ApiUserController.java:26) ~[classes/:na]
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    	at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
    	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.zalando.logbook.servlet.LogbookFilter.doFilter(LogbookFilter.java:65) ~[logbook-servlet-2.0.0.jar:na]
    	at org.zalando.logbook.servlet.HttpFilter.doFilter(HttpFilter.java:31) ~[logbook-servlet-2.0.0.jar:na]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at java.base/java.lang.Thread.run(Thread.java:830) ~[na:na]
    
    2020-02-24 15:11:53.058 ERROR 8104 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: No instances available for user] with root cause
    
    java.lang.IllegalStateException: No instances available for user
    	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:119) ~[spring-cloud-netflix-ribbon-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.execute(RibbonLoadBalancerClient.java:99) ~[spring-cloud-netflix-ribbon-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor.intercept(LoadBalancerInterceptor.java:58) ~[spring-cloud-commons-2.2.1.RELEASE.jar:2.2.1.RELEASE]
    	at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:93) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:77) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:742) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:677) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:615) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at com.example.house.apigateway.config.GenericRest.get(GenericRest.java:38) ~[classes/:na]
    	at com.example.house.apigateway.dao.UserDao.getUserName(UserDao.java:21) ~[classes/:na]
    	at com.example.house.apigateway.service.UserService.getUsername(UserService.java:14) ~[classes/:na]
    	at com.example.house.apigateway.controller.ApiUserController.getUsername(ApiUserController.java:26) ~[classes/:na]
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    	at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
    	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:106) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:888) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.zalando.logbook.servlet.LogbookFilter.doFilter(LogbookFilter.java:65) ~[logbook-servlet-2.0.0.jar:na]
    	at org.zalando.logbook.servlet.HttpFilter.doFilter(HttpFilter.java:31) ~[logbook-servlet-2.0.0.jar:na]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.2.3.RELEASE.jar:5.2.3.RELEASE]
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1598) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
    	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.30.jar:9.0.30]
    	at java.base/java.lang.Thread.run(Thread.java:830) ~[na:na]
    
    2020-02-24 15:11:53.901  INFO 8104 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty  : Flipping property: user.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
    
    
    

    如下

    java.lang.IllegalStateException: No instances available for user
    

    这里的user是在eureka上注册的spring.application.name

    解决思路:

    在学习springcloud,学到ribbon时,遇到这个问题,原因是我用的
    springboot是2.2.4.RELEASE,springcloud版本Hoxton.SR1,
    而视频教程springboot版本是1.4.7,springcloud版本Camden.SR7,
    在写NewRuleConfig类时,里面有个方法如下:

    	/**
    	 * 每隔10秒执行一次ping命令,可以指定ping命令指向端点的path
    	 * @param config
    	 * @return
    	 */
    	@Bean
    	public IPing ribbonPing(IClientConfig config){
    		// PingUrl  是让我们指定一个url路径,每次执行健康检查的时候,就发送URL请求
    		return new PingUrl(false,"/health");
    	}
    

    改成下面这样,即增加一个/actuator,这是因为springboot2.x之后,健康检查路径都加了/actuator

    	/**
    	 * 每隔10秒执行一次ping命令,可以指定ping命令指向端点的path
    	 * @param config
    	 * @return
    	 */
    	@Bean
    	public IPing ribbonPing(IClientConfig config){
    		// PingUrl  是让我们指定一个url路径,每次执行健康检查的时候,就发送URL请求
    		return new PingUrl(false,"/actuator/health");
    	}
    
    展开全文
  • java.lang.IllegalStateException 错误解决过程 今天在搭建 spring boot 项目的过程中出现了以下的错误,也是花了好长时间才解决,今天我就来分享一下我解决报错的过程。 2021-01-18 19:59:28.637 ERROR 19504 --- ...

    java.lang.IllegalStateException 错误解决过程

    今天在搭建 spring boot 项目的过程中出现了以下的错误,也是花了好长时间才解决,今天我就来分享一下我解决报错的过程。

    2021-01-18 19:59:28.637 ERROR 19504 --- [           main] o.s.boot.SpringApplication               : Application run failed
    
    java.lang.IllegalStateException: Error processing condition on org.springframework.cloud.commons.httpclient.HttpClientConfiguration$ApacheHttpClientConfiguration.apacheHttpClientBuilder
    	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:184) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:144) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:236) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:280) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533) ~[spring-context-5.2.12.RELEASE.jar:5.2.12.RELEASE]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at com.liam.crowdfunding.user.CrowdfundingUserApplication.main(CrowdfundingUserApplication.java:17) [classes/:na]
    Caused by: java.lang.IllegalStateException: @ConditionalOnMissingBean did not specify a bean using type, name or annotation and the attempt to deduce the bean's type failed
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.validate(OnBeanCondition.java:487) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.<init>(OnBeanCondition.java:436) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:142) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	... 18 common frames omitted
    Caused by: org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException: Failed to deduce bean type for org.springframework.cloud.commons.httpclient.HttpClientConfiguration$ApacheHttpClientConfiguration.apacheHttpClientBuilder
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.deducedBeanTypeForBeanMethod(OnBeanCondition.java:517) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.deducedBeanType(OnBeanCondition.java:506) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.<init>(OnBeanCondition.java:429) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	... 20 common frames omitted
    Caused by: java.lang.ClassNotFoundException: org.apache.http.impl.client.HttpClientBuilder
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_131]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_131]
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) ~[na:1.8.0_131]
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_131]
    	at java.lang.Class.forName0(Native Method) ~[na:1.8.0_131]
    	at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_131]
    	at org.springframework.boot.autoconfigure.condition.FilteringSpringBootCondition.resolve(FilteringSpringBootCondition.java:108) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.getReturnType(OnBeanCondition.java:525) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	at org.springframework.boot.autoconfigure.condition.OnBeanCondition$Spec.deducedBeanTypeForBeanMethod(OnBeanCondition.java:513) ~[spring-boot-autoconfigure-2.3.8.RELEASE.jar:2.3.8.RELEASE]
    	... 22 common frames omitted
    
    1. 百度搜索

      遇到问题就问度娘,出现了不会的问题我就马上去百度了。但是,不幸的是,百度上没有查到这种问题的解决方案,只查到一些比较类似的问题,这就比较头疼了。

    2. 分析错误

      百度找不到和我错误一致的情况,只有类似 IllegalStateException 的错误,从百度的结果来看,大致可以看出这个错误和版本冲突有关,查看官网可以发现

      public class IllegalStateException extends RuntimeException
      /*
      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.
      */
      

      表示已在非法或不适当的时间调用了方法。换句话说,对于所请求的操作,Java 环境或 Java 应用程序没有处于适当的状态,由此可以判断我的错误也应该是版本冲突的原因,通过继续阅读下面的错误提示,发现 org.springframework.cloud.commons.httpclient.HttpClientConfiguration 则有可能是相应的 jar 包版本过低(httpclient)。

    3. 尝试

      通过不断尝试,最后发现 httpclient 使用的是4.2.6版本,与我的 spring boot 版本不匹配,尝试比较新的版本才得以解决。

    总结

    遇到错误不可盲目相信百度,每个人都有不同的错误,只有自己通过不断的尝试和解决,才能使自己得到提升。

    展开全文
  • nested exception is java.lang.IllegalStateException: Can’t configure antMatchers after anyRequest at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver....

    错误信息:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘springSecurityFilterChain’ defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method ‘springSecurityFilterChain’ threw exception; nested exception is java.lang.IllegalStateException: Can’t configure antMatchers after anyRequest
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean 0 ( A b s t r a c t B e a n F a c t o r y . j a v a : 323 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t S i n g l e t o n B e a n R e g i s t r y . g e t S i n g l e t o n ( D e f a u l t S i n g l e t o n B e a n R e g i s t r y . j a v a : 222 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 321 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 202 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . d o G e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 310 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . A b s t r a c t B e a n F a c t o r y . g e t B e a n ( A b s t r a c t B e a n F a c t o r y . j a v a : 202 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . D e f a u l t L i s t a b l e B e a n F a c t o r y . p r e I n s t a n t i a t e S i n g l e t o n s ( D e f a u l t L i s t a b l e B e a n F a c t o r y . j a v a : 879 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . f i n i s h B e a n F a c t o r y I n i t i a l i z a t i o n ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 878 )   [ s p r i n g − c o n t e x t − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . c o n t e x t . s u p p o r t . A b s t r a c t A p p l i c a t i o n C o n t e x t . r e f r e s h ( A b s t r a c t A p p l i c a t i o n C o n t e x t . j a v a : 550 )   [ s p r i n g − c o n t e x t − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . w e b . s e r v l e t . c o n t e x t . S e r v l e t W e b S e r v e r A p p l i c a t i o n C o n t e x t . r e f r e s h ( S e r v l e t W e b S e r v e r A p p l i c a t i o n C o n t e x t . j a v a : 141 )   [ s p r i n g − b o o t − 2.2.2. R E L E A S E . j a r : 2.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h ( S p r i n g A p p l i c a t i o n . j a v a : 747 ) [ s p r i n g − b o o t − 2.2.2. R E L E A S E . j a r : 2.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r e f r e s h C o n t e x t ( S p r i n g A p p l i c a t i o n . j a v a : 397 ) [ s p r i n g − b o o t − 2.2.2. R E L E A S E . j a r : 2.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 315 ) [ s p r i n g − b o o t − 2.2.2. R E L E A S E . j a r : 2.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1226 ) [ s p r i n g − b o o t − 2.2.2. R E L E A S E . j a r : 2.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b o o t . S p r i n g A p p l i c a t i o n . r u n ( S p r i n g A p p l i c a t i o n . j a v a : 1215 ) [ s p r i n g − b o o t − 2.2.2. R E L E A S E . j a r : 2.2.2. R E L E A S E ] a t c o m . S s o S e r v e r A p p l i c a t i o n . m a i n ( S s o S e r v e r A p p l i c a t i o n . j a v a : 18 ) [ c l a s s e s / : n a ] a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e 0 ( N a t i v e M e t h o d )   [ n a : 1.8. 0 1 61 ] a t s u n . r e f l e c t . N a t i v e M e t h o d A c c e s s o r I m p l . i n v o k e ( N a t i v e M e t h o d A c c e s s o r I m p l . j a v a : 62 )   [ n a : 1.8. 0 1 61 ] a t s u n . r e f l e c t . D e l e g a t i n g M e t h o d A c c e s s o r I m p l . i n v o k e ( D e l e g a t i n g M e t h o d A c c e s s o r I m p l . j a v a : 43 )   [ n a : 1.8. 0 1 61 ] a t j a v a . l a n g . r e f l e c t . M e t h o d . i n v o k e ( M e t h o d . j a v a : 498 )   [ n a : 1.8. 0 1 61 ] a t o r g . s p r i n g f r a m e w o r k . b o o t . d e v t o o l s . r e s t a r t . R e s t a r t L a u n c h e r . r u n ( R e s t a r t L a u n c h e r . j a v a : 49 ) [ s p r i n g − b o o t − d e v t o o l s − 2.2.2. R E L E A S E . j a r : 2.2.2. R E L E A S E ] C a u s e d b y : o r g . s p r i n g f r a m e w o r k . b e a n s . B e a n I n s t a n t i a t i o n E x c e p t i o n : F a i l e d t o i n s t a n t i a t e [ j a v a x . s e r v l e t . F i l t e r ] : F a c t o r y m e t h o d ′ s p r i n g S e c u r i t y F i l t e r C h a i n ′ t h r e w e x c e p t i o n ; n e s t e d e x c e p t i o n i s j a v a . l a n g . I l l e g a l S t a t e E x c e p t i o n : C a n ′ t c o n f i g u r e a n t M a t c h e r s a f t e r a n y R e q u e s t a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . S i m p l e I n s t a n t i a t i o n S t r a t e g y . i n s t a n t i a t e ( S i m p l e I n s t a n t i a t i o n S t r a t e g y . j a v a : 185 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . b e a n s . f a c t o r y . s u p p o r t . C o n s t r u c t o r R e s o l v e r . i n s t a n t i a t e ( C o n s t r u c t o r R e s o l v e r . j a v a : 651 )   [ s p r i n g − b e a n s − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] . . . 26 c o m m o n f r a m e s o m i t t e d C a u s e d b y : j a v a . l a n g . I l l e g a l S t a t e E x c e p t i o n : C a n ′ t c o n f i g u r e a n t M a t c h e r s a f t e r a n y R e q u e s t a t o r g . s p r i n g f r a m e w o r k . u t i l . A s s e r t . s t a t e ( A s s e r t . j a v a : 73 )   [ s p r i n g − c o r e − 5.2.2. R E L E A S E . j a r : 5.2.2. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . s e c u r i t y . c o n f i g . a n n o t a t i o n . w e b . A b s t r a c t R e q u e s t M a t c h e r R e g i s t r y . a n t M a t c h e r s ( A b s t r a c t R e q u e s t M a t c h e r R e g i s t r y . j a v a : 122 )   [ s p r i n g − s e c u r i t y − c o n f i g − 5.2.1. R E L E A S E . j a r : 5.2.1. R E L E A S E ] a t c o m . y g e r . s e c u r i t y . c o r e . a u t h o r i z e . Y g e r A u t h o r i z e C o n f i g P r o v i d e r . c o n f i g ( Y g e r A u t h o r i z e C o n f i g P r o v i d e r . j a v a : 31 )   [ c l a s s e s / : n a ] a t c o m . y g e r . s e c u r i t y . c o r e . a u t h o r i z e . Y g e r A u t h o r i z e C o n f i g M a n a g e r . c o n f i g ( Y g e r A u t h o r i z e C o n f i g M a n a g e r . j a v a : 33 )   [ c l a s s e s / : n a ] a t c o m . y g e r . s e c u r i t y . s e r v e r . Y g e r R e s o u r c e S e r v e r C o n f i g . c o n f i g u r e ( Y g e r R e s o u r c e S e r v e r C o n f i g . j a v a : 78 )   [ c l a s s e s / : n a ] a t o r g . s p r i n g f r a m e w o r k . s e c u r i t y . o a u t h 2. c o n f i g . a n n o t a t i o n . w e b . c o n f i g u r a t i o n . R e s o u r c e S e r v e r C o n f i g u r a t i o n . c o n f i g u r e ( R e s o u r c e S e r v e r C o n f i g u r a t i o n . j a v a : 154 )   [ s p r i n g − s e c u r i t y − o a u t h 2 − 2.2.3. R E L E A S E . j a r : n a ] a t o r g . s p r i n g f r a m e w o r k . s e c u r i t y . c o n f i g . a n n o t a t i o n . w e b . c o n f i g u r a t i o n . W e b S e c u r i t y C o n f i g u r e r A d a p t e r . g e t H t t p ( W e b S e c u r i t y C o n f i g u r e r A d a p t e r . j a v a : 231 )   [ s p r i n g − s e c u r i t y − c o n f i g − 5.2.1. R E L E A S E . j a r : 5.2.1. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . s e c u r i t y . c o n f i g . a n n o t a t i o n . w e b . c o n f i g u r a t i o n . W e b S e c u r i t y C o n f i g u r e r A d a p t e r . i n i t ( W e b S e c u r i t y C o n f i g u r e r A d a p t e r . j a v a : 322 )   [ s p r i n g − s e c u r i t y − c o n f i g − 5.2.1. R E L E A S E . j a r : 5.2.1. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . s e c u r i t y . c o n f i g . a n n o t a t i o n . w e b . c o n f i g u r a t i o n . W e b S e c u r i t y C o n f i g u r e r A d a p t e r . i n i t ( W e b S e c u r i t y C o n f i g u r e r A d a p t e r . j a v a : 92 )   [ s p r i n g − s e c u r i t y − c o n f i g − 5.2.1. R E L E A S E . j a r : 5.2.1. R E L E A S E ] a t o r g . s p r i n g f r a m e w o r k . s e c u r i t y . o a u t h 2. c o n f i g . a n n o t a t i o n . w e b . c o n f i g u r a t i o n . R e s o u r c e S e r v e r C o n f i g u r a t i o n 0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at com.SsoServerApplication.main(SsoServerApplication.java:18) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.2.2.RELEASE.jar:2.2.2.RELEASE] Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalStateException: Can't configure antMatchers after anyRequest at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] ... 26 common frames omitted Caused by: java.lang.IllegalStateException: Can't configure antMatchers after anyRequest at org.springframework.util.Assert.state(Assert.java:73) ~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.security.config.annotation.web.AbstractRequestMatcherRegistry.antMatchers(AbstractRequestMatcherRegistry.java:122) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE] at com.yger.security.core.authorize.YgerAuthorizeConfigProvider.config(YgerAuthorizeConfigProvider.java:31) ~[classes/:na] at com.yger.security.core.authorize.YgerAuthorizeConfigManager.config(YgerAuthorizeConfigManager.java:33) ~[classes/:na] at com.yger.security.server.YgerResourceServerConfig.configure(YgerResourceServerConfig.java:78) ~[classes/:na] at org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration.configure(ResourceServerConfiguration.java:154) ~[spring-security-oauth2-2.2.3.RELEASE.jar:na] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.getHttp(WebSecurityConfigurerAdapter.java:231) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:322) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:92) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE] at org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration 0(AbstractBeanFactory.java:323) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) [springcontext5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) [springcontext5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [springboot2.2.2.RELEASE.jar:2.2.2.RELEASE]atorg.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)[springboot2.2.2.RELEASE.jar:2.2.2.RELEASE]atorg.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)[springboot2.2.2.RELEASE.jar:2.2.2.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:315)[springboot2.2.2.RELEASE.jar:2.2.2.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1226)[springboot2.2.2.RELEASE.jar:2.2.2.RELEASE]atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1215)[springboot2.2.2.RELEASE.jar:2.2.2.RELEASE]atcom.SsoServerApplication.main(SsoServerApplication.java:18)[classes/:na]atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod) [na:1.8.0161]atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [na:1.8.0161]atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [na:1.8.0161]atjava.lang.reflect.Method.invoke(Method.java:498) [na:1.8.0161]atorg.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)[springbootdevtools2.2.2.RELEASE.jar:2.2.2.RELEASE]Causedby:org.springframework.beans.BeanInstantiationException:Failedtoinstantiate[javax.servlet.Filter]:FactorymethodspringSecurityFilterChainthrewexception;nestedexceptionisjava.lang.IllegalStateException:CantconfigureantMatchersafteranyRequestatorg.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) [springbeans5.2.2.RELEASE.jar:5.2.2.RELEASE]...26commonframesomittedCausedby:java.lang.IllegalStateException:CantconfigureantMatchersafteranyRequestatorg.springframework.util.Assert.state(Assert.java:73) [springcore5.2.2.RELEASE.jar:5.2.2.RELEASE]atorg.springframework.security.config.annotation.web.AbstractRequestMatcherRegistry.antMatchers(AbstractRequestMatcherRegistry.java:122) [springsecurityconfig5.2.1.RELEASE.jar:5.2.1.RELEASE]atcom.yger.security.core.authorize.YgerAuthorizeConfigProvider.config(YgerAuthorizeConfigProvider.java:31) [classes/:na]atcom.yger.security.core.authorize.YgerAuthorizeConfigManager.config(YgerAuthorizeConfigManager.java:33) [classes/:na]atcom.yger.security.server.YgerResourceServerConfig.configure(YgerResourceServerConfig.java:78) [classes/:na]atorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration.configure(ResourceServerConfiguration.java:154) [springsecurityoauth22.2.3.RELEASE.jar:na]atorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.getHttp(WebSecurityConfigurerAdapter.java:231) [springsecurityconfig5.2.1.RELEASE.jar:5.2.1.RELEASE]atorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:322) [springsecurityconfig5.2.1.RELEASE.jar:5.2.1.RELEASE]atorg.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter.init(WebSecurityConfigurerAdapter.java:92) [springsecurityconfig5.2.1.RELEASE.jar:5.2.1.RELEASE]atorg.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration E n h a n c e r B y S p r i n g C G L I B EnhancerBySpringCGLIB EnhancerBySpringCGLIB$ecf5d2b1.init() ~[spring-security-oauth2-2.2.3.RELEASE.jar:na]
    at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.init(AbstractConfiguredSecurityBuilder.java:370) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder.doBuild(AbstractConfiguredSecurityBuilder.java:324) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.security.config.annotation.AbstractSecurityBuilder.build(AbstractSecurityBuilder.java:41) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.springSecurityFilterChain(WebSecurityConfiguration.java:104) ~[spring-security-config-5.2.1.RELEASE.jar:5.2.1.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE]
    … 27 common frames omitted

    问题原因:
    使用SpringSecurity配置http顺序错误,不能在anyRequest()之后再配置permitAll(),
    anyRequest()必须是最后一个

    展开全文
  • Artifact servlet-01:war exploded: Artifact is being deployed, please wait… 严重 [RMI TCP Connection(3)-127.0.0.1] org....java.lang.IllegalStateException: 启动子级时出错 at org.apache.catalina.core.C
  • nested exception is java.lang.IllegalStateException: refreshAfterWrite requires a LoadingCache异常解决 问题描述: SpringBoot项目使用Caffeine缓存,出现如下异常信息: Caused by: org.springframework....
  • java.lang.IllegalStateException: instance must be started before calling this method 2020/6/15 下午11:49:12at org.apache.dubbo.remoting.zookeeper.curator.CuratorZookeeperClient.createPersistent...
  • SpringBoot集成MyBatis-Plus 实现HTPP POST提交实体...java.lang.IllegalStateException: No primary or default constructor found for interface * * * * at org.springframework.web.method.annotation.ModelAttribu
  • 问题 升级了一下Compose版本(1.0.0-... java.lang.IllegalStateException: ViewTreeLifecycleOwner not found from DecorView@58d6ed7[MainActivity] at androidx.compose.ui.platform.WindowRecomposer_androidKt.c
  • Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [mapper/]. The following stack trace is thrown for debugging purposes...
  • java.lang.IllegalStateException: 启动子级时出错 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:757) at java.base/java.security.AccessController.doPrivileged(Native ...
  • 解决IntelliJ IDEA报错:调用方法[manageApp]时发生异常java.lang.IllegalStateException: 启动子级时出错 问题复现:   笔者将一个在Tomcat安装目录下的文件夹webapps部署成功且运行正常的Web应用,改成使用...
  • illegalstateexception
  • IllegalStateException:Already connect 解决方式 将RequestProperties相关的方法放在其它代码前 下图为修改后的代码,主要修改就是A和B的先后位置 原因 看了几个RequestProperties相关的方法...
  • public class GlobalExecutor implements AsyncConfigurer
  • 二、报错信息 报错信息: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 147,116
精华内容 58,846
关键字:

illegalstateexception