cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nicolas de loof" <nico...@apache.org>
Subject Re: could the cxf-codegen-plugin use a parent-last classloader to avoid conflict with Java6 JAXB 2.0 API ?
Date Fri, 22 Aug 2008 10:27:21 GMT
Something like this ...

/**
 * A custom ClassLoader to hidde the system classloader JAXB-API that may
 * be incompaible with requirement for JAXB-2.1
 */
public class OverrideJaxbApiClassLoader extends URLClassLoader {

    /** A dedicated classloader to access the JAXB 2.1 API */
    private URLClassLoader jaxbApiClassloader;

    public OverrideJaxbApiClassLoader(URL jaxbApiURL, URL[] urls,
ClassLoader parent) {
        super(urls, parent);
        jaxbApiClassloader = new URLClassLoader(new URL[] {jaxbApiURL});
    }

    protected synchronized Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException {
        if (name.startsWith("javax.xml.bind")) {
            return jaxbApiClassloader.loadClass(name);
        } else {
            return super.loadClass(name, resolve);
        }
    }
}

2008/8/22 nicolas de loof <nicolas@apache.org>

> I'm trying to use CXF 2.1.2 codegen, my dev environment beeing based on
> jrockit 6.0 - that includes jaxb 2.0 API (as SUN java 6 did prior to update
> ? )
> I get a generation error (with a nice message) due to requirement for JAXB
> 2.1, but JAXB 2.0 beeing loaded from bootclasspath.
>
> As the cxf-codegen-plugin setup it's custom URLClassLoader with project
> classes and dependencies, could it setup a "parent-last" strategy to avoid
> such conflict ?
>
> Nicolas.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message