码迷,mamicode.com
首页 > 编程语言 > 详细

spring quartz:Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeErr

时间:2015-01-07 20:56:15      阅读:340      评论:0      收藏:0      [点我收藏+]

标签:xml   spring   quartz   jar   

spring 调度类初始化失败,分析是jar包冲突,日志如下:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Cannot create inner bean 'org.springframework.scheduling.quartz.CronTriggerBean#3dc572d0' of type [org.springframework.scheduling.quartz.CronTriggerBean] while setting bean property 'triggers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.CronTriggerBean#3dc572d0' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Cannot create inner bean 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' of type [org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean] while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:724)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.CronTriggerBean#3dc572d0' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Cannot create inner bean 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' of type [org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean] while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
	... 27 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1007)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:953)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
	... 33 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2823)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1655)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:190)
	at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean.<clinit>(MethodInvokingJobDetailFactoryBean.java:89)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1000)
	... 37 more

一月 07, 2015 6:58:18 下午 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
一月 07, 2015 6:58:18 下午 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/campaign] startup failed due to previous errors
一月 07, 2015 6:58:18 下午 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
2015-01-07 18:58:18,263 [// -  - ] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduler' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Cannot create inner bean 'org.springframework.scheduling.quartz.CronTriggerBean#3dc572d0' of type [org.springframework.scheduling.quartz.CronTriggerBean] while setting bean property 'triggers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.CronTriggerBean#3dc572d0' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Cannot create inner bean 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' of type [org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean] while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:610)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
	at java.util.concurrent.FutureTask.run(FutureTask.java:166)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:724)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.CronTriggerBean#3dc572d0' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Cannot create inner bean 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' of type [org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean] while setting bean property 'jobDetail'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
	... 27 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean#7ed6a46e' defined in file [D:\InstallApplication\apache-tomcat-7.0.23\wtpwebapps\campaign\WEB-INF\classes\spring\applicationContext-single-quartz.xml]: Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1007)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:953)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:271)
	... 33 more
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2823)
	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1160)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1655)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:190)
	at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean.<clinit>(MethodInvokingJobDetailFactoryBean.java:89)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1000)
	... 37 more



bean定义:

<!-- 定义具体的任务类 -->
	<bean id="job_common" class="javacommon.util.CommJob" />
	
	<!-- 全部定义到内部bean中,多个任务 -->
	<bean id="scheduler"
		class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
		<property name="triggers">
			<list>
				<!-- <ref bean="cornTrigger" /> -->
				<!-- 调度任务01 -->
				<bean class="org.springframework.scheduling.quartz.CronTriggerBean">
					<property name="jobDetail">
						<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
							<!-- 目标类 -->
							<property name="targetObject">
								<ref bean="job_common" />
							</property>
							<!-- 目标类中要执行的方法 ,这个参数是必须的 -->
							<property name="targetMethod">
								<value>quartzMethod_001</value>
							</property>
						</bean>
					</property> 
					<property name="cronExpression" value="0/1 * * * * ?"/>
				</bean>
				
				<!-- 调度任务02 -->
				<bean class="org.springframework.scheduling.quartz.CronTriggerBean">
					<property name="jobDetail">
						<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
							<!-- 目标类 -->
							<property name="targetObject">
								<ref bean="job_common" />
							</property>
							<!-- 目标类中要执行的方法 ,这个参数是必须的 -->
							<property name="targetMethod">
								<value>quartzMethod_002</value>
							</property> 
						</bean>
					</property> 
					<property name="cronExpression" value="0/2 * * * * ?"/>
				</bean>
				
				<!-- 调度任务03 -->
				<bean class="org.springframework.scheduling.quartz.CronTriggerBean">
					<property name="jobDetail">
						<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
							<!-- 目标类 -->
							<property name="targetObject">
								<ref bean="job_common" />
							</property>
							<!-- 目标类中要执行的方法 ,这个参数是必须的 -->
							<property name="targetMethod">
								<value>quartzMethod_003</value>
							</property>
						</bean>
					</property> 
					<property name="cronExpression" value="0/3 * * * * ?"/>
				</bean>
			</list>
		</property>
	</bean>

项目用的maven,注释掉pom.xml quartz相关jar引用就好了,如下:

<!-- quartz start -->
		<!-- <dependency>
			<groupId>quartz</groupId>
			<artifactId>quartz</artifactId>
			<version>2.2.0</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>quartz-jobs</groupId> 
			<artifactId>quartz-jobs</artifactId>
			<version>2.2.0</version>
			<scope>compile</scope>
		</dependency> -->
		<!-- quartz end -->



解决,jar包冲突!

spring quartz:Instantiation of bean failed; nested exception is java.lang.IncompatibleClassChangeErr

标签:xml   spring   quartz   jar   

原文地址:http://blog.csdn.net/u010811257/article/details/42498041

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!