我在 tomcat 日志中收到此错误
org.springframework.scheduling.support.MethodInvokingRunnable.run:68 - Invocation of method '[Methodname]' on target class [class com.mypackage.classname] failed
当我重新启动tomcat几次时,它就消失了。
任何人都可以帮助可能是什么原因或我该如何解决?
更新
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<context:component-scan base-package="com.schedular"></context:component-scan>
<task:scheduler id="scheduler" pool-size="5"/>
<task:executor id="executor" pool-size="15"/>
<task:annotation-driven scheduler="scheduler" executor="executor"/>
<task:scheduled-tasks>
<task:scheduled ref="mySchedular" method="process" cron="0 0/1 * * * ?"/>
</task:scheduled-tasks>
MySchedular 是我在 com.schedular 包中的类,并且
<context:component-scan ...
为该类创建一个名为 mySchedular 的 bean,因为我相信它做得正确。
现在,当 tomcat 加载这个文件时,它必须调用方法 give in
<task:scheduled ref="mySchedular" method="process" cron="0 0/1 * * * ?" />
在我们的案例中,这被称为流程。
但这有时会产生错误,正如我在顶部提到的那样。虽然如果我们重新启动一次或两次tomcat,它会再次开始工作。