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 ...
随机推荐
- archlinux锁屏
启动管理器用的是 slim 发现锁屏可以用 slimlock
- vim下正则表达式的非贪婪匹配
贪婪模式是: .* 非贪婪模式是: .\{-}
- 《zw版·Halcon-delphi系列原创教程》航母舰载机·视觉定位标志的识别代码
<zw版·Halcon-delphi系列原创教程>航母舰载机·视觉定位标志的识别代码 航母舰载机机身上的黄黑圆圈的标志是什么意思,辐射?核动力?战术核弹? <百度百科>介绍如下 ...
- 【python】python环境的安装与配置
安装配置pip / easy_install / virtualenv 在ubuntu 10.10之后的版本中,要这样安装 sudo apt-get install python-pip python ...
- Yii增删改查操作
增: 1 第一种 $post=new Post; $post->title='sample post'; $post->content='content for the sample po ...
- Office 2007在安装过程中出错-解决办法
1, 可能是因为c:\program files\common files\microsoft Shared\web server Extensions\40\bin目录下缺少Fp4autl.dll, ...
- iOS从健康app中获取步数信息
统计步数信息并不需要我们自己去实现,iOS自带的健康app已经为我们统计好了步数数据 我们只要使用HealthKit框架从健康app中获取这个数据信息就可以了 1.如下图所示 在Xcode中打开Hea ...
- docker RESTful API
https://docs.docker.com/engine/reference/api/docker_remote_api/
- fedora 20 yum出错
需要利用linux做项目,所以在win10装了vmvare 以及 fedora,据说这个linux比较稳定.. 1.系统装好以后,需要先把terminal调处理,这才符合程序猿的习惯嘛,具体方法如下 ...
- uniq DEMO
测试数据: [weblogic@etp-mall-dev7][/tmp]$ cat msn.txt aaa bbb bbb ccc ccc ddd bbb eee aaa ccc bbb sss op ...