Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4947

Potential problems with the JAXBContext being null

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.7.4, 2.6.7
    • 2.6.8, 2.7.5, 2.5.11
    • JAXB Databinding
    • None
    • Unknown

    Description

      I post a mail to mail list to describe this. And Daniel fixed it very quickly. I still open this JIRA to record this issue, so that I can get a numbered patch merging to my runtime. Thanks.


      hi devs,
      I found some intermittent NullpointerException, and it is very hard to reproduce but I did have met a lot of times, and it is thrown from different places from runtime:
      Stack Dump = java.lang.NullPointerException
      at org.apache.cxf.common.jaxb.JAXBUtils.generateJaxbSchemas(JAXBUtils.java:765)
      at org.apache.cxf.jaxb.JAXBDataBinding.generateJaxbSchemas(JAXBDataBinding.java:440)
      at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:363)
      at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
      at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:469)
      at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:690)
      at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:531)
      at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:247)

      After checking the codes, they are all about the jaxbcontext is null.
      From the JAXBContextCache.CachedContextAndSchemas, I notice this line:
      private WeakReference<JAXBContext> context;

      IMHO, WeakReference is not a good choice to do cache, it could be gc in any time. For example,
      JAXBContextCache.getCachedContextAndSchemas(..)
      <gc>
      ctx = cachedContextAndSchemas.getContext() <-- then the ctx will be null here

      So I guess this is the root cause of the intermittent issue.

      Attachments

        1. r1464133_for_trunk.diff
          5 kB
          Lei Wang
        2. r1464141_for_br2.6.x.diff
          5 kB
          Lei Wang
        3. r1464185_for_br2.6.x.diff
          0.7 kB
          Lei Wang
        4. r1464632_for_br2.6.x.diff
          2 kB
          Lei Wang
        5. r1464627_for_tr.diff
          2 kB
          Lei Wang
        6. CXF-4947.patch
          6 kB
          Lei Wang
        7. CXF-4947-2.patch
          4 kB
          Lei Wang

        Issue Links

          Activity

            People

              dkulp Daniel Kulp
              rwonly Lei Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: