Hi, (forwarded to mailing list)
You can pass in a classloader as the second arg to ObjectReader (first arg can
be InputStream or Reader):
http://jsx.org/docs/JSX/ObjectReader.html#ObjectReader(java.io.InputStream,%20ja\
va.lang.ClassLoader)
http://jsx.org/docs/JSX/ObjectReader.html#ObjectReader(java.io.Reader,%20java.la\
ng.ClassLoader)
Or, you can use setContextClassLoader on the current thread:
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Thread.html#setContextClassLoa\
der(java.lang.ClassLoader)
eg:
Thread.currentThread().setContextClassLoader(myCL);
There's some discussion in the mailing list archives:
http://tech.groups.yahoo.com/group/JSX-ideas/msearch?query=setcontextclassloader\
&submit=Search&charset=ISO-8859-1
cheers,
Brendan
> I have one problem I might be able to resolve by using the -D option of java
> to change the default system class loader...the problem is that Jtest when
> running unit tests uses its own class loader but because the sun class
> loader is the default it means JSX uses Sun's but Jtest uses its own which
> means the same class is loaded twice and I get a class cast exception when
> casting an object i read from an xml file and pass as input to a junit test
> case.
>
> Is there any way for me to tell JSX to use a particular class loader apart
> from the default class loader?