首页 / JAVA / org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String 异常处理
org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String 异常处理
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String 异常处理,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4502字,纯文字阅读大概需要7分钟。
内容图文
![org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String 异常处理](/upload/InfoBanner/zyjiaocheng/689/f1191582ec724cb79e7f31e79f280a5a.jpg)
用了spring-boot-starter-actuator
之后出现异常: java.lang.ClassCastException: org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String
.
详细的异常如下:
1234567891011121314151617181920212223 | Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is java.lang.ClassCastException: org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:622) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] ... 55 common frames omittedCaused by: java.lang.ClassCastException: org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String at org.springframework.boot.MvcEndpointUtil.filterCanonicalEndpoints(MvcEndpointUtil.java:102) ~[MvcEndpointUtil.class:2.1.1.RELEASE] at org.springframework.boot.MvcEndpointUtil.filterEndpoints(MvcEndpointUtil.java:73) ~[MvcEndpointUtil.class:2.1.1.RELEASE] at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.discoverEndpoints(EndpointDiscoverer.java:125) ~[spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.actuate.endpoint.annotation.EndpointDiscoverer.getEndpoints(EndpointDiscoverer.java:119) ~[spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.servletEndpointRegistrar(ServletEndpointManagementContextConfiguration.java:76) ~[spring-boot-actuator-autoconfigure-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration$$EnhancerBySpringCGLIB$$1005825f.CGLIB$servletEndpointRegistrar$0(<generated> 大专栏 org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String 异常处理) ~[spring-boot-actuator-autoconfigure-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration$$EnhancerBySpringCGLIB$$1005825f$$FastClassBySpringCGLIB$$1c44d4f2.invoke(<generated>) ~[spring-boot-actuator-autoconfigure-2.1.1.RELEASE.jar:2.1.1.RELEASE] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.1.3.RELEASE.jar:5.1.3.RELEASE] at org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration$$EnhancerBySpringCGLIB$$1005825f.servletEndpointRegistrar(<generated>) ~[spring-boot-actuator-autoconfigure-2.1.1.RELEASE.jar:2.1.1.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.__invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:45009) ~[na:1.8.0_111] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:45012) ~[na:1.8.0_111] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_111] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE] ... 56 common frames omitted |
很奇怪的异常,看EndpointId的代码也重写了toString()
方法,更奇怪的是找不到MvcEndpointUtil
的代码出处。困扰了好几天,关键是百度了好久也没到有用的信息,也在群里问了一下,没有人回复。今天用google搜了一下,本来也不太抱希望。最后无意中发现了一篇文章(异常处理)[http://www.codeleading.com/article/8276162799/], 发现跟我碰到同一个问题,最后解决方法不显眼,但还是被我发现了。
更新 IDEA Jreble 插件
果断试了一下不用jrebel来启动,果然可以了。不晓得jrebel在这个过程中做了什么操作。
内容总结
以上是互联网集市为您收集整理的org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String 异常处理全部内容,希望文章能够帮你解决org.springframework.boot.actuate.endpoint.EndpointId cannot be cast to java.lang.String 异常处理所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。