It would seem that Class.getResource() uses the Class class loader and ignores the Thread context class loader which is not what i wan开发者_运维问答t. Any tipson how toget around this ?
Just go and get the current thread class loader and run the getResource on it:
Thread.currentThread().getContextClassLoader().getResourceAsStream( "path-to-resource.here" );
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
精彩评论