Results 1 to 3 of 3

Thread: Quartz scheduled job strange LazyInitializationException

  1. #1
    Join Date
    Sep 2011
    Posts
    2

    Default 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 at 02:11 PM.

  2. #2

    Default

    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.

  3. #3
    Join Date
    Sep 2011
    Posts
    2

    Default

    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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •