Web Service client rarely got NullPointerException inside Apache CXF code included in EAP 6.x and 7.x
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.x
- 7.x
- Apache CXF
Issue
Web Service client rarely failed with the following NullPointerException in Apache CXF included in EAP 6.x and 7.x:
java.lang.NullPointerException
at org.apache.cxf.common.jaxb.JAXBUtils.createJAXBContextProxy(JAXBUtils.java:1425)
at org.apache.cxf.jaxb.JAXBDataBinding.checkForJAXBAnnotations(JAXBDataBinding.java:433)
at org.apache.cxf.jaxb.JAXBDataBinding.justCheckForJAXBAnnotations(JAXBDataBinding.java:427)
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.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:446)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:548)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:478)
at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.java:558)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:329)
at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:324)
at javax.xml.ws.Service.getPort(Service.java:168) [jboss-jaxws-api_2.2_spec-2.0.2.Final-redhat-1.jar:2.0.2.Final-redhat-1]
...(snip)...
Resolution
This issue is a bug reported in the following bugzila and JIRAs:
- EAP 6.4.x: [Bug 1384856 – This content is not included.GSS NullPointerException at org.apache.cxf.common.jaxb.JAXBUtils.createJAXBContextProxy](https://bugzilla.redhat.com/show_bug.cgi?id=1384856)
- EAP 7.0.z: [[JBEAP-6432] This content is not included.GSS NullPointerException at org.apache.cxf.common.jaxb.JAXBUtils.createJAXBContextProxy](https://issues.jboss.org/browse/JBEAP-6432)
- EAP 7.1.0: [[JBEAP-6433] This content is not included.GSS NullPointerException at org.apache.cxf.common.jaxb.JAXBUtils.createJAXBContextProxy](https://issues.jboss.org/browse/JBEAP-6433)
- Upstream: Content from issues.apache.org is not included.[CXF-7166] NullPointerException at org.apache.cxf.common.jaxb.JAXBUtils.createJAXBContextProxy with IBM-JDK 8 - ASF JIRA
Please upgrade to the following releases when it's is available:
- This content is not included.EAP 6.4 CP14 (6.4.14) or later
- This content is not included.EAP 7.0 CP6 (7.0.6) or later
- EAP 7.1.0
Root Cause
- This phenomenon occurs when Full GC happens before calling
CachedContextAndSchemasInternal#getContext()in a constructor oforg.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemas. "WeakReference<JAXBContext> context" insideorg.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemasInternalis cleared at the Full GC andCachedContextAndSchemasInternal#getContext()returns null.
SBR
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.