6 Replies Latest reply on May 10, 2013 4:30 PM by Jeff DeLong

    purchasing example has error when using switchyard simulator

    Jeff DeLong Master

      I have followed the video https://vimeo.com/53007939

       

      but when I run the SwitchYard Simulation

       

      sy-simulator.png

      I get the following result:

       

      sy-sim-result.png

       

       

      Note - I did not make the modifications to the generated code / WSDL to only throw a single FAULT, as I understand that is no longer a limitation of SwitchYard.

       

      There is nothing showing in the Simulation tab.

       

      This is with 2.1.1.Final

       

       

        SAVARA Tools Feature2.1.1.Finalorg.savara.tools.feature.feature.groupRed Hat, Inc.

       

      I will attach the three modified implementation files; most likely I did not make the code changes correctly.

        • 1. Re: purchasing example has error when using switchyard simulator
          Jeff DeLong Master

          When I deploy store service I get

           

          JBAS014777:   Services which failed to start:  service jboss.deployment.unit."purchasing-Store-0.0.1-SNAPSHOT.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."purchasing-Store-0.0.1-SNAPSHOT.jar".SwitchYardService: org.switchyard.exception.SwitchYardException: Service operations on a Java interface can only throw one type of exception.

           

          12:13:11,652 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"purchasing-Store-0.0.1-SNAPSHOT.jar\".SwitchYardService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"purchasing-Store-0.0.1-SNAPSHOT.jar\".SwitchYardService: org.switchyard.exception.SwitchYardException: Service operations on a Java interface can only throw one type of exception."}}}}

           

          So I guess a single fault is still a limitation of SwitchYard?

          • 2. Re: purchasing example has error when using switchyard simulator
            Gary Brown Master

            Yes, you beat me to it

             

            Let me know if there are still issues after commenting out the additional exception.

             

            Regards

            Gary

            • 3. Re: purchasing example has error when using switchyard simulator
              Jeff DeLong Master

              So I commented out the second exception, and the Simulation is successful. However when I deploy to SY 0.8 and execute the StoreService, I get an exception when the CreditAgencyService is invoked:

               

              21:40:56,571 INFO  [org.switchyard.handlers.MessageTrace] (http--127.0.0.1-8080-1)

              ------- Begin Message Trace -------

              Service -> {http://www.savara.org/purchasing/Store}Store

              Operation -> buy

              Phase -> IN

              State -> OK

              Exchange Context ->

              Message Context ->

                  org.switchyard.messageId : b298c1ba-ffb8-4877-9a83-8386e9abc739

                  org.switchyard.contentType : {http://www.jboss.org/examples/store}BuyRequest

                  org.switchyard.soap.messageName : buyRequest

              Message Content ->

              <?xml version="1.0" encoding="UTF-8"?><stor:BuyRequest customer="Fred" id="1" product="100" xmlns:stor="http://www.jboss.org/examples/store"/>

              ------ End Message Trace -------

              21:40:56,584 INFO  [stdout] (http--127.0.0.1-8080-1) CustomerName is: Fred

              21:40:56,586 INFO  [org.switchyard.handlers.MessageTrace] (http--127.0.0.1-8080-1)

              ------- Begin Message Trace -------

              Service -> {http://www.savara.org/purchasing/Store}CreditAgency

              Operation -> creditCheck

              Phase -> IN

              State -> OK

              Exchange Context ->

              Message Context ->

                  org.switchyard.messageId : 30f611fa-1869-4202-84ad-389ed9516b44

                  org.switchyard.contentType : java:org.jboss.examples.creditagency.CreditCheckType

              Message Content ->

              org.jboss.examples.creditagency.CreditCheckType@1e07c8a

              ------ End Message Trace -------

              21:40:56,595 INFO  [org.switchyard.handlers.MessageTrace] (http--127.0.0.1-8080-1)

              ------- Begin Message Trace -------

              Service -> {http://www.savara.org/purchasing/Store}CreditAgency

              Operation -> creditCheck

              Phase -> OUT

              State -> FAULT

              Exchange Context ->

                  org.switchyard.exchangeDurationMS : 9

                  org.switchyard.exchange.transaction.beforeInvoked : true

              Message Context ->

                  org.switchyard.messageId : d45ff059-a8c7-49fd-9c28-b7f7caaefbc7

                  org.switchyard.contentType : {http://www.jboss.org/examples/creditAgency}CustomerUnknown

                  org.switchyard.relatesTo : 30f611fa-1869-4202-84ad-389ed9516b44

              Message Content ->

              org.switchyard.HandlerException: org.switchyard.exception.SwitchYardException: Failed to unmarshall for type 'java:org.jboss.examples.creditagency.CreditCheckType'.

              --- Caused by org.switchyard.exception.SwitchYardException: Failed to unmarshall for type 'java:org.jboss.examples.creditagency.CreditCheckType'.

              --- Caused by javax.xml.bind.MarshalException: null

              --- Caused by com.sun.istack.SAXException2: unable to marshal type "org.jboss.examples.creditagency.CreditCheckType" as an element because it is missing an @XmlRootElement annotation

              ------ End Message Trace -------

              21:40:56,614 ERROR [org.switchyard.bus.camel.audit.FaultProcessor] (http--127.0.0.1-8080-1) Unexpected exception thrown during handling FAULT response. This exception can not be handled, thus it's marked as handled and only logged. If you don't want see messages like this consider handling exceptions in your handler logic: org.switchyard.exception.SwitchYardException: Cannot convert from 'org.switchyard.HandlerException' to 'javax.xml.transform.dom.DOMSour

              • 4. Re: purchasing example has error when using switchyard simulator
                Gary Brown Master

                Looks like there has been a change in the JAXB transformation in switchyard (https://github.com/jboss-switchyard/core/commit/71a30b6c0503c9c9f7625c4c3c46c48871d3b70b) which is causing the problem when running the example in 0.8.

                 

                The tools were built against 0.7, and that is why the simulation works.

                 

                Need to do some investigation to determine if there is something lacking from the savara generation, or whether the switchyard jaxb transformer is being too strict.

                 

                Regards

                Gary

                • 5. Re: purchasing example has error when using switchyard simulator
                  Gary Brown Master

                  Short term solution is to add:

                   

                  @XmlRootElement(name="CreditCheckRquest") to CreditCheckType.java in CreditAgency and Store services

                   

                  @XmlRootElement(name="CreditRating") to CreditRatingType.java in CreditAgency and Store services

                   

                  etc.

                   

                  The problem is that the jaxb generator doesn't alway add this annotation when there is a type and element defined. With the change to how switchyard does jaxb marshalling, it has shown up this issue.

                   

                  I'll start a thread with switchyard team to see whether this workaround can be avoided in the next version of switchyard.

                   

                  Regards

                  Gary

                  • 6. Re: purchasing example has error when using switchyard simulator
                    Jeff DeLong Master

                    The is an additional issue as well that I found when deploying to SwitchYard 1.0-SNAPSHOT. It has to do with WSDL imports vs Schema imports. See

                     

                    https://community.jboss.org/message/817087#817087