在tomcat启动的时候,class属性被识别为String属性的变量,导致启动不成功,急求解决方案,在线等.....
代码如下:
<bean id="clearDataTimerJob1" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value >cn.com.task.timer.run.ClearTaskTimer</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="dataSource">
<ref bean="AA_2" />
</entry>
<entry key="dirHome">
<value>/usr/local/DD/ZIP/export/SS/</value>
</entry>
<entry key="threadName">
<value>线程1...............</value>
</entry>
</map>
</property>
</bean>
报错信息如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clearDataTimerJob1' defined in ServletContext resource [/WEB-INF/cleardata_bean.xml]: Error converting typed String value for bean property 'jobClass'; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type [java.lang.String] to required type [java.lang.Class]; nested exception is java.lang.IllegalArgumentException: Cannot find class [cn.com.task.timer.run.ClearTaskTimer]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary
........
(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
.....
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert value of type [java.lang.String] to required type [java.lang.Class]; nested exception is java.lang.IllegalArgumentException: Cannot find class [cn.com.task.timer.run.ClearTaskTimer]
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:365)
at org.springframework.beans.AbstractPropertyAccessor.convertIfNecessary(AbstractPropertyAccessor.java:109)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:159)
... 32 more
Caused by: java.lang.IllegalArgumentException: Cannot find class [cn.com.task.timer.run.ClearTaskTimer]
at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:233)
... 34 more
Caused by: java.lang.ClassNotFoundException: cn.com.task.timer.run.ClearTaskTimer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)
.....
------解决方案--------------------
Caused by: java.lang.ClassNotFoundException: cn.com.task.timer.run.ClearTaskTimer
检查下地址
------解决方案--------------------
<property name="jobClass">
<value >cn.com.task.timer.run.ClearTaskTimer</value>
</property>
换成
<property name="jobClass">
<bea class="cn.com.task.timer.run.ClearTaskTimer"></bean>
</property> 试试
------解决方案--------------------
类没有找到啊!!!
------解决方案--------------------
- Java code
public class HardwareInfoCollectJob extends QuartzJobBean {}