只是想记录自己的错误信息,下次再出现就知道怎么操作,不用再查找资料

解决办法:

package com.wqq.quartz_test.schedule;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import org.springframework.web.context.WebApplicationContext; /**
* @author wangqq
* @version 创建时间:2018年9月14日 上午9:49:29
* 类说明
*/
public class QuartzContextListener implements ServletContextListener { @Override
public void contextInitialized(ServletContextEvent sce) {
// TODO Auto-generated method stub } @Override
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
WebApplicationContext webApplicationContext = (WebApplicationContext) arg0
.getServletContext()
.getAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
org.quartz.impl.StdScheduler startQuertz = (org.quartz.impl.StdScheduler) webApplicationContext
.getBean("startQuertz");
if(startQuertz != null) {
startQuertz.shutdown();
}
try {
Thread.sleep();
} catch (InterruptedException e) {
e.printStackTrace();
}
} }

其中

"startQuertz" 是在spring-quartz.xml中
 <bean id="startQuartz" lazy-init="false" autowire="no"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="jobTriggerA"/>
<ref bean="jobTriggerB"/>
</list>
</property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.scheduler.instanceName">buy_it_now</prop>
<prop key="org.quartz.threadPool.threadCount"></prop>
<prop key="org.quartz.plugin.shutdownhook.class">org.quartz.plugins.management.ShutdownHookPlugin</prop>
<prop key="org.quartz.plugin.shutdownhook.cleanShutdown">true</prop>
<prop key="org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread">true</prop>
</props>
</property>
<property name="configLocation" value="classpath:quartz/quartz.properties"></property>
<property name="applicationContextSchedulerContextKey" value="applicationContext" />
</bean>

然后在web.xml中配置

<listener>
<listener-class>com.wqq.quartz_test.schedule.QuartzContextListener</listener-class>
</listener>

虽然不报错了,但是把这个注释掉,也不报错了,不知道程序发什么疯,可能有些原理还不知道

quartz + spring 启动项目时,报错The web application [] appears to have started a thread named.........的更多相关文章

  1. 已解决: idea创建并部署SpringMVC项目时 报错 java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

    用IDEA创建并运行SpringMVC项目时,最初发现没有Servlet包,这个问题已在上篇解决,然而当我们尝试去运行此时的SpringMVC项目时,发现仍然有错误.ClassNotFoundExce ...

  2. spring+hibernate整合:报错org.hibernate.HibernateException: No Session found for current thread

    spring+hibernate整合:报错信息如下 org.hibernate.HibernateException: No Session found for current thread at o ...

  3. 启动tomcat时,报错:IOException while loading persisted sessions: java.io.EOFException解决方法

    报错原因:加载持久化session错误,tomcat加载时读取的文件是是*.ser,session序列化文件,文件的位置是tomcat\work\Catalina\localhost,找到sessio ...

  4. idea 创建的maven+spring+mybatis项目整合 报错无法创建bean

    报错如下: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with n ...

  5. tomcat报错this web application instance has been stopped already问题

    上网搜了下,大部分的报错原因:重启时候 之前的tomcat未正常关闭 ,导致在重启时候 报了这个问题.mac下解决: ps -ef|grep tomcat 找到在进行的tomcat ,kill -9  ...

  6. idea 创建运行web项目时,报错: Can not issue executeUpdate() for SELECTs解决方案

    最近在做一个Web课程设计的时候遇到了如下的问题. java.sql.SQLException: java.lang.RuntimeException: java.sql.SQLException: ...

  7. tomcat部署项目时 报错Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules

    Tomcat version 7.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 and 6 Web modules 解决方法: 找到文件 .set ...

  8. linux下启动tomcat时卡在Deploying web application directory

    找到jdk1.x.x_xx/jre/lib/security/Java.security文件,在文件中找到securerandom.source这个设置项,将其改为: securerandom.sou ...

  9. 非root用户启动redis容器报错mkdir: cannot create directory '/bitnami/redis': Permission denied

    问题:使用docker启动容器时,报错如下 zh@debian:~/testPath$ docker-compose up redis Starting testpath_redis_1 ... do ...

随机推荐

  1. MyEclipse 连接Oracle数据库(初学者必看)

    前言:刚接触Oracle数据库,便有一个需求,编写控制台程序,实现主人登录.数据库为Oracle.下面详细介绍一下MyEclipse 连接Oracle数据库.   package DbHelp; im ...

  2. 统计:mAP的中文意思

    原文链接:http://blog.csdn.net/Lu597203933/article/details/41802155 之前写过一篇blog叫做机器学习实战笔记之非均衡分类问题:http://b ...

  3. SLAM: 图像角点检测的Fast算法(时间阈值实验)

    作为角点检测的一种快速方法,FastCornerDetect算法比Harris方法.SIft方法都要快一些,应用于实时性要求较高的场合,可以直接应用于SLAM的随机匹配过程.算法来源于2006年的Ed ...

  4. token的问题汇总

    token的作用:认证.授权: 生成:随机码.时间戳.用户 设备 合成: 验证:是否存在.合成验证: 管理:有效期(服务器存储时间or cookie存储过期时间).展期. token生成:或者和用户信 ...

  5. BZOJ [POI2004]PRZ 状压DP_二进制_骚操作

    二进制就是比谁更sao... Code: #include <bits/stdc++.h> #define setIO(s) freopen(s".in"," ...

  6. BZOJ 1688: [Usaco2005 Open]Disease Manangement 疾病管理 状压DP + 二进制 + 骚操作

    #include <bits/stdc++.h> #define setIO(s) freopen(s".in","r",stdin) #defin ...

  7. https证书安装无效的主要原因

    https证书的作用是为了确认服务端身份,但网络上充满了无效的证书,浏览器对使用无效证书的访问,给出危险.不安全警告,将是否选择继续访问由用户选择,而大多数用户是无法区分这是配置还是真的存在安全问题. ...

  8. Python 集合 day3

    集合(set)是一个无序的不重复元素序列. 可以使用大括号 { } 或者 set() 函数创建集合,集合用{},里面是一个一个元素,不同于key-value形式的字典: 注意:创建一个空集合必须用 s ...

  9. eas之获得任何一个KDTable的选中行

    import com.kingdee.bos.ctrl.kdf.table.util.KDTableUtil; int[] selectRows =KDTableUtil.getSelectedRow ...

  10. 15.5.1【Task实现细节】 生成的代码

    还在吗?我们开始吧.由于深入讲解需上百页的篇幅,因此这里我不会讲得太深.但我会提 供足够的背景知识,以有助于你对整个结构的理解.之后可通过阅读我近些年来撰写的博客文章, 来了解更加错综复杂的细节,或简 ...