camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel Simple expressions in Groovy
Date Thu, 29 Oct 2015 12:50:14 GMT
Try with "$simple{body}" as ${ } is groovy string that may interfere with that.



On Thu, Oct 29, 2015 at 1:40 PM, contactreji <contactreji@gmail.com> wrote:
> Hello
>
> I am trying to write camel routes in groovy dsl. I just wrote a simple route
> like follows. I tried using Camel simple expression inside the groovy syntax
> as documented on http://camel.apache.org/simple.html but it fails to
> recognize the syntax. How do we write Simple expresions in groovy
> *
> package com.groovy
> import org.apache.camel.LoggingLevel
> import org.apache.camel.builder.RouteBuilder
>
> /**
>  * Created by Z001NLH on 10/29/2015.
>  */
> class BasicRoutes extends RouteBuilder{
>     @Override
>     void configure() throws Exception {
>
> from("file:C:\\Users\\Mathews\\Desktop\\in").log(LoggingLevel.INFO,"BasicRouteLogger","Received
> File").setProperty("bodyBackup",simple("${body}")).log("Done ").end()
>     }
> }
> *
>
>
> Now on running the code using main class, I get following exception.
>
> *"C:\Program Files\Java\jdk1.8.0_51\bin\java" -Didea.launcher.port=7539
> "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA
> Community Edition 14.1.5\bin" -Dfile.encoding=windows-1252 -classpath
> "C:\Program Files\Java\jdk1.8.0_51\jre\lib\charsets.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\deploy.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\javaws.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\jce.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\jfr.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\jfxswt.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\jsse.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\management-agent.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\plugin.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\resources.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\rt.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\access-bridge-64.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\cldrdata.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\dnsns.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\jaccess.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\jfxrt.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\localedata.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\nashorn.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\sunec.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\sunjce_provider.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\sunmscapi.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\sunpkcs11.jar;C:\Program
> Files\Java\jdk1.8.0_51\jre\lib\ext\zipfs.jar;C:\Users\Z001NLH\Desktop\loaders\camel-groovydsl\build\classes\main;C:\Users\Z001NLH\Desktop\loaders\camel-groovydsl\build\resources\main;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\org.codehaus.groovy\groovy-all\2.3.11\f6b34997d04c1538ce451d3955298f46fdb4dbd4\groovy-all-2.3.11.jar;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\org.apache.camel\camel-core\2.15.1\5856cd06aabc0590b0b9d4c69211b0b5fa4bea4b\camel-core-2.15.1.jar;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-core\2.2.11\c3f87d654f8d5943cd08592f3f758856544d279a\jaxb-core-2.2.11.jar;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\com.sun.xml.bind\jaxb-impl\2.2.11\a49ce57aee680f9435f49ba6ef427d38c93247a6\jaxb-impl-2.2.11.jar;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.5\6b262da268f8ad9eff941b25503a9198f0a0ac93\slf4j-api-1.7.5.jar;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-simple\1.7.5\4a950c50bbc67fdbc908190dc8e25d7a0251f74a\slf4j-simple-1.7.5.jar;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-log4j12\1.7.5\6edffc576ce104ec769d954618764f39f0f0f10d\slf4j-log4j12-1.7.5.jar;C:\Users\Z001NLH\.gradle\caches\modules-2\files-2.1\log4j\log4j\1.2.17\5af35056b4d257e4b64b9e8069c0746e8b08629f\log4j-1.2.17.jar;C:\Program
> Files (x86)\JetBrains\IntelliJ IDEA Community Edition
> 14.1.5\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain
> com.groovy.MainRunner
> SLF4J: Class path contains multiple SLF4J bindings.
> SLF4J: Found binding in
> [jar:file:/C:/Users/Z001NLH/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.7.5/4a950c50bbc67fdbc908190dc8e25d7a0251f74a/slf4j-simple-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/C:/Users/Z001NLH/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.5/6edffc576ce104ec769d954618764f39f0f0f10d/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
> explanation.
> SLF4J: Actual binding is of type [org.slf4j.impl.SimpleLoggerFactory]
> [main] INFO org.apache.camel.main.MainSupport - Apache Camel 2.15.1 starting
> [main] INFO org.apache.camel.main.MainSupport - Apache Camel 2.15.1 stopping
> [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.15.1
> (CamelContext: camel-1) is shutting down
> [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.15.1
> (CamelContext: camel-1) uptime not started
> [main] INFO org.apache.camel.impl.DefaultCamelContext - Apache Camel 2.15.1
> (CamelContext: camel-1) is shutdown in 0.007 seconds
> Exception in thread "main" groovy.lang.MissingPropertyException: No such
> property: body for class: BasicRoutes
>         at
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:51)
>         at
> org.codehaus.groovy.runtime.callsite.GetEffectivePogoPropertySite.getProperty(GetEffectivePogoPropertySite.java:84)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
>         at BasicRoutes.configure(BasicRoutes.groovy:10)
>         at
> org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:382)
>         at
> org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:323)
>         at
> org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:306)
>         at
> org.apache.camel.impl.DefaultCamelContext$1.call(DefaultCamelContext.java:731)
>         at
> org.apache.camel.impl.DefaultCamelContext$1.call(DefaultCamelContext.java:728)
>         at
> org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2486)
>         at
> org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:728)
>         at
> org.apache.camel.main.MainSupport.postProcessCamelContext(MainSupport.java:476)
>         at
> org.apache.camel.main.MainSupport.postProcessContext(MainSupport.java:405)
>         at org.apache.camel.main.Main.doStart(Main.java:122)
>         at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
>         at org.apache.camel.main.MainSupport.run(MainSupport.java:150)
>         at org.apache.camel.main.MainSupport.run(MainSupport.java:354)
>         at org.apache.camel.main.MainSupport$run$1.call(Unknown Source)
>         at
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
>         at
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
>         at com.groovy.MainRunner.main(MainRunner.groovy:17)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
> [Thread-1] INFO org.apache.camel.main.MainSupport$HangupInterceptor -
> Received hang up - stopping the main instance.
>
> Process finished with exit code 1*
>
>
>
>
> -----
> Reji Mathews
> Sr. Developer - Middleware Integration / SOA ( Open Source - Apache Camel & Jboss
Fuse ESB | Mule ESB )
> LinkedIn - http://in.linkedin.com/pub/reji-mathews/31/9a2/40a
> Twitter - reji_mathews
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Simple-expressions-in-Groovy-tp5773187.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition

Mime
View raw message