OK, I will do that and let you know what I find tomorrow.
In the meantime, to answer your other questions:
- Java version
Java 11
- OS
Windows
- PF4J version
3.4.1
Thanks for helping me with this…
Regards,
Rob
Rob McDougall | Senior Technical Architect | 4Point | +1.613.907.6415 | www.4Point.com
Receive our news and announcements before anyone else - follow us on:
--
You received this message because you are subscribed to a topic in the Google Groups "pf4j" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/pf4j/u5CONBO0odI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
pf4j+uns...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/pf4j/3f6d3232-343e-49f0-ae71-316874b511can%40googlegroups.com.
I've attached the whole log, but I think the important section is here:
2020-11-10 10:31:57.083 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Found class 'com.filenet.apiimpl.core.UserPasswordToken$1' in PLUGIN classpath
2020-11-10 10:31:57.083 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Received request to load class 'javax.security.auth.login.LoginContext'
2020-11-10 10:31:57.083 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Couldn't find class 'javax.security.auth.login.LoginContext' in PLUGIN classpath
2020-11-10 10:31:57.084 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Search in dependencies for class 'javax.security.auth.login.LoginContext'
2020-11-10 10:31:57.084 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Couldn't find class 'javax.security.auth.login.LoginContext' in DEPENDENCIES classpath
2020-11-10 10:31:57.085 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Found class 'javax.security.auth.login.LoginContext' in APPLICATION classpath
2020-11-10 10:31:57.085 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Received request to load class 'com.filenet.apiimpl.core.UserPasswordCallback'
2020-11-10 10:31:57.086 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Found class 'com.filenet.apiimpl.core.UserPasswordCallback' in PLUGIN classpath
2020-11-10 10:31:57.087 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Received request to load class 'com.filenet.apiimpl.util.ApiToEngineBridge'
2020-11-10 10:31:57.088 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Found class 'com.filenet.apiimpl.util.ApiToEngineBridge' in PLUGIN classpath
(Exception occurs here, I think)
2020-11-10 10:31:57.169 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Received request to load class 'com.filenet.api.exception.ExceptionCode'
2020-11-10 10:31:57.185 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Received request to load class 'com.filenet.apiimpl.util.LString'
2020-11-10 10:31:57.186 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Found class 'com.filenet.apiimpl.util.LString' in PLUGIN classpath
2020-11-10 10:31:57.186 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Found class 'com.filenet.api.exception.ExceptionCode' in PLUGIN classpath
2020-11-10 10:31:57.202 TRACE 26252 --- [http-nio-8080-exec-1] org.pf4j.PluginClassLoader : Received request to load class 'com.filenet.api.exception.ErrorLoggingLevel'
I’ve also done some investigation and the code that appears to be throwing the exception (based on the stack trace) is this (from javax.security.auth.login.LoginContext):
if (moduleStack[i].module == null) {
try {
@SuppressWarnings("deprecation")
Object tmp = Class.forName(name, false, contextClassLoader).newInstance();
moduleStack[i].module = (LoginModule) tmp;
if (debug != null) {
debug.println(name + " loaded via reflection");
}
} catch (ClassNotFoundException e) {
throw new LoginException("No LoginModule found for "
+ name);
}
}
The contextClassLoader is initialized with this code (also from javax.security.auth.login.LoginContext): });
contextClassLoader = java.security.AccessController.doPrivileged
(new java.security.PrivilegedAction<ClassLoader>() {
public ClassLoader run() {
ClassLoader loader =
Thread.currentThread().getContextClassLoader();
if (loader == null) {
// Don't use bootstrap class loader directly to ensure
// proper package access control!
loader = ClassLoader.getSystemClassLoader();
}
return loader;
}
});
I don’t have a lot of experience with class loaders, but I’m assuming that it’s using the system class loader and that is why it is not finding the class in the plugin.
--
You received this message because you are subscribed to the Google Groups "pf4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pf4j+uns...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/pf4j/YTBPR01MB2559C5A04DF96E8A0FC3A12BCAE90%40YTBPR01MB2559.CANPRD01.PROD.OUTLOOK.COM.
Based on the research I’ve done, I think I’m going to need to modify the class loading strategy. It looks like the PluginClassLoader is not the loader looking for the class and that’s why it is not being found.
Any idea how I can make a class contained in the plugin available to the System class loader?
OK, I seem to have worked around the issue by performing the following:
this.prevClassLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); // Set the context classloader to the my classloader.
Later on, I set it back to the original setting before returning back from the plugin.