浏览 1505 次
锁定老帖子 主题:配置spring时出现的异常,请帮助解决。
该帖已经被评为隐藏帖
|
|
---|---|
作者 | 正文 |
发表时间:2009-09-30
<?xml version="1.0" encoding="UTF-8"?> <!-- 指定Spring配置文件的Schema信息 --> <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.xsd"> <!--声明一个定时任务,该类extends java.util.TimerTask --> <bean id="clock" class="com.mirrors.user.util.MyTesk"> </bean> <!--调度定时任务,把声明的定时任务注入进来,并设置定时参数 --> <bean id="scheduledClock" class="org.springframework.scheduling.timer.ScheduledTimerTask"> <property name="timerTask"> <ref bean="clock"/> </property> <property name="period"> <value>5000</value> </property> <property name="delay"> <value>5000</value> </property> </bean> <!-- 启动定时任务,如果有多个定时任务,则重复步骤一,二,然后把第二步设置的beany放在下面的list列表中.此方法不能精确几点运行定时任务 --> <bean class="org.springframework.scheduling.timer.TimerFactoryBean"> <property name="scheduledTimerTasks"> <list> <ref bean="scheduledClock"></ref> </list> </property> </bean> <!-- 以上一种定时任务不能精确到几点运行,以下一种定时任务能够精确定几点运行 --> <bean id="quartzClock" class="com.mirrors.user.util.QuartzClock"></bean> <!--这种配置与第一种方法效果一样 <bean id="quartzClockTask" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <property name="jobDetail"> <ref bean="quartzClock"/> </property> <property name="startDelay"> <value>6000</value> </property> <property name="repeatInterval"> <value>6000</value> </property> </bean> --> <bean id="cronQuartzClock" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="quartzClock"></ref> </property> <property name="cronExpression"> <value> 0 0 12,14,16 * * ?</value> </property> </bean> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="cronQuartzClock"></ref> </list> </property> </bean> </beans> 当发布启动Tomcat 6时发生如下异常: 2009-9-30 11:08:58 org.apache.catalina.core.AprLifecycleListener init 信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jdk1.6.0\bin;D:\Program Files\Tomcat 6.0\bin 2009-9-30 11:08:58 org.apache.coyote.http11.Http11Protocol init 信息: Initializing Coyote HTTP/1.1 on http-8080 2009-9-30 11:08:58 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 571 ms 2009-9-30 11:08:58 org.apache.catalina.core.StandardService start 信息: Starting service Catalina 2009-9-30 11:08:58 org.apache.catalina.core.StandardEngine start 信息: Starting Servlet Engine: Apache Tomcat/6.0.16 2009-9-30 11:08:58 org.apache.catalina.core.StandardContext addApplicationListener 信息: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored. 2009-09-30 11:08:59,328 INFO [org.springframework.web.context.ContextLoader] - <Root WebApplicationContext: initialization started> 2009-9-30 11:08:59 org.apache.catalina.core.ApplicationContext log 信息: Loading Spring root WebApplicationContext 2009-09-30 11:08:59,468 INFO [org.springframework.core.CollectionFactory] - <JDK 1.4+ collections available> 2009-09-30 11:08:59,484 INFO [org.springframework.core.CollectionFactory] - <Commons Collections 3.x available> 2009-09-30 11:08:59,562 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [/WEB-INF/spring_config/applicationContext.xml]> 2009-09-30 11:08:59,843 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [/WEB-INF/spring_config/applicationContext-service.xml]> 2009-09-30 11:08:59,875 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [/WEB-INF/spring_config/applicationContext-dao.xml]> 2009-09-30 11:08:59,890 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [/WEB-INF/spring_config/applicationContext-common.xml]> 2009-09-30 11:08:59,937 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from ServletContext resource [/WEB-INF/spring_config/applicationContext-action.xml]> 2009-09-30 11:09:00,015 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <Bean factory for application context [Root WebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,transactionInterceptor,org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator,baseService,userService,baseDao,userDao,clock,scheduledClock,org.springframework.scheduling.timer.TimerFactoryBean,quartzClock,cronQuartzClock,org.springframework.scheduling.quartz.SchedulerFactoryBean,loginBean,bookBean]; root of BeanFactory hierarchy> 2009-09-30 11:09:00,031 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - <17 beans defined in application context [Root WebApplicationContext]> 2009-09-30 11:09:00,125 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - <Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,transactionInterceptor,org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator,baseService,userService,baseDao,userDao,clock,scheduledClock,org.springframework.scheduling.timer.TimerFactoryBean,quartzClock,cronQuartzClock,org.springframework.scheduling.quartz.SchedulerFactoryBean,loginBean,bookBean]; root of BeanFactory hierarchy}> 2009-09-30 11:09:00,125 ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed> org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.mirrors.user.util.QuartzClock] for bean with name 'quartzClock' defined in ServletContext resource [/WEB-INF/spring_config/applicationContext-common.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/quartz/Job Caused by: java.lang.NoClassDefFoundError: org/quartz/Job at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206) at org.springframework.util.ClassUtils.forName(ClassUtils.java:177) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:313) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:912) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:165) at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:687) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:397) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:330) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) 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:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2009-9-30 11:09:00 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [com.mirrors.user.util.QuartzClock] for bean with name 'quartzClock' defined in ServletContext resource [/WEB-INF/spring_config/applicationContext-common.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/quartz/Job Caused by: java.lang.NoClassDefFoundError: org/quartz/Job at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:620) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1819) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:872) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1327) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206) at org.springframework.util.ClassUtils.forName(ClassUtils.java:177) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:313) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:912) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:165) at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:687) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:397) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:330) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) 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:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:924) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) 2009-9-30 11:09:00 org.apache.catalina.core.StandardContext start 严重: Error listenerStart 2009-9-30 11:09:00 org.apache.catalina.core.StandardContext start 严重: Context [/Mirrors] startup failed due to previous errors 2009-9-30 11:09:00 org.apache.catalina.core.ApplicationContext log 信息: Closing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (com.opensymphony.xwork2.config.providers.XmlConfigurationProvider). log4j:WARN Please initialize the log4j system properly. 2009-9-30 11:09:01 org.apache.coyote.http11.Http11Protocol start 信息: Starting Coyote HTTP/1.1 on http-8080 2009-9-30 11:09:01 org.apache.jk.common.ChannelSocket init 信息: JK: ajp13 listening on /0.0.0.0:8009 2009-9-30 11:09:01 org.apache.jk.server.JkMain start 信息: Jk running ID=0 time=0/31 config=null 2009-9-30 11:09:02 org.apache.catalina.startup.Catalina start 信息: Server startup in 3902 ms 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |