Operations on SwitchYard REST binding interface does not allow more than one parameter
Issue
- User faces an issue while trying to define a
REST bindinginterface with operations having more than oneQuery/Pathparameters as follows. It has been observed that in such scenariosSwitchYard REST bindingis not allowing more than one parameter.
@GET
@Consumes({ "application/json" })
@Produces("application/json")
public SimpleRestInterface search(@QueryParam("firstname") String firstname, @QueryParam("secondName") String secondName);
- Even users have written a custom
MessageComposerclass to wrap the multiple parameters into a single object as suggested in the following discussion https://developer.jboss.org/thread/230427 . However, when user tried to deploy theSwitchYardapplication it is throwing the below exception:
...
15:07:11,551 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."sample-restbinding-service.jar".SwitchYardService: org.jboss.msc.service.StartException in service jboss.deployment.unit."sample-restbinding-service.jar".SwitchYardService: java.lang.RuntimeException: SWITCHYARD010004: Service operations on a Java interface must have exactly one parameter.
at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:80)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
Caused by: java.lang.RuntimeException: SWITCHYARD010004: Service operations on a Java interface must have exactly one parameter.
at org.switchyard.extensions.java.JavaService.fromClass(JavaService.java:85)
at org.switchyard.deploy.internal.Deployment.loadServiceInterface(Deployment.java:410)
at org.switchyard.deploy.internal.Deployment.getCompositeServiceInterface(Deployment.java:340)
at org.switchyard.deploy.internal.Deployment.deployServiceBindings(Deployment.java:595)
at org.switchyard.deploy.internal.Deployment.start(Deployment.java:145)
at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(SwitchYardDeployment.java:101)
at org.switchyard.as7.extension.services.SwitchYardService.start(SwitchYardService.java:73)
... 5 more
How to fix this issue?
Environment
- Red Hat JBoss Fuse Service Works (FSW)
- 6.0.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
