Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
1.0.15
-
None
-
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);