+

Search Tips   |   Advanced Search

Reducing the time required to create the JAXBContext

A search of the classloader for potential JAXB classes is performed every time a web services application is started. If the search process for the application is lengthy, there are ways to reduce the amount of time the system spends creating the JAXBContext for the application.

Creation of the JAXBContext object can be divided into three steps.

  1. Create the list of packages that might contain JAXB classes. The list is created based on the contents of the WSDL and annotations.

    There are no options to reduce the time required to create the list of packages. However, it is important to know that some corner cases and unique usage scenarios, might cause a package that does not contain JAXB classes to be included in the package list. Following is an example of a trace message that indicates a package is included that does not contain any JAXB classes:

    Here is an example trace that indicates this situation12/2/11 6:24:40:548 PST] 0000003e JAXBUtils 1 org.apache.axis2.jaxws.message.databinding.JAXBUtils createJAXBContextValue Package com.company.queryall.v1 does not have any JAXB classes. It is removed from the JAXB context path.
    

    For each occurrence of this message, we should include an empty jaxb.index file in the package to indicate that there are no JAXB classes. If this action is not taken, the time consuming JAXB class search occurs.

  2. Determining the signature of JAXBContext.newInstance() to be started. Because JAXBContext.newInstance() can be started with either a list of packages, or a list of JAXB classes, we must decide which approach to use based on your goals.

  3. Starting the JAXBContext.newInstance() which actually creates the JAXBContext object.

Completing the following actions might reduce the amount of time required to create the JAXBContext

  • Web services specifications and APIs
  • Java virtual machine custom properties