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

[GSS](7.1.z) Cannot register web service, fails with NullPointerException in DelegateClassLoader

XMLWordPrintable

    • Hide

      Cannot be reproduced without the original source code, which is too big and I cannot upload any part of it or of the WSDL file. I guess I could send privately the wsdl file if needed.
      But I have tracked down what looks like a bug in the library jbossws-common-3.1.5.Final.jar, and I (think I) have fixed the problem in the jbossws-common-3.2.1 (master) one. With the fix the exception is not thrown any more. Please see fix in the description.

      Show
      Cannot be reproduced without the original source code, which is too big and I cannot upload any part of it or of the WSDL file. I guess I could send privately the wsdl file if needed. But I have tracked down what looks like a bug in the library jbossws-common-3.1.5.Final.jar , and I (think I) have fixed the problem in the jbossws-common-3.2.1 (master) one. With the fix the exception is not thrown any more. Please see fix in the description.

      While deploying a EAR application, which contains a WAR which is trying to register a web service, I get the follwing exception:

      13:53:34,624 INFO  [org.jboss.ws.cxf.deployment] (MSC service thread 1-7) JBWS024074: WSDL published to: file:/home/achirizzi/sandbox/dev/wildfly/wildfly-11.0.0.Final/standalone/data/wsdl/dms-new-ear-services-0.0.8.1.ear/dms-new-war-0.0.7.1.war/BusinessWebServiceService.wsdl
      13:53:34,658 WARNING [org.apache.cxf.catalog.OASISCatalogManager] (MSC service thread 1-7) Catalog found at jar:file:/home/achirizzi/sandbox/dev/wildfly/wildfly-11.0.0.Final/modules/system/layers/base/org/jboss/ws/jaxws-client/main/jbossws-cxf-client-5.1.9.Final.jar!/META-INF/jax-ws-catalog.xml but no org.apache.xml.resolver.CatalogManager was found.  Check the classpatch for an xmlresolver jar.
      13:53:34,659 WARNING [org.apache.cxf.catalog.OASISCatalogManager] (MSC service thread 1-7) Catalog found at jar:file:/home/achirizzi/sandbox/dev/wildfly/wildfly-11.0.0.Final/modules/system/layers/base/org/apache/cxf/impl/main/cxf-tools-wsdlto-frontend-jaxws-3.1.12.jar!/META-INF/jax-ws-catalog.xml but no org.apache.xml.resolver.CatalogManager was found.  Check the classpatch for an xmlresolver jar.
      13:53:34,659 WARNING [org.apache.cxf.catalog.OASISCatalogManager] (MSC service thread 1-7) Catalog found at jar:file:/home/achirizzi/sandbox/dev/wildfly/wildfly-11.0.0.Final/modules/system/layers/base/org/apache/cxf/impl/main/cxf-services-ws-discovery-api-3.1.12.jar!/META-INF/jax-ws-catalog.xml but no org.apache.xml.resolver.CatalogManager was found.  Check the classpatch for an xmlresolver jar.
      13:53:34,773 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.subunit."dms-new-ear-services-0.0.8.1.ear"."dms-new-war-0.0.7.1.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.subunit."dms-new-ear-services-0.0.8.1.ear"."dms-new-war-0.0.7.1.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of subdeployment "dms-new-war-0.0.7.1.war" of deployment "dms-new-ear-services-0.0.8.1.ear"
      	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: javax.xml.parsers.FactoryConfigurationError: Provider __redirected.__DocumentBuilderFactory could not be instantiated: java.lang.NullPointerException
      	at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:204)
      	at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:152)
      	at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:232)
      	at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:120)
      	at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2180)
      	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2390)
      	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2422)
      	at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:238)
      	at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:163)
      	at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:85)
      	at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:217)
      	at org.apache.cxf.jaxws.ServiceImpl.initialize(ServiceImpl.java:160)
      	at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:129)
      	at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.<init>(ProviderImpl.java:574)
      	at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:258)
      	at javax.xml.ws.Service.<init>(Service.java:57)
      	at com.tullettprebon.dms.tmmalternativeaddress.ws.TMMMarkitWireService.<init>(TMMMarkitWireService.java:60)
      	at com.tullettprebon.dms.webservices.ReferenceWebService.<init>(ReferenceWebService.java:232)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at java.lang.Class.newInstance(Class.java:442)
      	at org.jboss.wsf.stack.cxf.configuration.BusHolder.newInstance(BusHolder.java:322)
      	at org.jboss.wsf.stack.cxf.configuration.BusHolder.configure(BusHolder.java:212)
      	at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.startDeploymentBus(BusDeploymentAspect.java:97)
      	at org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start(BusDeploymentAspect.java:59)
      	at org.jboss.as.webservices.deployers.AspectDeploymentProcessor.deploy(AspectDeploymentProcessor.java:73)
      	at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
      	... 5 more
      Caused by: java.lang.NullPointerException
      	at org.jboss.ws.common.utils.DelegateClassLoader.getResourceAsStream(DelegateClassLoader.java:132)
      	at __redirected.__RedirectedUtils.findProviderClassNames(__RedirectedUtils.java:147)
      	at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:102)
      	at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:98)
      	at __redirected.__DocumentBuilderFactory.<init>(__DocumentBuilderFactory.java:103)
      	at sun.reflect.GeneratedConstructorAccessor62.newInstance(Unknown Source)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at java.lang.Class.newInstance(Class.java:442)
      	at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:192)
      	... 33 more
      

      I wasted 3 days trying to find a solution thinking that the problem was in my dependencies with xerces or any other xml resolver.
      Then I decided to checkout the code near the root cause:

      Caused by: java.lang.NullPointerException
      	at org.jboss.ws.common.utils.DelegateClassLoader.getResourceAsStream(DelegateClassLoader.java:132)
      	at __redirected.__RedirectedUtils.findProviderClassNames(__RedirectedUtils.java:147)
      	at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:102)
      	at __redirected.__RedirectedUtils.loadProvider(__RedirectedUtils.java:98)
      	at __redirected.__DocumentBuilderFactory.<init>(__DocumentBuilderFactory.java:103)
      	at sun.reflect.GeneratedConstructorAccessor62.newInstance(Unknown Source)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at java.lang.Class.newInstance(Class.java:442)
      	at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:192)
      	... 33 more
      

      and I think I have fixed a bug in jbossws-common-3.1.5.
      I have downloaded the latest version of jbossws-common-master from github (with which the problem was still showing).

      Then I fixed the class org/jboss/ws/common/utils/DelegateClassLoader.java changing this:

         /** {@inheritDoc} */
         @Override
         public InputStream getResourceAsStream(final String name)
         {
            InputStream is = parent.getResourceAsStream(name);
            return (is == null) ? delegate.getResourceAsStream(name) : is;
         }
      

      to this:

         /** {@inheritDoc} */
         @Override
         public InputStream getResourceAsStream(final String name)
         {
            InputStream is = null;
            if (parent != null)
            {
              is = parent.getResourceAsStream(name);
            }
            return (is == null) ? delegate.getResourceAsStream(name) : is;
         }
      

      and then built again the jbossws-common jar and replaced the (suspected) faulty one under the WildFly modules. With the new jar the webservice can be registered.

              rhn-support-ivassile Ilia Vassilev
              rhn-support-bmaxwell Brad Maxwell
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: