I'm trying to use JAXB to generate corresponding Java class file from the xsd file.
When I ran xjc.sh, an error popped:
"Exception in thread "main" java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/globalhome/yiligong/software/jaxb-ri-20070125/lib/jaxb-impl.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)"
The solutions might be:
1. Use Java endorsed mechanism to override whats in Java platform. See http://java.sun.com/j2se/1.5.0/docs/guide/standards/ for more details on Endorsed Standards Override Mechanism.
2. Simply copy jaxb-api.jar to
3. Since I have no root privilege, I added "-Djava.endorsed.dirs=/globalhome/yiligong/software/jaxb-ri-20070125/lib" into the last line of xjc.sh, i.e. exec "$JAVA" $XJC_OPTS -Djava.endorsed.dirs=/globalhome/yiligong/software/jaxb-ri-20070125/lib -jar "$JAXB_HOME/lib/jaxb-xjc.jar" "$@".
A JAXB 2.1 tutorial:
http://www.javaworld.com/javaworld/jw-06-2006/jw-0626-jaxb.html?page=1