users@jaxb.java.net

Re: _at_XmlSchema, package-info and weird classloaders

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 05 Oct 2006 21:01:46 -0700

Kenny MacLeod wrote:
> My question (yes, I do have one) is does JAXB depend on some specific
> classloading to find package-info? One-Jar uses a custom classloader,
> you see, so it might be interfering.

No. JAXB uses java.lang.Package to read the annotation, which is pretty
normal.

What I know is that if classloader implementation is sloppy, it may
forget to define packages, and that makes java.lang.Package unavailable.
I suspect that's what's going on. IOW, I think this is one-jar's problem.


> Is it possible to tell XJC to annotate each and every class with the
> namespace, rather than using package-info? Hopefully that will get
> around the problem.

Yes. Try "xjc -help" and it's right there. Pasted for your convenience
below:

> -npa : suppress generation of package level annotations (**/package-info.java)


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com