在spring中加入quartz的配置,启动服务器以后后台报错,请问这是什么原因?
Caused by: java.lang.NoClassDefFoundError: org/quartz/JobExecutionException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
at java.lang.Class.getDeclaredMethods(Class.java:1763)
at java.beans.Introspector$1.run(Introspector.java:1265)
at java.security.AccessController.doPrivileged(Native Method)
at java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1263)
at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1129)
at java.beans.Introspector.getBeanInfo(Introspector.java:387)
at java.beans.Introspector.getBeanInfo(Introspector.java:159)
at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:244)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:143)
at org.springframework.beans.BeanWrapperImpl.setIntrospectionClass(BeanWrapperImpl.java:236)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:194)
at org.springframework.beans.BeanWrapperImpl.setWrappedInstance(BeanWrapperImpl.java:177)
at org.springframework.beans.BeanWrapperImpl.<init>(BeanWrapperImpl.java:130)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:733)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:720)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:386)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:279)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:360)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:241)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)quartzspring

解决方案 »

  1.   

    指定调度的那个类 没有找到。。check no 
      

  2.   

     java.lang.NoClassDefFoundError少jar包
      

  3.   


    <?xml version="1.0" encoding="UTF-8"?>
    <!--
      ~ //===================================================================================
      ~ // Copyright (c) 2011-2012 by Hanghang Science and Technology Co., Ltd, All rights reserved.
      ~ // Xihu Technology Park No.206 Zhenhua Rd., Hangzhou 310031 China
      ~ //
      ~ // This software is the confidential and proprietary information of
      ~ // hzhanghang.com, Inc. ("Confidential Information"). You shall not disclose
      ~ // such Confidential Information and shall use it only in accordance
      ~ // with the terms of the license agreement you entered into with hzhanghang.com, Inc.
      ~ //===================================================================================
      --><!--<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">-->
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
        <!-- 要调用的工作类 -->
        <!--<bean id="testJob" class="com.smshen.quartz.TestJob"></bean>-->
        <!-- 定义触发时间 -->
        <!--字段允许值允许的特殊字符-->
        <!--秒 0-59 , - * /-->
        <!--分 0-59 , - * /-->
        <!--小时 0-23 , - * /-->
        <!--日期 1-31 , - * ? / L W C-->
        <!--月份 1-12 或者 JAN-DEC , - * /-->
        <!--星期 1-7 或者 SUN-SAT , - * ? / L C #-->
        <!--年(可选)留空, 1970-2099 , - * /-->
        <!---->
        <!--表达式意义-->
        <!--"0 0 12 * * ?" 每天中午12点触发-->
        <!--"0 15 10 ? * *" 每天上午10:15触发-->
        <!--"0 15 10 * * ?" 每天上午10:15触发-->
        <!--"0 15 10 * * ? *" 每天上午10:15触发-->
        <!--"0 15 10 * * ? 2005" 2005年的每天上午10:15触发-->
        <!--"0 * 14 * * ?" 在每天下午2点到下午2:59期间的每1分钟触发-->
        <!--"0 0/5 14 * * ?" 在每天下午2点到下午2:55期间的每5分钟触发-->
        <!--"0 0/5 14,18 * * ?" 在每天下午2点到2:55期间和下午6点到6:55期间的每5分钟触发-->
        <!--"0 0-5 14 * * ?" 在每天下午2点到下午2:05期间的每1分钟触发-->
        <!--"0 10,44 14 ? 3 WED" 每年三月的星期三的下午2:10和2:44触发-->
        <!--"0 15 10 ? * MON-FRI" 周一至周五的上午10:15触发-->
        <!--"0 15 10 15 * ?" 每月15日上午10:15触发-->
        <!--"0 15 10 L * ?" 每月最后一日的上午10:15触发-->
        <!--"0 15 10 ? * 6L" 每月的最后一个星期五上午10:15触发-->
        <!--"0 15 10 ? * 6L 2002-2005" 2002年至2005年的每月的最后一个星期五上午10:15触发-->
        <!--"0 15 10 ? * 6#3" 每月的第三个星期五上午10:15触发-->
        <bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail">
                <ref bean="jobtask"/>
            </property>
            <!-- cron表达式 每隔一分钟执行一次任务-->
            <property name="cronExpression">
                <value>0 0/1 * * * ? *</value>
            </property>
        </bean>
        <!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 -->    <bean id="startQuertz" lazy-init="false" autowire="no"
              class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="triggers">
                <list>
                    <ref bean="doTime"/>               
                </list>
            </property>
        </bean>
    </beans>
      

  4.   

    <?xml version="1.0" encoding="UTF-8"?>
    <!--数据接收端配置  -->
    <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

    <bean id="quartzJob" class="com.richway.task.HelloWorld"></bean>
        <!-- 定义调用对象和调用对象的方法 -->
        <bean id="jobtask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
            <!-- 调用的类 -->
            <property name="targetObject">
                <ref bean="quartzJob"/>
            </property>
            <!-- 调用类中的方法 -->
            <property name="targetMethod">
                 <value>execute</value>
            </property>
        </bean>
        <!-- 定义触发时间 -->
        <bean id="doTime" class="org.springframework.scheduling.quartz.CronTriggerBean">
            <property name="jobDetail">
                <ref bean="jobtask"/>
            </property>
            <!-- cron表达式 -->
            <property name="cronExpression">
                <value>0/1 1-5 15 * * ?</value>
            </property>
        </bean>
        <!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序  -->
        <bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
            <property name="triggers">
                <list>
                   <ref bean="doTime"/>
                </list>
            </property>
        </bean></beans>
      

  5.   

    感觉jar包不少,上面那个是我的spring配置代码,应该没有错吧
      

  6.   

    去掉quartz-1.6.0.jar,和1.8.0重复了一个。
      

  7.   

    检查下jar包,重新导入、编译一遍,
      

  8.   

    删除后要重新部署,发布才行。看下你tomcat的webapps下的项目下里面的lib里面jar包情况。
      

  9.   

    看了一下,那下面却是少那些包,不过都加上以后抱着个错了
    严重: Error in dependencyCheck
    java.util.zip.ZipException: invalid entry CRC (expected 0xab633fa2 but got 0xc30a2df7)
    at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:383)
    at java.util.zip.ZipInputStream.read(ZipInputStream.java:141)
    at java.util.jar.JarInputStream.read(JarInputStream.java:171)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
    at java.util.jar.JarInputStream.getBytes(JarInputStream.java:88)
    at java.util.jar.JarInputStream.<init>(JarInputStream.java:65)
    at java.util.jar.JarInputStream.<init>(JarInputStream.java:43)
    at org.apache.catalina.util.ExtensionValidator.getManifest(ExtensionValidator.java:373)
    at org.apache.catalina.util.ExtensionValidator.validateApplication(ExtensionValidator.java:184)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:448)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
    这是什么原因?jar包有冲突吗
      

  10.   

    换quartz的版本试试,jar版本和spring可能不兼容