Announcement Announcement Module
Collapse
No announcement yet.
Quartz scheduled job strange LazyInitializationException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quartz scheduled job strange LazyInitializationException

    I'm getting the following error:

    PHP Code:
    [org.springframework.scheduling.quartz.SchedulerFactoryBean#0_Worker-3] ERROR org.quartz.core.ErrorLogger - Job (assignment.250/517 threw an exception.
    org.quartz.SchedulerExceptionJob threw an unhandled exception. [See nested exceptionorg.hibernate.LazyInitializationExceptioncould not initialize proxy no Session]
        
    at org.quartz.core.JobRunShell.run(JobRunShell.java:227)
        
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
    Caused byorg.hibernate.LazyInitializationExceptioncould not initialize proxy no Session
        at org
    .hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:167)
        
    at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:215)
        
    at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:181)
        
    at com.intelligentpapers.backend.User_$$_javassist_2.getId(User_$$_javassist_2.java)
        
    at com.intelligentpapers.backend.User_Roo_Entity.ajc$interMethodDispatch1$com_intelligentpapers_backend_User_Roo_Entity$com_intelligentpapers_backend_User$getId(User_Roo_Entity.aj)
        
    at com.intelligentpapers.backend.schedule.job.AssignmentSubmissionJob.executeInternal(AssignmentSubmissionJob.java:60)
        
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
        
    at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
        ... 
    1 more 
    Strange thing is it's thrown when I try to get the value of a field of User class (getId). There should be no lazy loading, right?

    Any help appreciated.
    Last edited by selimeki; Sep 4th, 2011, 02:11 PM.

  • #2
    If you have <many-to-one> mapping in your Hibernate config, you should explicitly state <many-to-one ... lazy="false" /> because by default lazy is true.

    Comment


    • #3
      Thank you for your answer dma_k.

      I've already done that. Actually there is no loading of an association. The problem seems to be multiple jobs executing at the same time. I've changed that so that no jobs execute concurrently and it seems to be fixed.

      Comment

      Working...
      X