Mule
  1. Mule
  2. MULE-4920

Proxying POJO with simple frontend without specifying namespace throws NPE

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.4 (EE only), 2.2.5 (EE only), 3.0.0-M4
    • Fix Version/s: 2.2.6 (EE only)
    • Component/s: Modules: CXF
    • Labels:
      None
    • User impact:
      Low
    • Similar Issues:
      MULE-4288NPE when using CXF as webservice proxy with WSDL
      MULE-8509CXF Proxy-Client is throwing NullPointerException
      MULE-3239DefaultMuleMessage.toString throws NPE if MuleContext is unavailable
      MULE-8687Passing a JaxB annotated pojo to the HTTP listener response is throwing a transformer error
      MULE-3034NPE in ForwardingCatchAllStrategy without configured endpoint
      MULE-227AxisConnector throws misleading error message
      MULE-4102Proxy problems with large payloads
      MULE-3434CXF Transport doesn't work for frontend
      MULE-5728NPE if initialFacts-ref is not specified
      MULE-1492Asynchronous XFire example throws an NPE

      Description

      When an endpoint is configured like this:

      <cxf:inbound-endpoint address="http://localhost:8088/TestProxy" 
                            synchronous="true" 
                            proxy="true" 
                            endpointName="TestPOJOComponentPort"
                            serviceName="TestPOJOComponent" 
                            wsdlLocation="./TestProxyImpl.wsdl"
      />
      

      If the namespace parameter is not specified, then a NullPointerException is thrown at ProxyServiceConfiguration.getEndpointName() line: 49:

      return new QName(getServiceNamespace(), ((Port) definition.getService(
             getServiceFactory().getServiceQName()).getPorts().values().iterator().next()).getName());
      

      This is because definition.getService(getServiceFactory().getServiceQName()) is returning null.

      The workaround is to just supply the namespace parameter, like this:

      <cxf:inbound-endpoint address="http://localhost:8088/TestProxy" 
                            synchronous="true" 
                            proxy="true" 
                            endpointName="TestPOJOComponentPort"
                            serviceName="TestPOJOComponent" 
                            namespace="http://esi.support.mulesoft.com/"
                            wsdlLocation="./TestProxyImpl.wsdl"
      />
      

      As the NPE is not a friendly error message, we should supply a better error message when the Service cannot be found in the definition. That error message should suggest looking if the namespace parameter is properly configured.

        Activity

        Hide
        Edu Pereda added a comment -

        This is done for 2.2.x.

        http://fisheye.codehaus.org/changelog/mule/?cs=17736

        Improved the error handling when invalid or missing namespace attribute on endpoint. It used to throw a NullPointerException. Now it throws a ComponentNotFoundRuntimeException with more clear error message.

        Example of error message:
        org.mule.transport.cxf.support.ComponentNotFoundRuntimeException: Component "{{

        {http://support.cxf.transport.mule.org/}

        TestPOJOComponent}}" not found while searching in definition. Check if the namespace attribute in your endpoint is missing or has an invalid value. Probable service matches: "{{[

        {http://someOtherPackage.support.cxf.transport.mule/}

        TestPOJOComponent]}}". All services for the definition: {{[

        {http://someOtherPackage.support.cxf.transport.mule/}

        TestPOJOComponent]}}

        Show
        Edu Pereda added a comment - This is done for 2.2.x. http://fisheye.codehaus.org/changelog/mule/?cs=17736 Improved the error handling when invalid or missing namespace attribute on endpoint. It used to throw a NullPointerException . Now it throws a ComponentNotFoundRuntimeException with more clear error message. Example of error message: org.mule.transport.cxf.support.ComponentNotFoundRuntimeException : Component "{{ {http://support.cxf.transport.mule.org/} TestPOJOComponent}}" not found while searching in definition. Check if the namespace attribute in your endpoint is missing or has an invalid value. Probable service matches: "{{[ {http://someOtherPackage.support.cxf.transport.mule/} TestPOJOComponent]}}". All services for the definition: {{[ {http://someOtherPackage.support.cxf.transport.mule/} TestPOJOComponent]}}
        Hide
        Edu Pereda added a comment -

        Integrated to mule-3.x
        http://fisheye.codehaus.org/changelog/mule/?cs=17739

        Closing the issue.

        Show
        Edu Pereda added a comment - Integrated to mule-3.x http://fisheye.codehaus.org/changelog/mule/?cs=17739 Closing the issue.

          People

          • Assignee:
            Edu Pereda
            Reporter:
            Edu Pereda
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development