Announcement Announcement Module
No announcement yet.
QuartzJobBean JobDataMap and serializable entries Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • QuartzJobBean JobDataMap and serializable entries

    I am registering several QuartJobBeans. The job beans need access to other service beans so I am trying to pass them into the bean by adding entries to jobDataAsMap. I then setup properties and corresponding setter methods on the QuartzJobBean. I expect Spring to inject the service beans into these properties every time the job is fired.

    I have configured Quartz for clustering so all trigger, job, etc information is stored in the database.

    The problem is that I am getting an error that the JobDataMap is not serializable:

    Caused by: Unable to serialize JobDataMap for insertion into database because the value of property 'businessSessionManager' is not serializable: fleetcycle.model.framework.persistence.hibernate.TransactionRetryInterceptor
    	at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.serializeJobData(
    	at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(
    	... 106 more
    Now, I'm sure I can get the error to go away by marking the fields that I am injecting as "transient" but I'm not sure if this is safe or not? Why would the JobDataMap need to be stored in the database and is there ever a case where the serialized instance would be deserialized without Spring injecting the dependencies? I don't want to end u p with NPEs if a deserialized instance is ever used.

    Sorry if this is not the correct subforum.