-
-
Couldn't load subscription status.
- Fork 2k
Description
c.r.j.guice.impl.InjectorSourceFactory makes a call to Class#forName(String) to instantiate the InjectorSource named via the cucumber.properties file.
The call to Class#forName without the ClassLoader argument will use the calling class's ClassLoader to resolve the provided class name. However, if the class to be resolved is in a child ClassLoader, this call will fail to resolve the class. This fails in my enterprise app where the cucumber JARs are in the top-level ClassLoader, but the implementation of c.r.j.guice.InjectorSource is in a child ClassLoader.
Looking to the constructors of c.r.j.JavaBackend for inspiration, the typical way to "find" the ClassLoader when one is not explicitly provided is by calling Thread.currentThread().getContextClassLoader().
I will issue a PR shortly with this small, one-line fix to c.r.j.guice.impl.InjectorSourceFactory.
This is a subset of issue #880.