Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-13540

Scheduler Plugin uses the wrong class loader

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.4.4
    • Fix Version/s: 8.2-rc-1, 7.4.5
    • Component/s: Scheduler
    • Labels:
      None
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      The scheduler plugin uses:

      Class.forName(object.getStringValue("jobClass")
      

      ...to instantiate job classes (when it's a java job). However, the result is that it ends up using the container's default class loader (that only looks in the WEB-INF/lib folder) instead of using the current thread's class loader (that is extended by XWiki to also look at extensions installed with Extension Manager).

      The solution, as suggested by Thomas Mortagne is to use the following instead:

      Class.forName(object.getStringValue("jobClass"), true, Thread.currentThread().getContextClassLoader()) 
      

      ...and explicitly specify that it should use the current thread's class loader.

        Attachments

          Activity

            People

            • Assignee:
              enygma Eduard Moraru
              Reporter:
              enygma Eduard Moraru
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: