1. JAXB 2.0 | ||
Q: | Which version of Java SE does Eclipse Implementation of JAXB 4.0.1 require? | |
A: | Java SE 11 or higher. | |
Q: | Can I run my existing JAXB 1.x/2.x applications on the Eclipse Implementation of JAXB runtime? | |
A: | This is not supported. | |
Q: | What if I want to port my JAXB 1.x/2.x application to Jakarta XML Binding runtime? | |
A: | You need to replace references to | |
Q: | Where are | |
A: | They are included only in the zip distribution. | |
Q: | Are the Jakarta XML Binding runtime API's thread safe? | |
A: | The Jakarta XML Binding Specification currently does not address
the thread safety of any of the runtime classes. In the
case of the Eclipse Implementation of JAXB, the
For example, suppose you have a multi-thread server
application that processes incoming XML documents by Jakarta XML Binding.
In this case, for the best performance you should have
just one instance of class MyServlet extends HttpServlet { static final JAXBContext context = initContext(); private static JAXBContext initContext() { return JAXBContext.newInstance("....", MyServlet.class.getClassLoader()); } } And each time you need to unmarshal/marshal/validate
a document. Just create a new
public void doGet(HttpServletRequest req, HttpServletResponse resp) { Unmarshaller u = context.createUnmarshaller(); u.unmarshal(...); } This is the simplest safe way to use the Eclipse Implementation of JAXB from multi-threaded applications. If you really care about the performance, and/or
your application is going to read a lot of small
documents, then creating | |
Q: | Why can't I cast the unmarshalled object into the generated type. | |
A: | When you invoke
Figure 1. Parent/Child classloader
With some applications, things get even more
complicated when the Jakarta XML Binding-generated code can be loaded by
either classloader. In this case,
The solution for both situations is to pass your curent class loader like this: JAXBContext.newInstance("aaa.bbb.ccc", this.getClass().getClassLoader()); In general, if you are writing code that uses Jakarta XML Binding, it is always better to explicitly pass in a class loader, so that your code will work no matter where it is deployed. | |
Q: | Which jar files do I need to distribute with my application that uses the Eclipse Implementation of JAXB? | |
A: |
$JAXB_HOME/mod/jakarta.xml.bind-api.jar $JAXB_HOME/mod/jakarta.activation-api.jar $JAXB_HOME/mod/angus-activation.jar $JAXB_HOME/mod/jaxb-core.jar $JAXB_HOME/mod/jaxb-impl.jar
| |
Q: | How can I cause the | |
A: | This functionality is not available from Eclipse Implementation of JAXB
directly, but you can configure an Apache Xerces-J
| |
Q: | Can I access <xs:any/> as a DOM node? | |
A: | In Eclipse Implementation of JAXB, <xs:any/> is handled correctly without any customization.
| |
Q: | How do I find out which version of the Eclipse Implementation of JAXB I'm using? | |
A: | Run the following command $ java -jar jaxb-xjc.jar -version Alternatively, each Eclipse Implementation of JAXB jar has version information
in its Manifest-Version: 1.0 Specification-Title: Jakarta XML Binding Specification-Version: 4.0 Specification-Vendor: Eclipse Foundation Implementation-Title: Eclipse Implementation of JAXB Implementation-Version: 4.0.1 Implementation-Vendor: Eclipse Foundation Implementation-Vendor-Id: org.eclipse Build-Id: 2022-05-18 22:33 Class-Path: jaxb-core.jar jaxb-impl.jar |