On 05/06/2015 02:20 PM, Jesse Glick wrote:
Well the fact that you are talking about a ClassNotFoundException,
rather than a NoClassDefFoundError (with a ClassNotFoundException as
its root cause), is a red flag. That implies that something—your
code—is loading a class reflectively rather than statically, and
presumably passing the wrong ClassLoader. Perhaps your library makes
the shoddy assumption that
Thread.currentThread().getContextClassLoader() can be used to load its
own classes (which would*not* be true for code loaded in a Jenkins
plugin).
The problem seems to be that I am using JNDI to load the class as part
of the InitialContext constructor:
Properties props = new Properties();
props.setProperty("java.naming.factory.initial",
"org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
props.setProperty("connectionfactory.qpidConnectionfactory", url);
return new InitialContext(props);
And then I end up with this:
javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.qpid.jndi.PropertiesFileInitialContextFactory [Root exception
is java.lang.ClassNotFoundException:
org.apache.qpid.jndi.PropertiesFileInitialContextFactory]
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:307)
at javax.naming.InitialContext.init(InitialContext.java:242)
at javax.naming.InitialContext.<init>(InitialContext.java:216)
............................
This seems to be a pretty standard way to set up the initial context for
JNDI, and it works outside of my plugin.
Is there another way to do this?
Thanks,
-- Greg
--
You received this message because you are subscribed to the Google Groups "Jenkins
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/554B4D34.6060402%40redhat.com.
For more options, visit https://groups.google.com/d/optout.