Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9122

Ruby script cannot access request object

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • camel-script
    • None
    • Unknown

    Description

      with script

      body = $request.getBody()
      $request.setBody("Hello " + body);
      

      we get

      uby: body = $request.getBody();
      $request.setBody("Hello " + body);. Cause: org.jruby.embed.EvalFailedException: (NoMethodError) undefined method `getBody' for nil:NilClass
      	at org.apache.camel.builder.script.ScriptBuilder.createScriptEvaluationException(ScriptBuilder.java:540)
      	at org.apache.camel.builder.script.ScriptBuilder.evaluateScript(ScriptBuilder.java:409)
      	at org.apache.camel.builder.script.ScriptBuilder.process(ScriptBuilder.java:181)
      	at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:460)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:190)
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)
      	at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:68)
      	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:404)
      	at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:372)
      	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:262)
      	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:372)
      	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:230)
      	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:128)
      	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:132)
      	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)
      	at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)
      	at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:331)
      	at org.wildfly.camel.test.script.ScriptIntegrationTest.scriptProcessing(ScriptIntegrationTest.java:100)
      	at org.wildfly.camel.test.script.ScriptIntegrationTest.testRuby(ScriptIntegrationTest.java:75)
      

      It seems that the scriptengine can load the script and that the request object is nil.
      This used to work 2.15.2 and earlier 2.16 snapshots

      CrossRef: https://github.com/wildfly-extras/wildfly-camel/issues/845

      Attachments

        Activity

          People

            Unassigned Unassigned
            tdiesler Thomas Diesler
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: