Uploaded image for project: 'Apache Roller'
  1. Apache Roller
  2. ROL-1758

Cannot run Roller 4.0 tasks via TaskRunner, worked in 3.x

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Incomplete
    • None
    • None
    • None

    Description

      Background

      The TaskRunner class is designed to make it as easy as possible to run a Roller task from the command-line, for those who wish to use a cron job or other script-based task running to run Roller tasks instead of running them inside the Java VM. The main benefit of using TaskRunner is that it does not require you to list all of the Roller jars in the classpath, instead you just specify the webapp dir and a secondary lib directory for JDBC jars etc. See rollertask.sh for an example of how to run

      The problem

      TaskRunner was working in Roller 3.x, but the scheduled task changes in Roller 4.0 broke the TaskRunner because all Roller tasks now extend RollerTaskWithLeasing, which expects Roller to be bootstrapped. If we have to bootstrap Roller first, in TaskRunner – then TaskRunner will need the full Roller classpath, which defeats its purpose.

      If we add the following code to RollerTaskWithLeasing we can ensure that Roller is bootstrapped before the task is run.

      public final void run() {

      if (!WebloggerFactory.isBootstrapped()) {
      try

      { WebloggerStartup.prepare(); WebloggerFactory.bootstrap(); }

      catch (Throwable ex)

      { log.error("ERROR bootstrapping Roller", ex); throw new RuntimeException("ERROR bootstrapping Roller", ex); }

      }

      But that's not the only problem...

      I'm working on fixing this, and have just committed some related fixes in the rollertask example.

      Attachments

        Activity

          People

            gmazza Glen Mazza
            djohnson David Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: