5 Replies Latest reply on Dec 18, 2012 4:33 AM by scisci

    Camel file Binding and move

    scisci

      Hi everyone,

       

      this is a part of my switchyard.xml

       

      <camel:binding.file>

      <operationSelector operationName="Carica_File"/>

      <camel:contextMapper/>

      <camel:directory>/Grazia</camel:directory>

      <

      camel:autoCreate>true</camel:autoCreate>

      <

      camel:fileName>TOTALI</camel:fileName>

      <

      camel:consume>

      <camel:move>backup/${date:now:yyyyMMdd}/${file:name}</camel:move>

       

      </camel:consume>

      </

      camel:binding.file>

       

       

       

       

      When I've deployed this was the error

       

       

       

       

      org.jboss.msc.service.StartException

       

      in service jboss.deployment.unit."Prestito_Titoli.jar".SwitchYardService: java.lang.IllegalArgumentException: Illegal character in query at index 60: file:///Grazia?autoCreate=true&fileName=TOTALI&move=backup/${date:now:yyyyMMdd}/${file:name}

       

       

       

      Switchyard dosen't support script for date?

      Can anyone help me?

      Thanks

      Mirko

       

       

       

        • 1. Re: Camel file Binding and move
          kcbabo

          I just changed the camel-file-binding to include the move configuration you have above and it worked fine.  Which SY version are you using?  If you can attach an example to reproduce or maybe modify the camel-file-binding and try to reproduce that would help.

          • 2. Re: Camel file Binding and move
            scisci

            Hi, I've done what you've suggested.

            I use sw version 6.0

            I attachment my switchyard.xml ( I've only add move on camel-binding quickstarts)

             

            <switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:camel="urn:switchyard-component-camel:config:1.0">
            <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="camel-binding" targetNamespace="urn:switchyard-quickstart:camel-binding:0.1.0">

            <service name="GreetingService" promote="GreetingService">

            <camel:binding.file>

            <camel:directory>target/input</camel:directory>
            <camel:fileName>test.txt</camel:fileName>
            <camel:consume>

            <camel:initialDelay>50</camel:initialDelay>
            <camel:delete>true</camel:delete>

            <camel:move>backup/${date:now:yyyyMMdd}/${file:name}</camel:move>
            </camel:consume>
            </camel:binding.file>

             

            </service>

            </composite>

            </switchyard>

             

            and this is the error

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

            19:04:22,735 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-8) MSC00001: Failed to start service jboss.deployment.unit."switchyard-quickstart-camel-binding.jar".SwitchYardService:

            org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-quickstart-camel-binding.jar".SwitchYardService: java.lang.IllegalArgumentException

            : Illegal character in query at index 79: file://target/input?fileName=test.txt&initialDelay=50&delete=true&move=backup/${date:now:yyyyMMdd}/${file:name}

            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(Unknown Source) [rt.jar:1.7.0_09]

            at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_09]

            at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_09]

            Caused by:

            java.lang.IllegalArgumentException

            : Illegal character in query at index 79: file://target/input?fileName=test.txt&initialDelay=50&delete=true&move=backup/${date:now:yyyyMMdd}/${file:name}

            at java.net.URI.create(Unknown Source) [rt.jar:1.7.0_09]

            at org.switchyard.component.camel.config.model.file.v1.V1CamelFileBindingModel.getComponentURI(

            V1CamelFileBindingModel.java:157

            )

            at org.switchyard.component.camel.InboundHandler.createRouteDefinition(

            InboundHandler.java:87

            )

            at org.switchyard.component.camel.InboundHandler.<init>(

            InboundHandler.java:75

            )

            at org.switchyard.component.camel.deploy.CamelActivator.activateBinding(

            CamelActivator.java:123

            )

            at org.switchyard.deploy.internal.Deployment.deployServiceBindings(

            Deployment.java:428

            )

            at org.switchyard.deploy.internal.Deployment.start(

            Deployment.java:141

            )

            at org.switchyard.as7.extension.deployment.SwitchYardDeployment.start(

            SwitchYardDeployment.java:103

            )

            at org.switchyard.as7.extension.services.SwitchYardService.start(

            SwitchYardService.java:72

            )

            ... 5 more

            Caused by:

            java.net.URISyntaxException

            : Illegal character in query at index 79: file://target/input?fileName=test.txt&initialDelay=50&delete=true&move=backup/${date:now:yyyyMMdd}/${file:name}

            at java.net.URI$Parser.fail(Unknown Source) [rt.jar:1.7.0_09]

            at java.net.URI$Parser.checkChars(Unknown Source) [rt.jar:1.7.0_09]

            at java.net.URI$Parser.parseHierarchical(Unknown Source) [rt.jar:1.7.0_09]

            at java.net.URI$Parser.parse(Unknown Source) [rt.jar:1.7.0_09]

            at java.net.URI.<init>(Unknown Source) [rt.jar:1.7.0_09]

            ... 14 more

             

            19:04:22,751 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "switchyard-quickstart-camel-binding.jar" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"switchyard-quickstart-camel-binding.jar\".SwitchYardService" => "

            org.jboss.msc.service.StartException in service jboss.deployment.unit.\"switchyard-quickstart-camel-binding.jar\".SwitchYardService: java.lang.IllegalArgumentException

            : Illegal character in query at index 79: file://target/input?fileName=test.txt&initialDelay=50&delete=true&move=backup/${date:now:yyyyMMdd}/${file:name}"}}

            19:04:22,751 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016009: Stopping weld service for deployment switchyard-quickstart-camel-binding.jar

            19:04:22,766 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment switchyard-quickstart-camel-binding.jar in 16ms

            19:04:22,766 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report

            JBAS014777: Services which failed to start: service jboss.deployment.unit."switchyard-quickstart-camel-binding.jar".SwitchYardService:

            org.jboss.msc.service.StartException in service jboss.deployment.unit."switchyard-quickstart-camel-binding.jar".SwitchYardService: java.lang.IllegalArgumentException

            : Illegal character in query at index 79: file://target/input?fileName=test.txt&initialDelay=50&delete=true&move=backup/${date:now:yyyyMMdd}/${file:name}

             

            19:04:22,766 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.\"switchyard-quickstart-camel-binding.jar\".SwitchYardService" => "

            org.jboss.msc.service.StartException in service jboss.deployment.unit.\"switchyard-quickstart-camel-binding.jar\".SwitchYardService: java.lang.IllegalArgumentException

            : Illegal character in query at index 79: file://target/input?fileName=test.txt&initialDelay=50&delete=true&move=backup/${date:now:yyyyMMdd}/${file:name}"}}}}

             

             

             

            Any help

            Thank

            • 3. Re: Camel file Binding and move
              kcbabo

              OK, so tried this again and still can't reproduce it.  That said, I'm using a current build of 0.7 SNAPSHOT and you are using 0.6 Final.  I went back and tried 0.6 Final and I was able to reproduce what you are seeing.


              @Lukasz - can you think of something we changed in 0.7 to allow for this?

              • 4. Re: Camel file Binding and move
                splatch

                Yes, there was small change which may lead to behavior change between 0.6 and 0.7: https://github.com/jboss-switchyard/components/blob/master/common/camel/src/main/java/org/switchyard/component/camel/common/model/v1/V1BaseCamelBindingModel.java#L109

                 

                This line was not present in 0.6. In general it was introduced to avoid 'unsafe' URIs.

                 

                @mirko - could you try quote the sings {} to be URI compatible - try %7B for { and %7D for }?

                • 5. Re: Camel file Binding and move
                  scisci

                  Hi,

                  I've changed { and } with %7B and %7D and now it's working.

                  Thanks