1.:配置完成,启动一次直接调度失败, 报错 No classes defined at reference ‘62’
触发调度<<<<<<<<<<<
触发调度:
address:http://10.24.24.12:9395
code:500
msg:xxl-rpc remoting (url=http://10.24.24.12:9395/run) response content invalid(C0.com.xxl.rpc.remoting.net.params.XxlRpcResponse� requestId�errorMsg�result`NS��com.xxl.rpc.util.XxlRpcException: com.caucho.hessian.io.HessianProtocolException: No classes defined at reference '62' at com.xxl.rpc.serialize.impl.HessianSerializer.deserialize(HessianSerializer.java:52) at com.xxl.rpc.remoting.net.impl.netty_http.server.NettyHttpServerHandler.process(NettyHttpServerHandler.java:81) at com.xxl.rpc.remoting.net.impl.netty_http.server.NettyHttpServerHandler.access$000(NettyHttpServerHandler.java:26) at com.xxl.rpc.remoting.net.impl.netty_http.server.NettyHttpServerHandler$1.run(NettyHttpServerHandler.java:50) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)Caused by: com.caucho.hessian.io.HessianProtocolException: No classes defined at reference '62' at com.caucho.hessian.io.Hessian2Input.error(Hessian2Input.java:2926) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2118) at com.caucho.hessian.io.CollectionDeserializer.readLengthList(CollectionDeserializer.java:93) at com.caucho.hessian.io.Hessian2Input.readObject(Hessian2Input.java:2088) at com.xxl.rpc.serialize.impl.HessianSerializer.deserialize(HessianSerializer.java:49) ... 6 moreN).
原因:版本号不一致。。。
解决:请换个版本
2.登录调度中心报错,某些功能变得无法使用
原因:版本号不一致导致的js之类的前端缓存未清理
解决:换个浏览器或者Ctrl+F5强制刷新
其他问题一般只要对照这三个步骤即可判断:
创建执行器项目
在源码中,作者提供了各个版本的 执行器项目,此处以xxl-job-executor-sample-springboot项目为例。也可以自己创建项目,然后按照demo或文档进行改造。
1 maven依赖
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
2配置文件
#日志文件
# log config
logging.config=classpath:logback.xml
#调度中心部署跟地址:如调度中心集群部署存在多个地址则用逗号分隔。
#执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调"。
### xxl-job admin address list, such as "http://address" or "http://address01,http://address02"
xxl.job.admin.addresses=http://127.0.0.1:8080/xxl-job-admin
#执行器的名称、ip地址、端口号
### xxl-job executor address
xxl.job.executor.appname=xxl-job-executor-sample
xxl.job.executor.ip=
xxl.job.executor.port=9999
#执行器通讯TOKEN:非空时启用
### xxl-job, access token
xxl.job.accessToken=
#执行器运行日志文件存储的磁盘位置,需要对该路径拥有读写权限
### xxl-job log path
xxl.job.executor.logpath=/data/applogs/xxl-job/jobhandler
#执行器Log文件定期清理功能,指定日志保存天数,日志文件过期自动删除。限制至少保持3天,否则功能不生效
#-1表示永不删除
### xxl-job log retention days
xxl.job.executor.logretentiondays=-1
##yml格式 有说不能用域名或127.0.0.1的,但我没测出来为什么不能用
xxl:
job:
enabled: true
accessToken:
admin:
addresses: http://127.0.0.1:9102/xxl-job-admin
executor:
appname: hospital-ninth-xxljob
ip: 127.0.0.1
logpath: /opt/project/xxl-job/log
logretentiondays: 30
port: 9999
注意:配置执行器的名称、IP地址、端口号,后面如果配置多个执行器时,要防止端口冲突
3.
package com.xxl.job.executor.core.config;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* xxl-job config
*
* @author xuxueli 2017-04-28
*/
@Configuration
public class XxlJobConfig {
private Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${xxl.job.admin.addresses}")
private String adminAddresses;
@Value("${xxl.job.executor.appname}")
private String appName;
@Value("${xxl.job.executor.ip}")
private String ip;
@Value("${xxl.job.executor.port}")
private int port;
@Value("${xxl.job.accessToken}")
private String accessToken;
@Value("${xxl.job.executor.logpath}")
private String logPath;
@Value("${xxl.job.executor.logretentiondays}")
private int logRetentionDays;
@Bean(initMethod = "start", destroyMethod = "destroy")
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName);
xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
return xxlJobSpringExecutor;
}
/**
* 针对多网卡、容器内部署等情况,可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP;
*
* 1、引入依赖:
* <dependency>
* <groupId>org.springframework.cloud</groupId>
* <artifactId>spring-cloud-commons</artifactId>
* <version>${version}</version>
* </dependency>
*
* 2、配置文件,或者容器启动变量
* spring.cloud.inetutils.preferred-networks: 'xxx.xxx.xxx.'
*
* 3、获取IP
* String ip_ = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
*/
}
参考:https://www.cnblogs.com/lwcode6/p/11340296.html