Trial1 - ending up at deployment time error in Fuse ESB : <bean id="escTool" class="org.apache.velocity.tools.generic.EscapeTool"/>
<!-- in a route --> <to uri="acctBatchProcessor" /> <log message="Processor received the record" /> <setHeader headerName="esc"> <ref id="escTool" /> </setHeader> <to uri="velocity://velocity/upsertAccount.vm"/> Error at deployment time: 11:58:11,252 | ERROR | ExtenderThread-5 | ContextLoaderListener | ? ? | 84 - org.springframework.osgi.extender - 1.2.1 | Application context refresh failed (OsgiBundleXmlApplicationContext(bundle =mdm-batch-route, config=osgibundle:/META-INF/spring/*.xml)) org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 102 in XML document from URL [bundle://492.0 :0/META-INF/spring/camel-context.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-id.2: There are multiple occurrences of ID value 'escTool'. at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.j ava:396)[73:org.springframework.beans:3.0.5.RELEASE] Trial2 - ending up at run time error: <bean id="escTool" class="org.apache.velocity.tools.generic.EscapeTool"/> <!-- in a route --> <to uri="acctBatchProcessor" /> <log message="Processor received the record" /> <setHeader headerName="esc"> <ref>escTool</ref> </setHeader> <to uri="velocity://velocity/upsertAccount.vm"/> Run time error: java.lang.IllegalArgumentException: Cannot find expression in registry with ref: escTool at org.apache.camel.language.ref.RefLanguage$1.evaluate(RefLanguage.java:50)[89:org.apache.camel.camel-core:2.8. 0.fuse-01-13] On Mon, Feb 27, 2012 at 10:05 AM, Ramesh Sridharan <ramesh.sridha...@ihg.com > wrote: > This is the came version I use. I use it with fuse esb > > <camel.version>2.8.0-fuse-01-13</camel.version> > > > > > On Mon, Feb 27, 2012 at 1:56 AM, Claus Ibsen-2 [via Camel] < > ml-node+s465427n5518097...@n5.nabble.com> wrote: > >> On Mon, Feb 27, 2012 at 2:44 AM, ramesri <[hidden >> email]<http://user/SendEmail.jtp?type=node&node=5518097&i=0>> >> wrote: >> > Hi Christian >> > >> > I get error when I try to set a ref as stated below. Because the >> > <setHeader></setHeader> doesnot allow <ref> as a valid content. Valid >> > contents are only <constant>, <simple>, <method> >> > >> >> You need Camel 2.8 or better. What version of Camel are you using? >> http://camel.apache.org/ref-language.html >> >> > On Sat, Feb 25, 2012 at 8:32 AM, Christian Mueller [via Camel] < >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5518097&i=1>> >> wrote: >> > >> >> As Claus suggested, use >> >> >> >> <bean id="myBean" class="..." /> >> >> >> >> <setHeader headerName="myHeader"> >> >> <ref id="myBean" /> >> >> </setHeader> >> >> >> >> Best, >> >> Christian >> >> >> >> On Fri, Feb 24, 2012 at 6:07 PM, ramesri <[hidden email]< >> http://user/SendEmail.jtp?type=node&node=5515124&i=0>> >> >> wrote: >> >> >> >> > Thank you all for the inputs. Its just that I am new to Camel and >> >> having >> >> > trouble to implement in Spring DSL what is suggested by Christian. >> Can >> >> you >> >> > pls show me how to do this in Spring DSL. Assuming that I define >> the >> >> > EscapeTool as <bean id="escTool" >> >> > class="org.apache.velocity.tools.generic.EscapeTool"/>, how do I >> <ref> >> >> it >> >> > in the <setHeader headerName="esc"> ? >> >> > >> >> > Regards >> >> > Ramesh >> >> > >> >> > On Fri, Feb 24, 2012 at 4:01 AM, Christian Mueller [via Camel] < >> >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5515124&i=1>> >> >> >> wrote: >> >> > >> >> > > It's not only the velocity-tools provided classes what the user >> can >> >> use >> >> > > here. We have a custom class with some transformations (e.g. >> transform >> >> > the >> >> > > ISO two letter country code - e.g. "DE" - to the full name - e.g. >> >> > > "Deutschland"). >> >> > > May be adding some words how to use this functionality inside >> Camel on >> >> > our >> >> > > WIKI page is sufficient? I didn't like the idea to change the code >> >> "only" >> >> > > to autodetect the velocity-tools provided utillity classes - my >> 0,02 >> >> $... >> >> > > >> >> > > Best, >> >> > > Christian >> >> > > >> >> > > On Fri, Feb 24, 2012 at 8:44 AM, Claus Ibsen <[hidden email]< >> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=0>> >> >> > > wrote: >> >> > > >> >> > > > On Thu, Feb 23, 2012 at 8:59 PM, Reuben Garrett <[hidden email]< >> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=1>> >> >> > > >> >> > > > wrote: >> >> > > > > Ramesh, >> >> > > > > >> >> > > > > I'm not as knowledgeable as the committers, but it looks like >> >> you're >> >> > > > trying >> >> > > > > to attach an instance of the EscapeTool class to a header in >> your >> >> > > > Exchange >> >> > > > > and then invoke it later on inside the Velocity template. But >> >> when >> >> > > you >> >> > > > use >> >> > > > > a <constant/> expression in the Spring DSL, it just returns >> the >> >> text >> >> > > > within >> >> > > > > the <constant/> tags as a String. >> >> > > > > >> >> > > > > Christian's example in the Java DSL seems closer because it's >> >> > actually >> >> > > > > attaching a Class object (rather than the name of the class). >> >> Maybe >> >> > > if >> >> > > > you >> >> > > > > somehow instantiate an instance of EscapeTool and attach it to >> the >> >> > > > > exchange, you'll then be able to invoke it. The Java DSL >> might >> >> be >> >> > > more >> >> > > > > direct for this, but I'll bet there's an easy way to do it in >> the >> >> > > Spring >> >> > > > > DSL, too. >> >> > > > > >> >> > > > > That being said, I don't know much about Velocity. However >> the >> >> > > > <constant/> >> >> > > > > expression doesn't seem to be what you want. >> >> > > > > >> >> > > > >> >> > > > Yeah in XML DSLs you can use <ref> to refer to a bean to lookup >> and >> >> > use. >> >> > > > http://camel.apache.org/ref-language.html >> >> > > > >> >> > > > However maybe we can auto detect the velocity tools and provide >> it >> >> out >> >> > > > of the box? >> >> > > > >> >> > > > >> >> > > > > Claus, Christian - am I on the right track? >> >> > > > > >> >> > > > > ~ RNPG >> >> > > > > >> >> > > > > On Thu, Feb 23, 2012 at 11:15, ramesri <[hidden email]< >> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=2>> >> >> > > wrote: >> >> > > > > >> >> > > > >> Sorry, I set the header as and no luck. >> >> > > > >> >> >> > > > >> <setHeader headerName="esc"> >> >> > > > >> >> >> > > > >> >> >> > > > >> >> >> > > >> >> >> <constant>org.apache.velocity.tools.generic.EscapeTool.class</constant> >> >> > > > >> >> >> > > > >> </setHeader> >> >> > > > >> >> >> > > > >> >> >> > > > >> Thanks >> >> > > > >> Ramesh >> >> > > > >> >> >> > > > >> >> > > > >> >> > > > >> >> > > > -- >> >> > > > Claus Ibsen >> >> > > > ----------------- >> >> > > > FuseSource >> >> > > > Email: [hidden email]< >> >> > http://user/SendEmail.jtp?type=node&node=5512103&i=3> >> >> > > > Web: http://fusesource.com >> >> > > > Twitter: davsclaus, fusenews >> >> > > > Blog: http://davsclaus.blogspot.com/ >> >> > > > Author of Camel in Action: http://www.manning.com/ibsen/ >> >> > > > >> >> > > >> >> > > >> >> > > ------------------------------ >> >> > > If you reply to this email, your message will be added to the >> >> discussion >> >> > > below: >> >> > > >> >> > > >> >> > >> >> >> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5512103.html >> >> > > To start a new topic under Camel - Users, email >> >> > > [hidden email] < >> http://user/SendEmail.jtp?type=node&node=5515124&i=2> >> >> > > To unsubscribe from Camel - Users, click here< >> >> > >> >> > >> >> > > . >> >> > > NAML< >> >> > >> >> >> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml >> >> >> >> > > >> >> > > >> >> > >> >> > >> >> > -- >> >> > View this message in context: >> >> > >> >> >> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5513385.html >> >> >> >> > Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > >> >> >> >> >> >> ------------------------------ >> >> If you reply to this email, your message will be added to the >> discussion >> >> below: >> >> >> >> >> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5515124.html >> >> To start a new topic under Camel - Users, email >> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5518097&i=2> >> >> To unsubscribe from Camel - Users, click here< >> >> >> . >> >> NAML< >> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> >> >> >> > >> > >> > -- >> > View this message in context: >> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5517811.html >> >> > Sent from the Camel - Users mailing list archive at Nabble.com. >> >> >> >> -- >> Claus Ibsen >> ----------------- >> FuseSource >> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5518097&i=3> >> Web: http://fusesource.com >> Twitter: davsclaus, fusenews >> Blog: http://davsclaus.blogspot.com/ >> Author of Camel in Action: http://www.manning.com/ibsen/ >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the >> discussion below: >> >> http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5518097.html >> To start a new topic under Camel - Users, email >> ml-node+s465427n465428...@n5.nabble.com >> To unsubscribe from Camel - Users, click >> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=cmFtZXNoLnNyaWRoYXJhbkBpaGcuY29tfDQ2NTQyOHwxMjE3MTM3MDYz> >> . >> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> > > -- View this message in context: http://camel.465427.n5.nabble.com/How-to-use-escape-tool-esc-xml-somestrwithspclchars-in-camel-velocity-template-tp5505668p5519563.html Sent from the Camel - Users mailing list archive at Nabble.com.