错误描述:
ERROR - JobRunShell.run(211) | Job DEFAULT.StorageYKTMethod threw an unhandled Exception:
org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'sss' on target class [class com.talkweb.ecard.storage.action.StorageYKTMonitor] failed; nested exception is java.lang.NullPointerException
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:269)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: java.lang.NullPointerException
at com.talkweb.ecard.storage.action.StorageYKTMonitor.getStorageYKTMessage(StorageYKTMonitor.java:42)
at com.talkweb.ecard.storage.action.StorageYKTMonitor.sss(StorageYKTMonitor.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260)
... 3 more
DEBUG - ExceptionHelper.supportsNestedThrowable(97) | Detected JDK support for nested exceptions.
ERROR - ErrorLogger.schedulerError(2185) | Job (DEFAULT.StorageYKTMethod threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'sss' on target class [class com.talkweb.ecard.storage.action.StorageYKTMonitor] failed; nested exception is java.lang.NullPointerException]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:525)
Caused by: org.springframework.scheduling.quartz.JobMethodInvocationFailedException: Invocation of method 'sss' on target class [class com.talkweb.ecard.storage.action.StorageYKTMonitor] failed; nested exception is java.lang.NullPointerException
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:269)
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
... 1 more
Caused by: java.lang.NullPointerException
at com.talkweb.ecard.storage.action.StorageYKTMonitor.getStorageYKTMessage(StorageYKTMonitor.java:42)
at com.talkweb.ecard.storage.action.StorageYKTMonitor.sss(StorageYKTMonitor.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276)
at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260)
... 3 more
解决方案:
spring属性注入不成功,为null。应该在sss()方法中调用属性的方法。
分享到:
相关推荐
- 通过实现`org.springframework.scheduling.quartz.JobExecutionException`,可以捕获Job执行过程中的异常,进行统一处理。 8. **事务支持** - 如果Job需要在数据库事务中执行,可以利用Spring的事务管理功能,...
至于任务调度,Spring的`org.springframework.scheduling`包提供了定时任务和并发任务的处理能力,方便开发者进行后台任务的管理和执行。 文档方面,`spring-framework-5.1.17.RELEASE-docs.zip`包含了详细的API...
3. **Spring Framework的Task Execution and Scheduling**: Spring 提供了集成化的任务执行和调度模块,可以方便地在Spring应用中管理定时任务。 4. **ExecutorService和ScheduledExecutorService**: Java并发库中...
<bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 这里添加触发器配置 --> <!-- 这里添加任务详情配置 --> ``` 然后,定义Job类并实现`org....
<bean id="demo1" class="org.springframework.scheduling.quartz.CronTriggerBean"> * * * ?"/> ``` - **SimpleTriggerBean**:这是一种简单的触发器,可以配置初始延迟和重复间隔。例如,“demo2”被配置...
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="configLocation" value="classpath:quartz.properties"/> ``` 这里,`configLocation`...
在Spring中,我们可以通过实现`org.springframework.scheduling.quartz.JobDetailBean`和`org.springframework.scheduling.quartz.CronTriggerBean`来定义任务和触发器。JobDetailBean用于描述任务的属性,如任务类...
按作业类的继承方式,Quartz 可以分为两种:继承 org.springframework.scheduling.quartz.QuartzJobBean 类的方式和不继承 org.springframework.scheduling.quartz.QuartzJobBean 类的方式。其中,第二种方式下的...
<bean id="temperMonitorTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <!-- 调用的类 --> <!-- 调用类中的方法 --> <value>temperatureMonitorTimer ...
Java Quartz 是一个强大的开源作业调度框架,用于在Java应用程序中安排和执行任务。它提供了丰富的API,使得开发者能够轻松地创建、管理和执行定时任务。Quartz 支持简单任务到复杂的作业调度,包括触发器、作业、...
class="org.springframework.scheduling.quartz.JobDetailFactoryBean"> <property name="jobClass" value="cn.ly.quartz.job.HelloJob" /> <!-- trigger触发器 --> class="org.springframework...
Spring框架可以通过`org.springframework.scheduling.quartz`包与Quartz进行集成。下面是一个使用Quartz的例子: ```java import org.quartz.Job; import org.quartz.JobExecutionContext; import org.quartz....
<bean id="myJob" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <bean id="myTrigger" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean"> *...
<bean id="querytestController" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <bean id="querytestControllerTrigger" class="org.springframework.scheduling....
在Spring Framework 3.2.10中,`org.springframework.scheduling`包是关于Spring调度功能的核心组件。这个包提供了全面的异步任务处理和定时任务管理能力,使得开发者能够轻松地实现定时任务和后台任务的执行。本文...
<bean id="sayHelloJob" class="org.springframework.scheduling.quartz.JobDetailBean"> <value>com.test.Test</value> <!-- 关键在如下两个触发器的配置 --> <!-- 类似于Java的简单触发器 --> ...
import org.springframework.scheduling.quartz.QuartzJobBean; public class EmailReportJob extends QuartzJobBean { @Autowired private JavaMailSender mailSender; // 数据库操作相关服务,例如Report...
import org.springframework.scheduling.annotation.EnableSchedulingConfigurer; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.config....
在SpringBoot中定义定时任务,我们创建一个实现了`org.springframework.scheduling.Trigger`和`org.springframework.scheduling.TaskExecutor`接口的类,或者直接使用Quartz的`CronTrigger`或`SimpleTrigger`。...
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <!-- 配置Quartz属性 --> <property name="configLocation" value="classpath:quartz.properties"/> <!...