|
From: Pinghua L. <pin...@gm...> - 2007-11-21 12:31:44
|
hi everybody:
I'm a newer of java and spring. when I study to use spring and
quartz integration to store schedule to database, I found that
"org.springframework.scheduling.quartz.JobDetailBean" will throw
java.io.NotSerializable exception, note that I have takecare
applicationContextJobDataKey (I didn't set this value).
Dose JobDetailBean must implement ApplicationContextAware?
---------------------------------------------------------------------
As a repair, I create new class to instead old one:
import org.springframework.context.ApplicationContext;
public class JobDetailBean extends
org.springframework.scheduling.quartz.JobDetailBean {
public void setApplicationContext(ApplicationContext applicationContext) {
super.setApplicationContext(null);
//this.applicationContext = applicationContext;
}
}
and use this one, the exception was gone, is this a bug?
----------------------------------------------------------------------
exception:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'scheduler' defined in class path resource
[conf/context-scheduled.xml]: Invocation of init method failed; nested
exception is org.quartz.JobPersistenceException: Couldn't store
trigger: org.springframework.context.support.ClassPathXmlApplicationContext
[See nested exception: java.io.NotSerializableException:
org.springframework.context.support.ClassPathXmlApplicationContext]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:532)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:238)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:167)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:235)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:167)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:379)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:730)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:369)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at org.springframework.test.AbstractSingleSpringContextTests.loadContextLocations(AbstractSingleSpringContextTests.java:182)
at org.springframework.test.AbstractSingleSpringContextTests.loadContext(AbstractSingleSpringContextTests.java:152)
at org.springframework.test.AbstractSpringContextTests.getContext(AbstractSpringContextTests.java:105)
at org.springframework.test.AbstractSingleSpringContextTests.setUp(AbstractSingleSpringContextTests.java:83)
at junit.framework.TestCase.runBare(TestCase.java:125)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
|