Uploaded image for project: 'SwitchYard'
  1. SwitchYard
  2. SWITCHYARD-296

NPE when promoted service name is different from the service name itself

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 0.1
    • Fix Version/s: 0.2
    • Component/s: core
    • Labels:
      None

      Description

      See the snippet of the configuration
      <service name="ErrorService1" promote="ErrorService">
      <binding.soap xmlns="urn:switchyard-component-soap:config:1.0">
      <wsdl>wsdl/ErrorService.wsdl</wsdl>
      <serverPort>9090</serverPort>
      <serverHost>10.34.3.135</serverHost>
      </binding.soap>
      </service>
      <component name="ErrorService">
      <service name="ErrorService">
      <interface.java interface="org.swi.ErrorService"/>
      </service>
      <implementation.bean xmlns="urn:switchyard-component-bean:config:1.0" class="org.swi.ErrorServiceBean"/>
      </component>

      Such configuration throws NPE - the only reason is that the gateway is named ServiceName1. It seems that promote attribute is not taken into consideration.

      If if this not a correct configuration then an error should be reported instead of NPE
      12:46:11,968 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."errhandling.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."errhandling.jar".SwitchYardService: java.lang.NullPointerException
      at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:75)
      .
      .
      .

        Gliffy Diagrams

        1. eip.tgz
          120 kB
          Jiri Pechanec

          Issue Links

            Activity

            Hide
            dward David Ward added a comment - - edited

            Jiri,

            Can you please attach a small test case that demonstrates this bug? I cannot reproduce it.

            Here's the test case I just wrote, and it ran successfully:

            @Test
            public void testPromote() throws Exception {
                ComponentModel component = null;
                CompositeModel composite = _puller.pull(PROMOTE_XML, getClass());
                for (CompositeServiceModel compositeService : composite.getServices()) {
                    if (compositeService.getName().equals("ErrorService1")) {
                        component = compositeService.getComponent();
                        break;
                    }
                }
                Assert.assertNotNull(component);
                Assert.assertEquals("ErrorService", component.getName());
            }
            

            PROMOTE_XML ==

            <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
                       targetNamespace="urn:testPromote:example:1.0"
                       xmlns:bean="urn:switchyard-config:test-bean:1.0"
                       xmlns:soap="urn:switchyard-config:test-soap:1.0"
                       name="testPromote">
                <service name="ErrorService1" promote="ErrorService">
                    <soap:binding.soap/>
                </service>
                <component name="ErrorService">
                    <service name="ErrorService">
                        <interface.java interface="org.swi.ErrorService"/>
                    </service>
                    <bean:implementation.bean class="org.swi.ErrorServiceBean"/>
                </component>
            </composite>
            

            Thanks,
            David

            Show
            dward David Ward added a comment - - edited Jiri, Can you please attach a small test case that demonstrates this bug? I cannot reproduce it. Here's the test case I just wrote, and it ran successfully: @Test public void testPromote() throws Exception { ComponentModel component = null ; CompositeModel composite = _puller.pull(PROMOTE_XML, getClass()); for (CompositeServiceModel compositeService : composite.getServices()) { if (compositeService.getName().equals( "ErrorService1" )) { component = compositeService.getComponent(); break ; } } Assert.assertNotNull(component); Assert.assertEquals( "ErrorService" , component.getName()); } PROMOTE_XML == < composite xmlns = "http://docs.oasis-open.org/ns/opencsa/sca/200912" targetNamespace = "urn:testPromote:example:1.0" xmlns:bean = "urn:switchyard-config:test-bean:1.0" xmlns:soap = "urn:switchyard-config:test-soap:1.0" name = "testPromote" > < service name = "ErrorService1" promote = "ErrorService" > < soap :binding.soap/> </ service > < component name = "ErrorService" > < service name = "ErrorService" > < interface .java interface = "org.swi.ErrorService" /> </ service > < bean :implementation.bean class = "org.swi.ErrorServiceBean" /> </ component > </ composite > Thanks, David
            Hide
            jpechanec Jiri Pechanec added a comment -

            Attached an example

            This works
            <service name="TestService" promote="TestService/TestService">
            <binding.soap xmlns="urn:switchyard-component-soap:config:1.0">
            <wsdl>/wsdl/TestServiceBeanService.wsdl</wsdl>
            <serverPort>9090</serverPort>
            </binding.soap>
            </service>

            This does not
            <service name="TestService1" promote="TestService/TestService">
            <binding.soap xmlns="urn:switchyard-component-soap:config:1.0">
            <wsdl>/wsdl/TestServiceBeanService.wsdl</wsdl>
            <serverPort>9090</serverPort>
            </binding.soap>
            </service>

            Show
            jpechanec Jiri Pechanec added a comment - Attached an example This works <service name="TestService" promote="TestService/TestService"> <binding.soap xmlns="urn:switchyard-component-soap:config:1.0"> <wsdl>/wsdl/TestServiceBeanService.wsdl</wsdl> <serverPort>9090</serverPort> </binding.soap> </service> This does not <service name="TestService1" promote="TestService/TestService"> <binding.soap xmlns="urn:switchyard-component-soap:config:1.0"> <wsdl>/wsdl/TestServiceBeanService.wsdl</wsdl> <serverPort>9090</serverPort> </binding.soap> </service>
            Hide
            dward David Ward added a comment -

            Okay, it was the slash "/" in the promote attribute that was what was different in our tests.

            Anyways, I fixed this with a combination of changes to Deployment and V1CompositeServiceModel, which wasn't taking the slash into account like V1CompositeReferenceModel was.

            I verified the fix using Jiri's attached test case. Thanks Jiri!

            Show
            dward David Ward added a comment - Okay, it was the slash "/" in the promote attribute that was what was different in our tests. Anyways, I fixed this with a combination of changes to Deployment and V1CompositeServiceModel, which wasn't taking the slash into account like V1CompositeReferenceModel was. I verified the fix using Jiri's attached test case. Thanks Jiri!
            Hide
            dward David Ward added a comment -

            New pull request generated per kbabo's suggestion.
            https://github.com/jboss-switchyard/core/pull/231

            Show
            dward David Ward added a comment - New pull request generated per kbabo's suggestion. https://github.com/jboss-switchyard/core/pull/231
            Hide
            kcbabo Keith Babo added a comment -

            pushed

            Show
            kcbabo Keith Babo added a comment - pushed

              People

              • Assignee:
                dward David Ward
                Reporter:
                jpechanec Jiri Pechanec
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development