Uploaded image for project: 'Commons Daemon'
  1. Commons Daemon
  2. DAEMON-351

Context class loader of stopping thread is null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 1.0.15
    • None
    • Procrun
    • None
    • Windows 10 x64, Java 1.8.x.

    • Patch

    Description

      I don't know who is responsible for setting context class loader for current thread when starting and stopping service/app, but it's not set (is null) when stopping service.

      I am using jvm mode and main method in both cases (when starting and stopping).
      Example output in main method:

      //output is sun.misc.Launcher$AppClassLoader@c387f44 when starting service
      //output is null when stoping service
      System.out.println(Thread.currentThread().getContextClassLoader());

      This causes a problem when i need to load classes from app defined classpath in stopping process.

      So, i was forced to manually get classloader instance when starting service, and set the same classloader instance when stoping a service.

      //starting:
      classLoader = Thread.currentThread().getContextClassLoader();

      //stoping:
      Thread.currentThread().setContextClassLoader(classLoader);

      Attachments

        Activity

          People

            Unassigned Unassigned
            okanovic.eldin Eldin Okanovic
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: