今天遇到了alibaba.fastjson2导致的程序直接挂到的问题:A fatal error has been detected by the Java Runtime Environment:

先说错误:

Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@26ebc1f0]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f4c2a73f9f5, pid=2375325, tid=0x00007f4bb4eef700
#
# JRE version: OpenJDK Runtime Environment (8.0_312-b07) (build 1.8.0_312-b07)
# Java VM: OpenJDK 64-Bit Server VM (25.312-b07 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# J 10149 C1 com.alibaba.fastjson2.util.JDKUtils.getCharArray(Ljava/lang/String;)[C (33 bytes) @ 0x00007f4c2a73f9f5 [0x00007f4c2a73f960+0x95]
#
# Core dump written. Default location: /root/core or core.2375325
#
# An error report file with more information is saved as:
# /root/hs_err_pid2375325.log
Compiled method (c1) 65629336 10149   !   3       com.alibaba.fastjson2.util.JDKUtils::getCharArray (33 bytes)
 total in heap  [0x00007f4c2a73f7d0,0x00007f4c2a73ff88] = 1976
 relocation     [0x00007f4c2a73f8f8,0x00007f4c2a73f958] = 96
 main code      [0x00007f4c2a73f960,0x00007f4c2a73fd80] = 1056
 stub code      [0x00007f4c2a73fd80,0x00007f4c2a73fe28] = 168
 oops           [0x00007f4c2a73fe28,0x00007f4c2a73fe30] = 8
 metadata       [0x00007f4c2a73fe30,0x00007f4c2a73fe40] = 16
 scopes data    [0x00007f4c2a73fe40,0x00007f4c2a73fec0] = 128
 scopes pcs     [0x00007f4c2a73fec0,0x00007f4c2a73ff50] = 144
 dependencies   [0x00007f4c2a73ff50,0x00007f4c2a73ff58] = 8
 handler table  [0x00007f4c2a73ff58,0x00007f4c2a73ff70] = 24
 nul chk table  [0x00007f4c2a73ff70,0x00007f4c2a73ff88] = 24
#
# If you would like to submit a bug report, please visit:
#   https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%208&component=java-1.8.0-openjdk
#

原因是在使用:

com.alibaba.fastjson2.JSON.parseArray(sysOrg.getParentJson(),Integer.class);

 sysOrg的parentJson为null。导致了这个错误。

我特意试了一下原来的版本:

com.alibaba.fastjson.JSON

如果值为null的时候,会返回null。而不会导致整个程序挂掉。

所以在使用新版本的东西的时候一定要好好测一测。虽然问题在我自己,但是版本间的差异还是要注意啊。

我用的版本:

        <dependency>
            <groupId>com.alibaba.fastjson2</groupId>
            <artifactId>fastjson2</artifactId>
            <version>2.0.1</version>
        </dependency>

后续版本没有测试,是否解决了这个问题。

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值