5 Replies Latest reply on May 31, 2012 2:53 PM by Len DiMaggio

    Editor question from blog

    Keith Babo Master

      Re-posting this from Len's blog comment so that we can discuss in the forum:

       

       

      https://community.jboss.org/en/switchyard/blog/2012/05/23/switchyard-tooling-preview#comment-9981

       

      Very nice! Very cool actually. I had one queston:

       

      I installed:

      • Switchyard 0.4
      • eclipse Version: Indigo Service Release 2, Build id: 20120208-2150
      • GEF (needed by Switchyard tooling)
      • JBoss Tools (we need the run-time detectors)
      • Create a server - reference the AS 7 server bundled with Switchyard
      • Then install Switchyard tooling

       

      Then I created a a new (empty) switchyard project - I wanted to try to build  something on the scale of helloworld - in the project creation wizard I selected Bean component (and accepted all other defaults)

       

      Then I added a service ("HelloService") in the graphical editor - the switchyard.xml file was updated to look like this:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard-component-soap:config:1.0" name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">
        <sca:composite name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">
          <sca:service name="HelloService2">
            <sca:interface.java interface="com.example.switchyard.switchyard_example.HelloService2"/>
            <soap:binding.soap>
              <soap:contextMapper/>
              <soap:wsdl>HelloService2.wsdl</soap:wsdl>
              <soap:socketAddr>:18001</soap:socketAddr>
            </soap:binding.soap>
          </sca:service>
        </sca:composite>
      </switchyard>
      

       

      So far so good - but...

       

      My question is - how do I add an implementation bean reference in switchyard.xml? In the editor, the 'implemention' feature is clickable, but it's not letting me create a reference to an implementation bean. What am I missing?

       

      I need the editor to let me add something like this:

       

                  <implementation.bean xmlns="urn:switchyard-component-bean:config:1.0  class="com.example.switchyard.switchyard_example.HelloServiceBean"/>

       

       

      Thanks!

      Len

       

       

      ----------------

       

       

      The (very minimal) service and implementation bean look like this:

       

      package com.example.switchyard.switchyard_example;
      
      import org.switchyard.component.bean.Service;
      
      @Service(HelloService2.class)
      public class HelloServiceBean implements HelloService2 {
      
          public HelloServiceBean() {
          }
      
          @Override
          public String sayHello(String name) {
              System.out.println("Hello: " + name);
              return "Hello " + name + "!";
          }
      }
      

      ----------------

       

      package com.example.switchyard.switchyard_example;
      
      public interface HelloService2 {
      
          String sayHello(String helloString);
      }
      
        • 1. Re: Editor question from blog
          Keith Babo Master

          You should be able to drag a Component onto the canvas from the palette and then select the Bean implementation type.  From there, you should be able to select your existing bean class and interface.  One thing to watch out for is duplicate config entries due to the BeanSwitchYardScanner.  Check your project's pom.xml and make sure it doesn't include this:

           

                      <param>org.switchyard.component.bean.config.model.BeanSwitchYardScanner</param>
          

           

          If that entry is present under the switchard-plugin configuration element, then remove it or comment it out.

          • 2. Re: Editor question from blog
            Len DiMaggio Apprentice

            Thanks Keith!,

             

            That worked - for the creation of the service, it's implementation bean, interface, etc. in the editor. The resulting switchyard.xml looks good now:

             

            <?xml version="1.0" encoding="UTF-8"?>

            <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard-component-soap:config:1.0" name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">

              <sca:composite name="switchyard-example" targetNamespace="urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT">

                <sca:service name="HelloService">

                  <sca:interface.java interface="com.example.switchyard.switchyard_example.HelloService"/>

                  <soap:binding.soap>

                    <soap:contextMapper/>

                    <soap:wsdl>HelloService.wsdl</soap:wsdl>

                    <soap:socketAddr>:18001</soap:socketAddr>

                  </soap:binding.soap>

                </sca:service>

                <sca:component name="HelloServiceBean">

                  <bean:implementation.bean class="com.example.switchyard.switchyard_example.HelloServiceBean"/>

                  <sca:service name="HelloService">

                    <sca:interface.java interface="com.example.switchyard.switchyard_example.HelloService"/>

                  </sca:service>

                </sca:component>

              </sca:composite>

            </switchyard>

             

            But - when I try to deploy it - I'm seeing this error - can't tell if this is a user error or what - as everything looks OK to me - can you suggest why it can't find the service name?

             

            22:49:03,278 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "switchyard-example.jar"

            22:49:03,306 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment switchyard-example.jar

            22:49:03,325 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016005: Starting Services for CDI deployment: switchyard-example.jar

            22:49:03,328 INFO  [org.switchyard] (MSC service thread 1-2) Deploying SwitchYard application 'switchyard-example.jar'

            22:49:03,330 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016008: Starting weld service for deployment switchyard-example.jar

            22:49:03,371 INFO  [org.switchyard] (MSC service thread 1-7) Starting SwitchYard service

            22:49:03,451 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'.

                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:79)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_22]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_22]

                at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_22]

            Caused by: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'.

                at org.switchyard.component.bean.deploy.BeanComponentActivator.activateService(BeanComponentActivator.java:82)

                at org.switchyard.deploy.internal.Deployment.deployImplementations(Deployment.java:392)

                at org.switchyard.deploy.internal.Deployment.start(Deployment.java:140)

                at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:103)

                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:72)

                ... 5 more

             

            22:49:03,457 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "switchyard-example.jar" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'."}}

            22:49:03,460 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016009: Stopping weld service for deployment switchyard-example.jar

            22:49:03,467 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment switchyard-example.jar in 9ms

            22:49:03,468 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report

            JBAS014777:   Services which failed to start:      service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'.

             

            22:49:03,470 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'."}}}}

            22:53:18,578 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "switchyard-example.jar"

            22:53:18,597 INFO  [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016002: Processing weld deployment switchyard-example.jar

            22:53:18,605 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: switchyard-example.jar

            22:53:18,607 INFO  [org.switchyard] (MSC service thread 1-1) Deploying SwitchYard application 'switchyard-example.jar'

            22:53:18,609 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016008: Starting weld service for deployment switchyard-example.jar

            22:53:18,656 INFO  [org.switchyard] (MSC service thread 1-4) Starting SwitchYard service

            22:53:18,720 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'.

                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:79)

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_22]

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_22]

                at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_22]

            Caused by: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'.

                at org.switchyard.component.bean.deploy.BeanComponentActivator.activateService(BeanComponentActivator.java:82)

                at org.switchyard.deploy.internal.Deployment.deployImplementations(Deployment.java:392)

                at org.switchyard.deploy.internal.Deployment.start(Deployment.java:140)

                at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:103)

                at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:72)

                ... 5 more

             

            22:53:18,726 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "switchyard-example.jar" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'."}}

            22:53:18,729 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016009: Stopping weld service for deployment switchyard-example.jar

            22:53:18,738 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment switchyard-example.jar in 11ms

            22:53:18,739 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report

            JBAS014777:   Services which failed to start:      service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-example.jar".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'.

             

            22:53:18,740 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"switchyard-example.jar\".SwitchYardService: org.switchyard.exception.SwitchYardException: Unknown Service name '{urn:com.example.switchyard:switchyard-example:0.0.1-SNAPSHOT}HelloService'."}}}}

             

             

             

            ======================================

            package com.example.switchyard.switchyard_example;

             

            public interface HelloService {

                String sayHello(String helloString);

            }

            ======================================

            package com.example.switchyard.switchyard_example;

             

            import org.switchyard.component.bean.Service;

             

            @Service(HelloService.class)

            public class HelloServiceBean implements HelloService {

             

                @Override

                public String sayHello(String helloString) {

                        System.out.println("Hello: " + helloString);

                        return "Hello " + helloString + "!";   

                }

             

            }

            ======================================

            • 3. Re: Editor question from blog
              Jeff DeLong Master

              I am a real novice here but you don't seem to be "promoting" your service. For example the bean-service quickstart has

               

               

                <service name="OrderService" promote="OrderService">

              • 4. Re: Editor question from blog
                Keith Babo Master

                Yep.  My guess is that the composite service and component service aren't "connected" in your visual editor.  Under "Connections", click on "Component Service reference" and then select the component service on the canvas.  Drag the connector line to the composite service and you should be good to go.

                • 5. Re: Editor question from blog
                  Len DiMaggio Apprentice

                  Thanks Keith - as you pointed out:

                   

                  You need to click on the component *service* - it's the little green thing  

                   

                  Thx!

                   

                   

                   

                  sy.png