camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinay <vinay_samu...@yahoo.com>
Subject camel error with simple program with camel-core-2.11.1.jar
Date Thu, 18 Jul 2013 05:07:02 GMT
Hi All,

I am new to camel, here is what I am trying and is giving me exception.....

$groovy -v
Groovy Version: 2.1.3 JVM: 1.7.0_11 Vendor: Oracle Corporation OS: Linux
$groovy  CallCallista1.groovy

give following exception...............
[main] INFO camelLogger - Exchange[ExchangePattern:InOut, BodyType:String,
Body
test message]
Caught: java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.
ang.String
java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.lang.Str
ng
        at
org.apache.camel.impl.DefaultCamelContext.getProperty(DefaultCamelCo
text.java:2594)
        at
org.apache.camel.util.MessageHelper.extractBodyForLogging(MessageHel
er.java:161)
        at
org.apache.camel.util.MessageHelper.extractBodyForLogging(MessageHel
er.java:144)
        at
org.apache.camel.impl.DefaultMessage.toString(DefaultMessage.java:46

        at
org.apache.camel.impl.DefaultExchange.toString(DefaultExchange.java:
0)
        at CallCallista1.run(CallCallista1.groovy:25)


and, here is program.......
=============================================
@Grab('org.apache.camel:camel-core:')
@Grab('org.slf4j:slf4j-simple:')
import org.apache.camel.*
import org.apache.camel.impl.*
import org.apache.camel.builder.*

class MyRouteBuilder extends org.apache.camel.builder.RouteBuilder {
  void configure() {
    from("direct://foo")
     .to("log://camelLogger?level=INFO")
     .to("mock://result?retainLast=10")
  }
}

def mrb = new MyRouteBuilder()
def ctx = new org.apache.camel.impl.DefaultCamelContext()
ctx.getProperties().put(Exchange.LOG_DEBUG_BODY_STREAMS, true);
ctx.addRoutes mrb
ctx.start()
p = ctx.createProducerTemplate()
p.sendBody("direct:foo", ExchangePattern.InOut, "test message")

e = ctx.getEndpoint("mock://result?retainLast=10");
def ex = e.exchanges
println "INFO> ${ex.first()}"
println "INFO> ${ex.first().getException()}"





--
View this message in context: http://camel.465427.n5.nabble.com/camel-error-with-simple-program-with-camel-core-2-11-1-jar-tp5735829.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message