设为首页 加入收藏

TOP

深入Spring Boot: 怎样排查 java.lang.ArrayStoreException(一)
2018-03-11 09:11:29 】 浏览:376
Tags:深入 Spring Boot: 怎样 排查 java.lang.ArrayStoreException

java.lang.ArrayStoreException 分析

这个demo来说明怎样排查一个spring boot 1应用升级到spring boot 2时可能出现的java.lang.ArrayStoreException

demo地址:https://github.com/hengyunabc/spring-boot-inside/tree/master/demo-ArrayStoreException

demo里有两个模块,springboot1-starterspringboot2-demo

springboot1-starter模块里,是一个简单的HealthIndicator实现

public class MyHealthIndicator extends AbstractHealthIndicator {
    @Override
    protected void doHealthCheck(Builder builder) throws Exception {
        builder.status(Status.UP);
        builder.withDetail("hello", "world");
    }
}
@Configuration
@AutoConfigureBefore(EndpointAutoConfiguration.class)
@AutoConfigureAfter(HealthIndicatorAutoConfiguration.class)
@ConditionalOnClass(value = { HealthIndicator.class })
public class MyHealthIndicatorAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean(MyHealthIndicator.class)
    @ConditionalOnEnabledHealthIndicator("my")
    public MyHealthIndicator myHealthIndicator() {
        return new MyHealthIndicator();
    }
}

springboot2-demo则是一个简单的spring boot2应用,引用了springboot1-starter模块。

把工程导入IDE,执行springboot2-demo里的ArrayStoreExceptionDemoApplication,抛出的异常是

Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_112]
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_112]
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_112]
    at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_112]
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_112]
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_112]
    at java.lang.Class.createAnnotationData(Class.java:3521) ~[na:1.8.0_112]
    at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_112]
    at java.lang.Class.createAnnotationData(Class.java:3526) ~[na:1.8.0_112]
    at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_112]
    at java.lang.Class.getAnnotation(Class.java:3415) ~[na:1.8.0_112]
    at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258) ~[na:1.8.0_112]
    at java.lang.Class.isAnnotationPresent(Class.java:3425) ~[na:1.8.0_112]
    at org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:575) ~[spring-core-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:177) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:217) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:188) ~[spring-webmvc-5.0.4.RELEASE.jar:5.0.4.RELEA
编程开发网
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇MySQL 系统变量配置基础 下一篇使用Java函数接口及lambda表达式..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

最新文章

热门文章

C 语言

C++基础

windows编程基础

linux编程基础

C/C++面试题目