Announcement Announcement Module
Collapse
No announcement yet.
File Deletion through Spring quartz Batch job Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • File Deletion through Spring quartz Batch job

    Hi,

    I am using Spring Quartz scheduler version : quartz-1.6.0.jar in my project.
    Application server used to host my applicarion : BEA weblogic 9.2


    The Batch I am executing is responsible for transferring files from my local drive to a SFTP server. After successful transfer I need to delete the files at my local machine.

    I am able to successfully transfer the files to SFTP server, however I am not able to delete the files from my local machine after the transfer.

    The primary reason I could analyze was that, the files were locked by server.
    a) I was not able to delete my files manually (w/o batch) while my server was running.
    b) How ever, I was able to delete files once I shut down my weblogic
    c) My batch is not running in a separate JVM , rather in the same JVM of weblogic server.

    Any Help / Pointer would be highly appreciated.

    TIA
    ~Atul

  • #2
    Dec 11, 2009 9:26:20 AM org.quartz.core.JobRunShell run
    SEVERE: Job DEFAULT.fileTransferJob threw an unhandled Exception:
    java.lang.InternalError: erroneous handlers
    at
    ..................
    (FileTransferDelegateImpl.java:36)
    at com.miadidas.aroma.init.job.FileTransfer.executeIn ternal(FileTransfer.java:47)
    at org.springframework.scheduling.quartz.QuartzJobBea n.execute(QuartzJobBean.java:79)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 02)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)
    Exception in thread "DefaultQuartzScheduler_Worker-2" java.lang.NoClassDefFoundError: org/quartz/utils/ExceptionHelper
    at org.quartz.SchedulerException.setCause(SchedulerEx ception.java:141)
    at org.quartz.SchedulerException.<init>(SchedulerExce ption.java:131)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 13)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)



    I recieve following exception trace... Is it has something to do with locking of files . Can some one tell the reason for this error ??

    Addition :

    The class "ExceptionHelper" is available in the the quartz -1.6.0.jar... Still I am getting No Class Def exception. .
    Last edited by atulnarf2003; Dec 10th, 2009, 10:07 PM.

    Comment


    • #3
      What is your deployment platform (OS, Java version etc.)?

      Looks like your NoClassDefFoundError is bombing the job and causing a close() to be skipped. That's not unexpected, I guess, if a little inconvenient. I have no idea why the class is not found. Is quartz part of your runtime platform, and it's leaking in from a different classloader. Is there another version of the jar somewhere on your classpath?

      Comment


      • #4
        Hi Dave ,

        Deployment platform details :
        OS : Windows XP
        Java Version : Java 1.5
        Weblogic : 9.2
        Spring Quartz : quartz-1.6.0.jar

        After searching a lot I got one breakthrough though.

        Placed following entry into my weblogic.xml :

        <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">

        <description>miadidas-aroma</description>
        <context-root>/miadidas-aroma</context-root>
        <container-descriptor>
        <prefer-web-inf-classes>true</prefer-web-inf-classes>
        </container-descriptor>
        </weblogic-web-app>


        As a result I was able to perform my task successfully. This entry tells the server to use up only those libraries present in lib of the project for any operation.

        How ever I am still concerned with the exception trace coming like :

        a)

        Exception in thread "DefaultQuartzScheduler_Worker-8" java.lang.NoClassDefFoundError: org/springframework/core/NestedExceptionUtils
        at org.springframework.core.NestedRuntimeException.ge tMessage(NestedRuntimeException.java:100)
        at java.lang.Throwable.getLocalizedMessage()Ljava.lan g.String;(Unknown Source)
        at java.lang.Throwable.toString()Ljava.lang.String;(U nknown Source)
        at java.lang.String.valueOf(Ljava.lang.ObjectLjava.lang.String;(Unknown Source)
        at java.io.PrintWriter.print(PrintWriter.java:546)
        at java.io.PrintWriter.println(PrintWriter.java:683)
        at org.springframework.core.NestedRuntimeException.pr intStackTrace(NestedRuntimeException.java:127)
        at java.util.logging.SimpleFormatter.format(SimpleFor matter.java:72)
        at java.util.logging.StreamHandler.publish(StreamHand ler.java:179)
        at java.util.logging.ConsoleHandler.publish(ConsoleHa ndler.java:88)
        at java.util.logging.Logger.log(Ljava.util.logging.Lo gRecordV(Unknown Source)
        at java.util.logging.Logger.doLog(Ljava.util.logging. LogRecordV(Unknown Source)
        at java.util.logging.Logger.logp(Ljava.util.logging.L evel;Ljava.lang.String;Ljava.lang.String;Ljava.lan g.String;Ljava.lang.ThrowableV(Unknown Source)
        at org.apache.commons.logging.impl.Jdk14Logger.log(Jd k14Logger.java:93)
        at org.apache.commons.logging.impl.Jdk14Logger.error( Jdk14Logger.java:127)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:2 11)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)


        b)

        java.lang.InternalError: erroneous handlers
        at ...
        (FileTransferDelegateImpl.java:36)
        at com.miadidas.aroma.init.job.FileTransfer.executeIn ternal(FileTransfer.java:47)
        at org.springframework.scheduling.quartz.QuartzJobBea n.execute(QuartzJobBean.java:79)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:2 02)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)
        Exception in thread "DefaultQuartzScheduler_Worker-9" java.lang.NoClassDefFoundError: org/quartz/utils/ExceptionHelper
        at org.quartz.SchedulerException.setCause(SchedulerEx ception.java:141)
        at org.quartz.SchedulerException.<init>(SchedulerExce ption.java:131)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:2 13)
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:529)


        As suggested by ... I have checked all classpath settings and lib folders for any duplicate entry of quartz 1.6 jar.

        Also I dont have any other version of quartz jar in classpath.

        Although I have solved my problem but still need to know how to get rid of these exceptions... Please suggest if any other details are required.

        Any other things I can check upon.. ??

        Thanks
        ~Atul

        Comment


        • #5
          Your production environment is Windoze? I guess that explains the vicious file locks.

          Not sure about the no class def errors. Maybe WLS is being strict with you about thread creation - you aren't really supposed to do that inside a JEE app without using a container managed thread pool.

          Does your job run OK in a foreground thread (not using Quartz)?

          Comment


          • #6
            Hi Dave ,

            Yes.. Production enviroment is Windows Sever 2003. As of testing on Windows XP. But the same problem is occuring on Windows 2k3 as well .

            The entry in weblogic.xml does allow to delete my files.

            Now the No class def is causing me worry. .

            If I run it as a JUNIt test case (i.e. w/o Quartz schedular ) everything works fine .

            So that means :
            a) WLS does maintain some kinda lock on files to be deleted.
            b) Configuration in weblogic.xml has taken care of this problem.
            c) Windows OS is not maintaining any lock on file (Bill wud be glad )

            Point of concern :
            a) "Quartz Class No def" exceptions . Actually this is a very crictical process so need to get to root of this problem .


            Things I would be trying :
            a)
            " Maybe WLS is being strict with you about thread creation "

            Would run it on Tommy (Tomcat ) and check if same exception is occurig.

            b)
            " [B]..you aren't really supposed to do that inside a JEE app without using a container managed thread pool.[/B]"
            Will try on this as well...

            Will keep ya posted on the proceeding.. Btw any other things I can try on ??

            Comment

            Working...
            X