Quartz:ERROR threw an unhandled Exception
详细的错误信息如下:
-- ::13.366 [DefaultQuartzScheduler_Worker-] ERROR org.quartz.core.JobRunShell: - Job group1.job1 threw an unhandled Exception:
java.lang.NullPointerException
at com.starunion.java.service.timer.JobEndConference.execute(JobEndConference.java:) ~[bin/:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:) [quartz-2.2..jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:) [quartz-2.2..jar:?]
-- ::13.374 [DefaultQuartzScheduler_Worker-] ERROR org.quartz.core.ErrorLogger: - Job (group1.job1 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
at org.quartz.core.JobRunShell.run(JobRunShell.java:) [quartz-2.2..jar:?]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:) [quartz-2.2..jar:?]
Caused by: java.lang.NullPointerException
at com.starunion.java.service.timer.JobEndConference.execute(JobEndConference.java:) ~[bin/:?]
at org.quartz.core.JobRunShell.run(JobRunShell.java:) ~[quartz-2.2..jar:?]
说说我的解决过程:
一、原因很明显:调用了null对象。
根据日志信息,定位到我的Job对象类的指定行,下图的21行:
@Component
public class JobEndConference implements Job { @Autowired
CallableFsExecCmdProc procExecTask; @Override
public void execute(JobExecutionContext JEContext) throws JobExecutionException { JobDataMap map = JEContext.getJobDetail().getJobDataMap(); String meetName = (String) map.get("meetName"); StringBuffer buff = new StringBuffer();
buff.append("bgapi conference ");
buff.append(meetName);
buff.append(" kick all");
// buff.append(ConstantUtil.FS_CMD_TAIL);
// SocketFsTcp4SendCMD.fsSendCommand(buff.toString());
procExecTask.setSendCmd(buff.toString());
Future<Integer> future = StarProxy.executor.submit(procExecTask);
try {
future.get(, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
e.printStackTrace();
} } }
这个对象为空,也就意味着没有通过Spring注解正确的初始化。
确定这个注解的写法是正确的,其他所有的类都是这么写的。
二、那问题在哪里呢?
往上查,看看对这个类的调用情况。
......
JobDetail jobDetail = newJob(JobEndConference.class).withIdentity("job1", "group1").setJobData(dm).build();
......
原因出来了,newJob传入的对象参数并非Spring注解加载的那个对象。
三、解决办法:
方法1. 从Spring的ApplicationContext获取JobEndConference对象。
方法2. 取消JobEndConference的本身和参数的注解,用new初始化。
Quartz:ERROR threw an unhandled Exception的更多相关文章
- phoenix连接hbase数据库,创建二级索引报错:Error: org.apache.phoenix.exception.PhoenixIOException: Failed after attempts=36, exceptions: Tue Mar 06 10:32:02 CST 2018, null, java.net.SocketTimeoutException: callTimeou
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...
- 解决kylin查询报错:org.apache.kylin.rest.exception.InternalErrorException
报错信息: -- ::, ERROR [Query 12e9c054-760c---b1f06724c9b6-] service.QueryService: : Exception when exec ...
- Error : APP-FND-01926: The custom event WHEN-LOGON-CHANGED raised unhandled exception: ORA-06502: PL
In this Document _afrLoop=440418974213449&id=1508865.1&_afrWindowMode=0&_adf.ctrl-stat ...
- JAVA 新手问题: Request 编码编译出错,Unhandled exception type UnsupportedEncodingException
新手: 编写如下代码 private void Exec(HttpServletRequest Req,HttpServletResponse Response) //throws ServletEx ...
- 安装owncloud出现:Error while trying to create admin user: An exception occurred while executing
安装owncloud出现:Error while trying to create admin user: An exception occurred while executing 1.安装ownc ...
- Solve Error: Unhandled exception at 0x00905a4d in xxx.exe: 0xC0000005: Access violation.
在使用Visual Studio进行项目开发的时候,有时候会遇到下面这个错误: Unhandled exception at 0x00905a4d in xxx.exe: 0xC0000005: Ac ...
- webSphere 部署项目时,访问报错:Error 500: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet【我】
前提: 一个普通maven项目,在本地用Tomcat运行没有任何问题,但是放到 webSphere 测试环境上,访问时就报如下错误: Error 500: javax.servlet.Servlet ...
- Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException
Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. M ...
- An unhandled exception of type 'System.TypeInitializationException' occurred in System.ServiceModel.dll
异常“ An unhandled exception of type 'System.TypeInitializationException' occurred in System.ServiceMo ...
随机推荐
- [CentOS] 使用gitolite搭建git服务端
1. 创建用户 #创建gitadmin用户 useradd gitadmin #设置gitadmin密码 passwd gitadmin #创建git用户 useradd git #设置git密码 p ...
- android 项目学习随笔十二(ListView加脚布局)
1.ListView加脚布局 头布局initHeaderView,在onTouchEvent事件中进行显示隐藏头布局切换 脚布局initFooterView,实现接口OnScrollListener, ...
- overflow的劲爆知识点
1.属性 visible(默认) hidden(此处是隐藏不是裁剪) scroll(滚动条) auto(智能路线 当超出范围时则出现滚动条) inherit 不常用 存在兼容性问题 2.进入CSS3 ...
- linux设备驱动归纳总结(九):1.platform总线的设备和驱动【转】
本文转载自:http://blog.chinaunix.net/uid-25014876-id-111745.html linux设备驱动归纳总结(九):1.platform总线的设备和驱动 xxxx ...
- 错误: 找不到或无法加载主类 Files\apache-activemq-5.10.0\bin\..\conf\login.config
在启动activemq的时候出现错误:“错误: 找不到或无法加载主类 Files\apache-activemq-5.10.0\bin\..\conf\login.config”,之前用activem ...
- C#:IText构造PDF文件
IText构造PDF文件 1.1 生成Document Document是我们要生成的PDF文件所有元素的容器,因此要生成一个PDF文档,必须首先定义一个Document对象. Document有三种 ...
- Linux用户组与用户组进阶命令
1.用户锁定 : passwd -l user1 2.解除用户锁定:passwd -u user1 3.用户无密码登记:passwd -d user1 4.添加到附属用户组:gpasswd -a us ...
- Sublime Text2一些快捷键收藏
快捷键 XP版 Ctrl+P 搜索文件 Ctrl+R 搜索方法 ...
- 使用sql创建表并添加注释
Create table T_ErrorLogTable_tb ( ELTID int identity(1,1) primary key,--编号 ELTTime date,--错误发生日期 ELT ...
- Unity GUI内绘制贝塞尔曲线
用Handles可以直接在GUI下绘制贝塞尔 using UnityEditor; using UnityEngine; using System.Collections; public class ...