Can I trust the xjc version?

I spent a day debugging a problem with JAXB to get the namespace wrong or missing (maybe due to Marshaller.JAXB_FRAGMENT, but it is not).

I found that the problem is with JAXB RI 2.1.10 in my approved directory.

Fixed if I use JAXB RI 2.2.4 or 2.2.6

This is what really confuses (and what made it take so long).

The problem occurs on Linux with JAXB in the following JDK (i.e. nothing is supported):

$ java -version
java version "1.7.0_03"
OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu2)
OpenJDK 64-Bit Server VM (build 22.0-b10, mixed mode)

$ xjc -version
xjc 2.2.4

but it should work fine if this java really uses the same JAXB as RI 2.2.4!

Please note that the problem I was debugging has nothing to do with xjc; I just use this command to try to figure out which version of JAXB I am using.

, Windows Java 1.6.0_27 ( ), :

C:\Program Files\Java\jdk1.6.0_27\bin>java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)

C:\Program Files\Java\jdk1.6.0_27\bin>xjc -version
xjc version "JAXB 2.1.10 in JDK 6"
JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build JAXB 2.1.10 in JDK 6)

, 2.1.10 RI , . 1.6.0_27, JAXB RI 2.1.10.

, , , ​​ - 2.1.10 2.2.4, 2 VM JAXB, . , , xjc, , , jaxb-api.jar jaxb-impl.jar( , , ).

Win 7 Ubuntu, tomcat ( ) eclipse (no tomcat), , .

- - , ?

, - , JAXB JDK Sun/Oracle?

+5
1

xjc -version ?

. XJC.


xjc -version , JAXB (JSR-222) ?

NO:


JAXB RI JAXB Impl JDK/JRE

Java SE ( 6 ) JAXB (JSR-222). ( ) , JAXB RI. , :

import javax.xml.bind.JAXBContext;

public class Demo {

    public static void main(String[] args) throws Exception {
        JAXBContext jc = JAXBContext.newInstance(Demo.class);
        System.out.println(jc.getClass());
    }

}

:

class com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl

JAXB-RI -, :

class com.sun.xml.bind.v2.runtime.JAXBContextImpl
+4

All Articles