static private class HackLoader
extends ClassLoader
{
private ClassLoader loader_;
HackLoader(ClassLoader loader)
{
loader_ = loader;
}
public Class loadClass(String name)
throws ClassNotFoundException
{
return loader_.loadClass(name);
}
public java.net.URL getResource(String name)
{
// jaxb looking for resources with
backslashes not forward slashes...
return
loader_.getResource(name.replace('\\','/'));
}
public java.io.InputStream
getResourceAsStream(String name)
{
return
loader_.getResourceAsStream(name.replace('\\','/'));
}
}
I passed an instance of the above classloader
instantiated with X.class.getClassLoader() to the
JAXBContext. This was done from within class X
where X was in the jar/ear that contained the jaxb
generated classes.
--- Sriram Thyagarajan
<Sriram_Thyagarajan_at_KEANE-NNE.com> wrote:
> I joined the list recently. How do I overcome this
> problem(if there was some
> workaround already suggested) ?
>
> Yes I have jaxb-ri.jar in the class path.
>
>
> -----Original Message-----
> From: Zhidong Zhao [mailto:zzhao_at_CS.UNO.EDU]
> Sent: Thursday, February 06, 2003 12:58 PM
> To: JAXB-INTEREST_at_JAVA.SUN.COM
> Subject: Re: com.sun.xml.bind.ContextFactory could
> not be instantiated
> exc eption
>
>
> Eventhough jaxb-ri.jar is in library, this problem
> may also occur.
> As I mentioned in the previous post.
>
>
>
> Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM> wrote:
>
> >I think this is because you don't have the runtime
> jar file in your
> >classpath. Do you have jaxb-ri.jar in your
> classpath?
> >
> >regards,
> >--
> >Kohsuke KAWAGUCHI 408-276-7063
> (x17063)
> >Sun Microsystems
kohsuke.kawaguchi_at_sun.com
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com