cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rex Wang (JIRA)" <>
Subject [jira] [Created] (CXF-4947) Potential problems with the JAXBContext being null
Date Thu, 04 Apr 2013 16:07:15 GMT
Rex Wang created CXF-4947:

             Summary: Potential problems with the JAXBContext being null
                 Key: CXF-4947
             Project: CXF
          Issue Type: Bug
          Components: JAXB Databinding
    Affects Versions: 2.6.7, 2.7.4
            Reporter: Rex Wang
             Fix For: 2.6.8, 2.7.5

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.

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(
    at org.apache.cxf.jaxb.JAXBDataBinding.generateJaxbSchemas(
    at org.apache.cxf.jaxb.JAXBDataBinding.initialize(
    at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(

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,
ctx = cachedContextAndSchemas.getContext()    <-- then the ctx will be null here

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

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message