最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Spring Boot2深入分析解決java.lang.ArrayStoreException異常

 更新時間:2021年12月24日 15:44:40   作者:誰將新樽辭舊月,今月曾經(jīng)照古人  
這篇文章介紹了Spring Boot2深入分析解決java.lang.ArrayStoreException異常的方法,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

將某個項目從Spring Boot1升級Spring Boot2之后出現(xiàn)如下報錯,查了很多不同的解決方法都沒有解決:

Spring boot2項目啟動時遇到了異常:

java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy

Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724) ~[na:1.8.0_65]
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531) ~[na:1.8.0_65]
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355) ~[na:1.8.0_65]
    at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286) ~[na:1.8.0_65]
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120) ~[na:1.8.0_65]
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72) ~[na:1.8.0_65]
    at java.lang.Class.createAnnotationData(Class.java:3521) ~[na:1.8.0_65]
    at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_65]
    at java.lang.Class.createAnnotationData(Class.java:3526) ~[na:1.8.0_65]
    at java.lang.Class.annotationData(Class.java:3510) ~[na:1.8.0_65]
    at java.lang.Class.getAnnotation(Class.java:3415) ~[na:1.8.0_65]
    at java.lang.reflect.AnnotatedElement.isAnnotationPresent(AnnotatedElement.java:258) ~[na:1.8.0_65]
    at java.lang.Class.isAnnotationPresent(Class.java:3425) ~[na:1.8.0_65]
    at org.springframework.core.annotation.AnnotatedElementUtils.hasAnnotation(AnnotatedElementUtils.java:570) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.isHandler(RequestMappingHandlerMapping.java:177) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:218) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:189) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:136) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1695) ~[spring-beans-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    ... 16 common frames omitted

經(jīng)過簡單排查后,懷疑是因為jar版本沖突引起的異常,使用異常斷點:

然后在

應(yīng)該是從class org.activiti.spring.boot.SecurityAutoConfiguration出錯,然后報錯java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy

嘗試復(fù)現(xiàn)異常:

SecurityAutoConfiguration securityAutoConfiguration=new SecurityAutoConfiguration();

正常

SecurityAutoConfiguration.class.getDeclaredAnnotation(Aspect.class);

異常復(fù)現(xiàn)。

然后找到TypeNotPresentExceptionProxy類,使用Ctrl+N/Ctrl+N+N

然后在構(gòu)造方法中打斷點,發(fā)現(xiàn):

發(fā)現(xiàn)是cause:DefaultAuthenticationEventPublisher找不到引發(fā)的報錯。

實際報錯是ClassNotFound。

仔細看下代碼,可以發(fā)現(xiàn)AnnotationParser.parseClassValue把異常包裝成為Object。

private static Object parseClassValue(ByteBuffer buf,
                                          ConstantPool constPool,
                                          Class<?> container) {
        int classIndex = buf.getShort() & 0xFFFF;
        try {
            try {
                String sig = constPool.getUTF8At(classIndex);
                return parseSig(sig, container);
            } catch (IllegalArgumentException ex) {
                // support obsolete early jsr175 format class files
                return constPool.getClassAt(classIndex);
            }
        } catch (NoClassDefFoundError e) {
            return new TypeNotPresentExceptionProxy("[unknown]", e);
        }
        catch (TypeNotPresentException e) {
            return new TypeNotPresentExceptionProxy(e.typeName(), e.getCause());
        }
    }

然后在sun.reflect.annotation.AnnotationParser.parseClassArray(int, ByteBuffer, ConstantPool, Class<?>)里嘗試直接設(shè)置到數(shù)組里。

而這里數(shù)組越界了,ArrayStoreException只有越界的Object的類型信息,也就是上面的。

解決:

  • 1:將springboot2.0降級為原來的1.X版本
  • 2:在springboot啟動類上添加
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
  • 3:修改源碼的集成問題,重新編譯

總結(jié):

具體問題還要具體分析,不同的代碼引發(fā)該問題的原因也不相同。

我的問題是:

springboot2.0不能與activiti6.0.0直接集成使用,因為activiti6.0.0出來的時候springboot2.0還沒有出來,activiti6.0.0 支持springboot1.2.6以上,2.0.0以下的版本。

這里實際報錯是ClassNotFound。

到此這篇關(guān)于Spring Boot2深入分析解決java.lang.ArrayStoreException異常的文章就介紹到這了。希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • SpringBoot獲取Request請求的三種方式小結(jié)

    SpringBoot獲取Request請求的三種方式小結(jié)

    本文介紹了SpringBoot中獲取Request對象的三種方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-12-12
  • SpringBoot?+?MyBatis-Plus構(gòu)建樹形結(jié)構(gòu)的幾種方式

    SpringBoot?+?MyBatis-Plus構(gòu)建樹形結(jié)構(gòu)的幾種方式

    在實際開發(fā)中,很多數(shù)據(jù)都是樹形結(jié)構(gòu),本文主要介紹了SpringBoot?+?MyBatis-Plus構(gòu)建樹形結(jié)構(gòu)的幾種方式,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-08-08
  • @Transactional和@DS怎樣在事務(wù)中切換數(shù)據(jù)源

    @Transactional和@DS怎樣在事務(wù)中切換數(shù)據(jù)源

    這篇文章主要介紹了@Transactional和@DS怎樣在事務(wù)中切換數(shù)據(jù)源問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2023-07-07
  • Java連接Oracle數(shù)據(jù)庫并查詢

    Java連接Oracle數(shù)據(jù)庫并查詢

    這篇文章主要介紹了Java連接Oracle數(shù)據(jù)庫并查詢的相關(guān)資料,需要的朋友可以參考下
    2017-04-04
  • SpringBoot?2.7.18?集成?Mybatis?Plus?+?Druid的實例詳解

    SpringBoot?2.7.18?集成?Mybatis?Plus?+?Druid的實例詳解

    Mybatis和MybatisPlus都是流行的持久層框架,MybatisPlus在Mybatis基礎(chǔ)上增加了更多便捷的功能,如自動CRUD、分頁插件等,文章還提到了Entity、Mapper、Service、Controller等組件的基本使用方法,為開發(fā)者提供了一套完整的集成方案
    2024-10-10
  • 快速學(xué)習(xí)JavaWeb中監(jiān)聽器(Listener)的使用方法

    快速學(xué)習(xí)JavaWeb中監(jiān)聽器(Listener)的使用方法

    這篇文章主要幫助大家快速學(xué)習(xí)JavaWeb中監(jiān)聽器(Listener)的使用方法,感興趣的小伙伴們可以參考一下
    2016-09-09
  • 教你如何用Java根據(jù)日期生成流水號

    教你如何用Java根據(jù)日期生成流水號

    這篇文章主要介紹了教你如何用Java根據(jù)日期生成流水號,文中有非常詳細的代碼示例,對正在學(xué)習(xí)java的小伙伴們有很好的幫助,需要的朋友可以參考下
    2021-04-04
  • Java實現(xiàn)跳躍表(skiplist)的簡單實例

    Java實現(xiàn)跳躍表(skiplist)的簡單實例

    這篇文章主要介紹了Java編程中跳躍表的概念和實現(xiàn)原理,并簡要敘述了它的結(jié)構(gòu),具有一定參考價值,需要的朋友可以了解下。
    2017-09-09
  • java常用工具類 Random隨機數(shù)、MD5加密工具類

    java常用工具類 Random隨機數(shù)、MD5加密工具類

    這篇文章主要為大家詳細介紹了Java常用工具類,Random隨機數(shù)工具類、MD5加密工具類,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-05-05
  • Java模糊查詢方法詳解

    Java模糊查詢方法詳解

    這篇文章主要為大家詳細介紹了Java模糊查詢方法的實現(xiàn),實例教你如何用Java做模糊查詢結(jié)果,感興趣的小伙伴們可以參考一下
    2016-04-04

最新評論

漳州市| 喀什市| 凤山市| 金乡县| 格尔木市| 赞皇县| 富阳市| 金溪县| 清镇市| 班戈县| 平乐县| 平阴县| 海兴县| 江孜县| 黄龙县| 乐陵市| 肥乡县| 呈贡县| 华安县| 潞城市| 潼关县| 黎川县| 隆昌县| 浙江省| 汉源县| 大兴区| 大方县| 鱼台县| 于田县| 金门县| 梓潼县| 黄陵县| 玉龙| 确山县| 邛崃市| 大化| 五大连池市| 临安市| 中方县| 沂南县| 荣成市|