Petals BC REST

Unable to declare operations on a resource mapped on several service providers

Details

  • Type: Improvement Request Improvement Request
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.1.1-BC
  • Fix Version/s: None
  • Component/s: Consumer mode
  • Security Level: Public
  • Description:
    Hide

    I have a business resource for which operations (create, update, list, ...) are distributed over several services. I use the following configuration:

    <jbi:jbi ...>
       <jbi:services binding-component="true">
          <jbi:consumes interface-name="inscription-cantine:inscriptionCantine">
             <cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
             <cdk:mep xsi:nil="true" />
             <rest:service-base-path>/api</rest:service-base-path>
             <rest:mapping>
                <rest:operation name="inscription-cantine:new">
                   <rest:http-method>POST</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine</rest:path-template>
                   ...
                </rest:operation>
                <rest:operation name="inscription-cantine:validate">
                   <rest:http-method>PUT</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine/{numero-demande}</rest:path-template>
                   ...
                </rest:operation>
             </rest:mapping>
          </jbi:consumes>
    
          <jbi:consumes interface-name="flowable-integration:Task">
             <cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
             <cdk:mep xsi:nil="true" />
             <rest:service-base-path>/api</rest:service-base-path>
             <rest:mapping>
                <rest:operation name="flowable-integration:getTasks">
                   <rest:http-method>GET</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine?statut='En attente'</rest:path-template>
                   ...
             </rest:mapping>
          </jbi:consumes>
    
          <jbi:consumes interface-name="flowable-integration:ProcessInstances">
             <cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
             <cdk:mep xsi:nil="true" />
             <rest:service-base-path>/api</rest:service-base-path>
             <rest:mapping>
                <rest:operation name="flowable-integration:getProcessInstances">
                   <rest:http-method>GET</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine?usager-demandeur={usager-demandeur}</rest:path-template>
                   ...
                </rest:operation>
             </rest:mapping>
          </jbi:consumes>
       </jbi:services>
    </jbi:jbi>

    When deploying it, I get the following error:

    org.ow2.petals.component.framework.api.exception.PEtALSCDKException: A Servlet has been already added with the service base path '/api'
    	at org.ow2.petals.binding.rest.exchange.incoming.RESTServer.addRESTService(RESTServer.java:124)
    	at org.ow2.petals.binding.rest.RESTComponent.addRESTService(RESTComponent.java:98)
    	at org.ow2.petals.binding.rest.RESTSUManager.doDeploy(RESTSUManager.java:70)
    	at org.ow2.petals.component.framework.su.AbstractServiceUnitManager.deploy(AbstractServiceUnitManager.java:144)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeploySUToComponentTask.deploySUtoComponent(DeploySUToComponentTask.java:119)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeploySUToComponentTask.execute(DeploySUToComponentTask.java:73)
    	at org.ow2.petals.microkernel.api.jbi.management.TaskProcessor.process(TaskProcessor.java:73)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeployAllSUTask.registerAndDeploySU(DeployAllSUTask.java:156)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeployAllSUTask.deploySUS(DeployAllSUTask.java:119)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeployAllSUTask.execute(DeployAllSUTask.java:78)
    	at org.ow2.petals.microkernel.api.jbi.management.TaskProcessor.process(TaskProcessor.java:73)
    	at org.ow2.petals.microkernel.jbi.management.deployment.DeploymentServiceImpl.deploy(DeploymentServiceImpl.java:166)
    Show
    I have a business resource for which operations (create, update, list, ...) are distributed over several services. I use the following configuration:
    <jbi:jbi ...>
       <jbi:services binding-component="true">
          <jbi:consumes interface-name="inscription-cantine:inscriptionCantine">
             <cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
             <cdk:mep xsi:nil="true" />
             <rest:service-base-path>/api</rest:service-base-path>
             <rest:mapping>
                <rest:operation name="inscription-cantine:new">
                   <rest:http-method>POST</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine</rest:path-template>
                   ...
                </rest:operation>
                <rest:operation name="inscription-cantine:validate">
                   <rest:http-method>PUT</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine/{numero-demande}</rest:path-template>
                   ...
                </rest:operation>
             </rest:mapping>
          </jbi:consumes>
    
          <jbi:consumes interface-name="flowable-integration:Task">
             <cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
             <cdk:mep xsi:nil="true" />
             <rest:service-base-path>/api</rest:service-base-path>
             <rest:mapping>
                <rest:operation name="flowable-integration:getTasks">
                   <rest:http-method>GET</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine?statut='En attente'</rest:path-template>
                   ...
             </rest:mapping>
          </jbi:consumes>
    
          <jbi:consumes interface-name="flowable-integration:ProcessInstances">
             <cdk:timeout>${municipalite.timeout.clt-services.qf}</cdk:timeout>
             <cdk:mep xsi:nil="true" />
             <rest:service-base-path>/api</rest:service-base-path>
             <rest:mapping>
                <rest:operation name="flowable-integration:getProcessInstances">
                   <rest:http-method>GET</rest:http-method>
                   <rest:path-template>/demarches-administratives/demande-cantine?usager-demandeur={usager-demandeur}</rest:path-template>
                   ...
                </rest:operation>
             </rest:mapping>
          </jbi:consumes>
       </jbi:services>
    </jbi:jbi>
    When deploying it, I get the following error:
    org.ow2.petals.component.framework.api.exception.PEtALSCDKException: A Servlet has been already added with the service base path '/api'
    	at org.ow2.petals.binding.rest.exchange.incoming.RESTServer.addRESTService(RESTServer.java:124)
    	at org.ow2.petals.binding.rest.RESTComponent.addRESTService(RESTComponent.java:98)
    	at org.ow2.petals.binding.rest.RESTSUManager.doDeploy(RESTSUManager.java:70)
    	at org.ow2.petals.component.framework.su.AbstractServiceUnitManager.deploy(AbstractServiceUnitManager.java:144)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeploySUToComponentTask.deploySUtoComponent(DeploySUToComponentTask.java:119)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeploySUToComponentTask.execute(DeploySUToComponentTask.java:73)
    	at org.ow2.petals.microkernel.api.jbi.management.TaskProcessor.process(TaskProcessor.java:73)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeployAllSUTask.registerAndDeploySU(DeployAllSUTask.java:156)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeployAllSUTask.deploySUS(DeployAllSUTask.java:119)
    	at org.ow2.petals.microkernel.jbi.management.task.deployment.deploy.DeployAllSUTask.execute(DeployAllSUTask.java:78)
    	at org.ow2.petals.microkernel.api.jbi.management.TaskProcessor.process(TaskProcessor.java:73)
    	at org.ow2.petals.microkernel.jbi.management.deployment.DeploymentServiceImpl.deploy(DeploymentServiceImpl.java:166)
  • Environment:
    -

People

Dates

  • Created:
    Wed, 4 Apr 2018 - 10:10:12 +0200
    Updated:
    Wed, 4 Apr 2018 - 12:46:00 +0200