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

NullPointerException at org.apache.cxf.transport.TransportURIResolver when the WSDL is not found instead of an exception with a useful message

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.4
    • Fix Version/s: 2.2.8
    • Component/s: None
    • Labels:
      None

      Description

      I get bit by this every time so you would I think I would learn: You get a NullPointerException at org.apache.cxf.transport.TransportURIResolver when the WSDL is not found instead of an Exception with a useful message,

      For example:

      WSDLServiceFactory factory = new WSDLServiceFactory(BusFactory.newInstance().createBus(), wsdlUrlString.trim(), null);

      Where wsdlUrlString points to a resource that is not there, in my case a resource on disk that is not there.

      java.lang.NullPointerException
      	at org.apache.cxf.transport.TransportURIResolver.resolve(TransportURIResolver.java:109)
      	at org.apache.cxf.catalog.CatalogWSDLLocator.getBaseInputSource(CatalogWSDLLocator.java:72)
      	at org.apache.cxf.wsdl11.AbstractWrapperWSDLLocator.getBaseInputSource(AbstractWrapperWSDLLocator.java:57)
      	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
      	at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:210)
      	at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:175)
      	at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:91)
      	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf$ValidatingInterceptor.initValidatingInterceptor(SoapServletCxf.java:952)
      	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf$ValidatingInterceptor.addBefore(SoapServletCxf.java:931)
      	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf.initValidators(SoapServletCxf.java:1303)
      	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf.init(SoapServletCxf.java:1262)
      	at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
      	at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:322)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
      	at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)
      

      I can see in TransportURIResolver, that there is a null check for base but that the last if in the method is not guarded for a null base

      Can we get a exception thrown with a URI not found or some such?

        Attachments

          Activity

            People

            • Assignee:
              dkulp Daniel Kulp
              Reporter:
              ggregory Gary D. Gregory
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: