set the value of camel body as value of constructor-arg
I have the following bean declaration in camel-context.xml bean id=AmbiguousData class=java.lang.Exception constructor-arg index=0 type=java.lang.String value=${body} / /bean The value of body is set dynamically in camel. From the logs I am able to verify that the body is correct(Ambiguous data found for Test2), but the value passed to the bean is wrong(${body}). LOG: ... BodyType:String , Body:Ambiguous data found for IMSI_Test2 , CaughtExceptionType:java.lang.Exception, CaughtExceptionMessage:${body}, StackTrace:java.lang.Exception: ${body} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280) .. How do I resolve this issue? - Satyam A Maloo -- View this message in context: http://camel.465427.n5.nabble.com/set-the-value-of-camel-body-as-value-of-constructor-arg-tp5745482.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: set the value of camel body as value of constructor-arg
Can you post your route? On Fri, Jan 3, 2014 at 12:25 PM, Satyam Maloo maloosat...@gmail.com wrote: I have the following bean declaration in camel-context.xml bean id=AmbiguousData class=java.lang.Exception constructor-arg index=0 type=java.lang.String value=${body} / /bean The value of body is set dynamically in camel. From the logs I am able to verify that the body is correct(Ambiguous data found for Test2), but the value passed to the bean is wrong(${body}). LOG: ... BodyType:String , Body:Ambiguous data found for IMSI_Test2 , CaughtExceptionType:java.lang.Exception, CaughtExceptionMessage:${body}, StackTrace:java.lang.Exception: ${body} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280) .. How do I resolve this issue? - Satyam A Maloo -- View this message in context: http://camel.465427.n5.nabble.com/set-the-value-of-camel-body-as-value-of-constructor-arg-tp5745482.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: set the value of camel body as value of constructor-arg
On Fri, Jan 3, 2014 at 12:25 PM, Satyam Maloo maloosat...@gmail.com wrote: I have the following bean declaration in camel-context.xml bean id=AmbiguousData class=java.lang.Exception constructor-arg index=0 type=java.lang.String value=${body} / /bean You cannot do this, as bean is simple/blueprint and ${body} is Camel's expression language. Also when using bean is created once at startup. You may want to use a bean factory and call it from a Camel route where you can pass in the body as a parameter to it. The value of body is set dynamically in camel. From the logs I am able to verify that the body is correct(Ambiguous data found for Test2), but the value passed to the bean is wrong(${body}). LOG: ... BodyType:String , Body:Ambiguous data found for IMSI_Test2 , CaughtExceptionType:java.lang.Exception, CaughtExceptionMessage:${body}, StackTrace:java.lang.Exception: ${body} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:121) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280) .. How do I resolve this issue? - Satyam A Maloo -- View this message in context: http://camel.465427.n5.nabble.com/set-the-value-of-camel-body-as-value-of-constructor-arg-tp5745482.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io