Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-6432

[GSS](7.0.z) NullPointerException at org.apache.cxf.common.jaxb.JAXBUtils.createJAXBContextProxy

    XMLWordPrintable

Details

    • Hide

      0. Extract the attached reproducer cxf-npe-reproducer.tar.gz

      1. Build and deploy two applications

      • helloworld-ws : Hello World JAX-WS Web service Application (based on JBoss EAP QuickStarts)
      • servlet-wsclient : Web Services Client on Servlet

      2. Place the following byteman rule as /tmp/byteman-script.btm
      You can use byteman-script.btm in the attached cxf-npe-reproducer.tar.gz

      RULE org.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemas_init_ENTRY
      CLASS org.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemas
      METHOD <init>
      AT ENTRY
      IF TRUE
      DO
          System.gc();
      ENDRULE
      

      3. Add the following to $JBOSS_HOME/bin/standalone.conf to enable byteman
      Note: Make sure to tune BYTEMAN_HOME to point a byteman install location

      BYTEMAN_RULE=/tmp/byteman-script.btm
      BYTEMAN_HOME=/path/to/your/byteman
      BYTEMAN_OPTS="-javaagent:$BYTEMAN_HOME/lib/byteman.jar=listener:false,boot:$BYTEMAN_HOME/lib/byteman.jar"
      if [ "x$BYTEMAN_RULE" != "x" ]; then
         BYTEMAN_OPTS="${BYTEMAN_OPTS},script:$BYTEMAN_RULE"
      fi
      BYTEMAN_OPTS="$BYTEMAN_OPTS -Dorg.jboss.byteman.transform.all -Dorg.jboss.byteman.debug"
      # BYTEMAN_OPTS="$BYTEMAN_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman"
      JAVA_OPTS="$BYTEMAN_OPTS $JAVA_OPTS"
      

      4. Set IBM JDK 8 as JAVA_HOME. For example:

      export JAVA_HOME=/usr/lib/jvm/java-1.8.0-ibm.x86_64"
      

      5. Start JBoss EAP

      ./bin/standalone.sh
      

      6. Access Web Services Client Servlet

      curl -v http://localhost:8080/jboss-servlet-wsclient/client
      
      Show
      0. Extract the attached reproducer cxf-npe-reproducer.tar.gz 1. Build and deploy two applications helloworld-ws : Hello World JAX-WS Web service Application (based on JBoss EAP QuickStarts) servlet-wsclient : Web Services Client on Servlet 2. Place the following byteman rule as /tmp/byteman-script.btm You can use byteman-script.btm in the attached cxf-npe-reproducer.tar.gz RULE org.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemas_init_ENTRY CLASS org.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemas METHOD <init> AT ENTRY IF TRUE DO System .gc(); ENDRULE 3. Add the following to $JBOSS_HOME/bin/standalone.conf to enable byteman Note: Make sure to tune BYTEMAN_HOME to point a byteman install location BYTEMAN_RULE=/tmp/byteman-script.btm BYTEMAN_HOME=/path/to/your/byteman BYTEMAN_OPTS= "-javaagent:$BYTEMAN_HOME/lib/byteman.jar=listener: false ,boot:$BYTEMAN_HOME/lib/byteman.jar" if [ "x$BYTEMAN_RULE" != "x" ]; then BYTEMAN_OPTS= "${BYTEMAN_OPTS},script:$BYTEMAN_RULE" fi BYTEMAN_OPTS= "$BYTEMAN_OPTS -Dorg.jboss.byteman.transform.all -Dorg.jboss.byteman.debug" # BYTEMAN_OPTS= "$BYTEMAN_OPTS -Djboss.modules.system.pkgs=org.jboss.byteman" JAVA_OPTS= "$BYTEMAN_OPTS $JAVA_OPTS" 4. Set IBM JDK 8 as JAVA_HOME. For example: export JAVA_HOME=/usr/lib/jvm/java-1.8.0-ibm.x86_64" 5. Start JBoss EAP ./bin/standalone.sh 6. Access Web Services Client Servlet curl -v http: //localhost:8080/jboss-servlet-wsclient/client
    • EAP 7.0.6

    Description

      The following NullPointerException rarely happens in Web Service application.

      This phenomenon occurs when Full GC happens before calling CachedContextAndSchemasInternal#getContext() in a constructor of org.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemas. WeakReference<JAXBContext> context inside org.apache.cxf.common.jaxb.JAXBContextCache$CachedContextAndSchemasInternal is cleared at the Full GC then CachedContextAndSchemasInternal#getContext() returns null.

      As far as I tested, this issue can not be reproducible with OpenJDK/Oracle JDK but it was reproducible with IBM JDK.

      ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /jboss-servlet-wsclient/client: java.lang.NullPointerException
      	at org.apache.cxf.common.jaxb.JAXBUtils.createJAXBContextProxy(JAXBUtils.java:1500)
      	at org.apache.cxf.jaxb.JAXBDataBinding.checkForJAXBAnnotations(JAXBDataBinding.java:412)
      	at org.apache.cxf.jaxb.JAXBDataBinding.justCheckForJAXBAnnotations(JAXBDataBinding.java:406)
      	at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:342)
      	at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
      	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:423)
      	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:525)
      	at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)
      	at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)
      	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:493)
      	at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.createPort(ProviderImpl.java:578)
      	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:343)
      	at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:338)
      	at javax.xml.ws.Service.getPort(Service.java:168)
      	at org.jboss.as.quickstarts.wshelloworld.Client.<init>(Client.java:44)
      	at org.jboss.as.quickstarts.wshelloworld.WSClientServlet.doGet(WSClientServlet.java:97)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
      	at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
      	at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
      	at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
      	at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
      	at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
      	at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
      	at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
      	at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
      	at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
      	at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)
      	at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
      	at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
      	at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
      	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
      	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.lang.Thread.run(Thread.java:785)
      

      Note: this issue is originally reported as https://bugzilla.redhat.com/show_bug.cgi?id=1384856 in EAP 6.4 (CXF 2.7.x). Same issue is still reproducible in EAP 7.0.x (CXF 3.1.x).

      Attachments

        Issue Links

          Activity

            People

              rhn-support-asoldano Alessio Soldano
              rhn-support-mmiura Masafumi Miura
              Peter Mackay Peter Mackay
              Peter Mackay Peter Mackay
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: