• xxljob运行idea可以,生产环境不行


    xxl-job运行

    idea本地测试可以
    生产环境不行
    一直报类找不到

    java.lang.NoClassDefFoundError: groovy/lang/GroovyClassLoader
    	at com.xxl.job.core.glue.GlueFactory.<init>(GlueFactory.java:36)
    	at com.xxl.job.core.glue.GlueFactory.<clinit>(GlueFactory.java:20)
    	at com.xxl.job.core.executor.impl.XxlJobSpringExecutor.afterSingletonsInstantiated(XxlJobSpringExecutor.java:41)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:972)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414)
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
    	at com.jdl.omega.job.OmegaJobApplication.main(OmegaJobApplication.java:19)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:497)
    	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    	at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
    	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
    Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyClassLoader
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	... 21 common frames omitted
    

    根本原因

    java.lang.NoClassDefFoundError: groovy/lang/GroovyClassLoader
    因为xxl-job本地测试运行要依赖服务端xxl-job-admin,这个需要下xxl-job的源码,而且源码里面是SNAPSHOT版本,里面的maven也写的是这个2.3.1-SNAPSHOT

    但是客户端引入maven依赖的时候,要写xxl-job-core的坐标
    正确写法

    <!-- xxl-job-core -->
            <dependency>
                <groupId>com.xuxueli</groupId>
                <artifactId>xxl-job-core</artifactId>
                <version>2.3.1</version>
            </dependency>
    

    错误写法

    <!-- xxl-job-core -->
            <dependency>
                <groupId>com.xuxueli</groupId>
                <artifactId>xxl-job-core</artifactId>
                <version>2.3.1-SNAPSHOT</version>
            </dependency>
    

    可见客户端里面写version字段一定要注意对应,不能写上SNAPSHOT

  • 相关阅读:
    第三周星期三
    第三周星期二
    导入oc动态库(framework)到C++项目中混编出现的问题
    webrtc项目编译报错(image not found)
    OpenGL-综合案例:旋转的大小球
    使用OpenGL来画个甜甜圈
    OpenGL-深度测试和颜色混合
    OpenGL 绘制正方形的基本步骤
    数据结构与算法-基础
    关于iOS离屏渲染的深入研究
  • 原文地址:https://www.cnblogs.com/PythonOrg/p/16108402.html
Copyright © 2020-2023  润新知