Reputation: 18266
It would seem that Class.getResource() uses the Class class loader and ignores the Thread context class loader which is not what i want. Any tipson how toget around this ?
Upvotes: 1
Views: 1023
Reputation: 18266
The question was tehe result of a bad classloader where my class loader did not override getResourceAsStream(). Once that was implemented things just work :)
I ended up overriding ObjectInputStream.readResolve() to use a provider that is passed to the ctor.
thankx all
Upvotes: 1
Reputation: 40333
Just go and get the current thread class loader and run the getResource on it:
Thread.currentThread().getContextClassLoader().getResourceAsStream( "path-to-resource.here" );
Upvotes: 1