You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Monica_G <mg...@gmail.com> on 2009/10/21 23:17:29 UTC
camel-velocity and #parse() question
Hi,
I am using the camel-velocity component and want to call #parse() in my vm
template. However, I get the following exception:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'com/foo/bar/util/Header.vm'.
Does anyone know how to resolve this?
Here is what I am doing:
In my RouteBuilder I have the following:
public void configure() throws Exception {
//Note: the inputEndpoint and destinationEndpoint are set via spring
injection
from(inputEndpoint)
.to("velocity:com/foo/bar/util/OrderXml.vm")
.to(destinationEndpoint)
.end();
}
In my vm template I have the following:
#parse("com/foo/bar/util/Header.vm")
<Order>
<order xml snipped...>
</Order>
I want to insert the Header.vm because I have some standard xml header info
which I want to be able to reuse across xml files.
I've read the
http://velocity.apache.org/engine/devel/developer-guide.html#configurationexamples
page and I'm wondering if I need to set the 'file.resource.loader.path'
value. However I'm not sure how to do this through camel, or if this is
even the right approach.
Thanks,
Monica
--
View this message in context: http://www.nabble.com/camel-velocity-and--parse%28%29-question-tp26000423p26000423.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-velocity and #parse() question
Posted by Willem Jiang <wi...@gmail.com>.
Hi Monica,
I just committed a patch[1] for the CAMEL-2091[2] which could make your
#parser work in Camel trunk (2.1-SNAPSHOT).
[1]http://svn.apache.org/viewvc?view=revision&revision=829724
[2]https://issues.apache.org/activemq/browse/CAMEL-2091
Willem
Monica_G wrote:
> Hello Willem,
>
> Thank you for your reply and looking into the issue.
>
> I just wanted to clarify that I'm not certain that passing in the Properties
> config file will solve my ResourceNotFoundException. I think it may be the
> way to go, but I don't know for sure.
>
> Thanks,
>
> Monica
>
>
Re: camel-velocity and #parse() question
Posted by Monica_G <mg...@gmail.com>.
Hello Willem,
Thank you for your reply and looking into the issue.
I just wanted to clarify that I'm not certain that passing in the Properties
config file will solve my ResourceNotFoundException. I think it may be the
way to go, but I don't know for sure.
Thanks,
Monica
--
View this message in context: http://www.nabble.com/camel-velocity-and--parse%28%29-question-tp26000423p26012659.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-velocity and #parse() question
Posted by Willem Jiang <wi...@gmail.com>.
The template should be
${body}
<Order>
<order xml snipped...>
</Order> ..
I just committed a quick fix for the CAMEL-2092.
Willem
Willem Jiang wrote:
> Oh, the OrderXml template should be
> ${Body}
> <Order>
> <order xml snipped...>
> </Order> ...
>
> BTW, I just wrote a simple test against the latest camel-velocity
> component. There is a bug[1] of camel-velocity and a quick fix is coming
> up.
>
> [1]https://issues.apache.org/activemq/browse/CAMEL-2092
>
> Willem
>
>
> Willem Jiang wrote:
>> Hi Monica,
>>
>> I think we can introduce a new parameter which accepts the velocity's
>> properties configuration.
>>
>> I just created a JIRA[1] for it, before we resolved this issue, I
>> don't think current camel-velocity supports this configuration
>>
>> Before that , I think you may try to let the message the velocity
>> endpoint twice.
>>
>> from(inputEndpoint)
>> .to("velocity:com/foo/bar/util/Headers.vm")
>> .to("velocity:com/foo/bar/util/OrderXml.vm")
>> .to(destinationEndpoint)
>> .end();
>>
>> And you OrderXml template can be
>> {Body}
>> <Order>
>> <order xml snipped...>
>> </Order>
>>
>> [1]https://issues.apache.org/activemq/browse/CAMEL-2091
>>
>> Willem
>> Monica_G wrote:
>>> Hi,
>>>
>>> I am using the camel-velocity component and want to call #parse() in
>>> my vm
>>> template. However, I get the following exception:
>>> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
>>> resource 'com/foo/bar/util/Header.vm'. Does anyone know how to
>>> resolve this?
>>>
>>> Here is what I am doing:
>>>
>>> In my RouteBuilder I have the following:
>>>
>>> public void configure() throws Exception {
>>> //Note: the inputEndpoint and destinationEndpoint are set via spring
>>> injection
>>> from(inputEndpoint) .to("velocity:com/foo/bar/util/OrderXml.vm")
>>> .to(destinationEndpoint)
>>> .end();
>>> }
>>>
>>> In my vm template I have the following:
>>> #parse("com/foo/bar/util/Header.vm")
>>> <Order>
>>> <order xml snipped...>
>>> </Order>
>>>
>>> I want to insert the Header.vm because I have some standard xml
>>> header info
>>> which I want to be able to reuse across xml files.
>>>
>>> I've read the
>>> http://velocity.apache.org/engine/devel/developer-guide.html#configurationexamples
>>>
>>> page and I'm wondering if I need to set the 'file.resource.loader.path'
>>> value. However I'm not sure how to do this through camel, or if this is
>>> even the right approach.
>>>
>>> Thanks,
>>>
>>> Monica
>>
>>
>
>
Re: camel-velocity and #parse() question
Posted by Willem Jiang <wi...@gmail.com>.
Oh, the OrderXml template should be
${Body}
<Order>
<order xml snipped...>
</Order> ...
BTW, I just wrote a simple test against the latest camel-velocity
component. There is a bug[1] of camel-velocity and a quick fix is coming up.
[1]https://issues.apache.org/activemq/browse/CAMEL-2092
Willem
Willem Jiang wrote:
> Hi Monica,
>
> I think we can introduce a new parameter which accepts the velocity's
> properties configuration.
>
> I just created a JIRA[1] for it, before we resolved this issue, I don't
> think current camel-velocity supports this configuration
>
> Before that , I think you may try to let the message the velocity
> endpoint twice.
>
> from(inputEndpoint)
> .to("velocity:com/foo/bar/util/Headers.vm")
> .to("velocity:com/foo/bar/util/OrderXml.vm")
> .to(destinationEndpoint)
> .end();
>
> And you OrderXml template can be
> {Body}
> <Order>
> <order xml snipped...>
> </Order>
>
> [1]https://issues.apache.org/activemq/browse/CAMEL-2091
>
> Willem
> Monica_G wrote:
>> Hi,
>>
>> I am using the camel-velocity component and want to call #parse() in
>> my vm
>> template. However, I get the following exception:
>> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
>> resource 'com/foo/bar/util/Header.vm'.
>> Does anyone know how to resolve this?
>>
>> Here is what I am doing:
>>
>> In my RouteBuilder I have the following:
>>
>> public void configure() throws Exception {
>> //Note: the inputEndpoint and destinationEndpoint are set via spring
>> injection
>> from(inputEndpoint) .to("velocity:com/foo/bar/util/OrderXml.vm")
>> .to(destinationEndpoint)
>> .end();
>> }
>>
>> In my vm template I have the following:
>> #parse("com/foo/bar/util/Header.vm")
>> <Order>
>> <order xml snipped...>
>> </Order>
>>
>> I want to insert the Header.vm because I have some standard xml header
>> info
>> which I want to be able to reuse across xml files.
>>
>> I've read the
>> http://velocity.apache.org/engine/devel/developer-guide.html#configurationexamples
>>
>> page and I'm wondering if I need to set the 'file.resource.loader.path'
>> value. However I'm not sure how to do this through camel, or if this is
>> even the right approach.
>>
>> Thanks,
>>
>> Monica
>
>
Re: camel-velocity and #parse() question
Posted by Willem Jiang <wi...@gmail.com>.
Hi Monica,
I think we can introduce a new parameter which accepts the velocity's
properties configuration.
I just created a JIRA[1] for it, before we resolved this issue, I don't
think current camel-velocity supports this configuration
Before that , I think you may try to let the message the velocity
endpoint twice.
from(inputEndpoint)
.to("velocity:com/foo/bar/util/Headers.vm")
.to("velocity:com/foo/bar/util/OrderXml.vm")
.to(destinationEndpoint)
.end();
And you OrderXml template can be
{Body}
<Order>
<order xml snipped...>
</Order>
[1]https://issues.apache.org/activemq/browse/CAMEL-2091
Willem
Monica_G wrote:
> Hi,
>
> I am using the camel-velocity component and want to call #parse() in my vm
> template. However, I get the following exception:
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource 'com/foo/bar/util/Header.vm'.
>
> Does anyone know how to resolve this?
>
> Here is what I am doing:
>
> In my RouteBuilder I have the following:
>
> public void configure() throws Exception {
> //Note: the inputEndpoint and destinationEndpoint are set via spring
> injection
> from(inputEndpoint)
> .to("velocity:com/foo/bar/util/OrderXml.vm")
> .to(destinationEndpoint)
> .end();
> }
>
> In my vm template I have the following:
> #parse("com/foo/bar/util/Header.vm")
> <Order>
> <order xml snipped...>
> </Order>
>
> I want to insert the Header.vm because I have some standard xml header info
> which I want to be able to reuse across xml files.
>
> I've read the
> http://velocity.apache.org/engine/devel/developer-guide.html#configurationexamples
> page and I'm wondering if I need to set the 'file.resource.loader.path'
> value. However I'm not sure how to do this through camel, or if this is
> even the right approach.
>
> Thanks,
>
> Monica