Hi Jesse, That set me on the right track. I was able to use your code snippet with minor modifications and have got it working.
Thanks for the help! -- Greg On Tuesday, February 25, 2014 11:11:32 AM UTC-5, Jesse Glick wrote: > > On Tue, Feb 25, 2014 at 10:06 AM, gallen <[email protected] <javascript:>> > wrote: > > constructor takes a properties file with the property > > 'java.naming.factory.initial', which indicates the class name of the > initial > > index factory. This class is contained in one of the jar files that I > have > > in my plugin project, and it appears the the InitialContext class tries > to > > load this class. > > I am not very familiar with JNDI but what you need to do is ask around > for a way to specify a particular ClassLoader that InitialContext > should look in. If there is not an explicit call to do this, sometimes > setting the thread context class loader can be used to work around a > poorly-designed API. So: > > ClassLoader orig = Thread.currentThread().getContextClassLoader(); > Thread.currentThread().setContextClassLoader(ThisPluginClass.class.getClassLoader()); > > > try { > doSomethingWithJNDI(); > } finally { > Thread.currentThread().setContextClassLoader(orig); > } > -- 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]. For more options, visit https://groups.google.com/groups/opt_out.
