Springboot Redisson Xxljob(Druid MySQL MybatisPlus) 对接使用

前情提要

  • 根据xxl-job提供的springboot的基本对接代码,Github:spingboot对接代码地址
  • 根据业务需求,框架中需要接入druid/mysql/redis/redisson等组件和框架
  • 在springboot+xxljob对接druid+mysql+mybatis-plus的测试中,启动正常
  • 在springboot+xxljob+druid+mysql+mybatis-plus对接redis+redisson的测试中,出现异常,启动失败
  • 以下进行错误排查(redis+redisson集成代码这块并无异常,去除xxljob后可正常使用)。目前考虑兼容性问题,组件版本?依赖冲突?

一、版本内容如下

  1. xxl-job-core-2.0.2
  2. springboot-2.6.1
  3. spring-boot-starter-data-redis-2.6.1
  4. redisson-spring-boot-starter-3.16.7
  5. druid-spring-boot-starter-1.2.8
  6. mybatis-plus-boot-starter-3.5.1
  7. mysql-connector-java-8.0.26
  8. tomcat-jdbc-8.5.23

二、配置启动

发现底层netty版本均为4.1.70.Final,但存在冲突,具体原因不明确

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00000001143564d4, pid=21642, tid=0x0000000000000e03
#
# JRE version: Java(TM) SE Runtime Environment (8.0_181-b13) (build 1.8.0_181-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.181-b13 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libnetty_resolver_dns_native_macos_x86_648047274197466035758.dylib+0x64d4]  netty_jni_util_JNI_OnUnload+0x84
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/chenzy/files/gitFile/xxl-job/hs_err_pid21642.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

三、解决方式

定位是netty可能存在的冲突问题(主要是redisson底层的netty与xxljob使用的netty通信存在冲突)

  • 在xxl-job中提出netty依赖(xxl-job添加了netty-all的依赖,实际上并没有用到全部)
 <!-- xxl-job-core -->
        <dependency>
            <groupId>com.xuxueli</groupId>
            <artifactId>xxl-job-core</artifactId>
            <version>${xxljob.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
  • 启动后,针对NoClassFound的依赖,进行补充
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-codec-http</artifactId>
            <version>4.1.70.Final</version>
        </dependency>
  • 再次启动,相关依赖无缺失,能够正常调度任务、传递参数、调用组件

附录

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

c_zyer

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值