You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by shekher awasthi <sh...@gmail.com> on 2011/07/22 12:21:20 UTC

FailedToCreateRouteException While using xslt for formatting XML

Hi All,

I am trying to use xslt to customize my generated XML as per the custom
structure

here is the code snippet for the same


context.addRoutes(*new* RouteBuilder() {

*public* *void* configure() {

from("file:data/csv?noop=true").unmarshal().csv().bean(*new
*

CSVConverterBean(),"processCSVInvoice").to("xslt:XMLConverter.xsl").to(
"file:data/csvoutput?fileName=test11.xml");

 }

});

context.start();

Thread.*sleep*(10000);

context.stop();

i am converting csv to raw XML and than trying to use xslt to convert the
raw XML to the customized structure.but when i am trying to use xslt it
giving me the following exception

Exception in thread "main" *org.apache.camel.FailedToCreateRouteException*:
Failed to create route route1 at: >>> To[xslt:XMLConverter.xsl] <<< in
route: Route[[From[file:data/csv?noop=true]] -> [Marshal[org.apache...
because of Failed to resolve endpoint: xslt://XMLConverter.xsl due to: No
component found with scheme: xslt

at org.apache.camel.model.RouteDefinition.addRoutes(*
RouteDefinition.java:815*)

at org.apache.camel.model.RouteDefinition.addRoutes(*
RouteDefinition.java:165*)

at org.apache.camel.impl.DefaultCamelContext.startRoute(*
DefaultCamelContext.java:706*)

at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(*
DefaultCamelContext.java:1643*)

at org.apache.camel.impl.DefaultCamelContext.doStartCamel(*
DefaultCamelContext.java:1432*)

at org.apache.camel.impl.DefaultCamelContext.doStart(*
DefaultCamelContext.java:1336*)

at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:67*)

at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:54*)

at org.apache.camel.impl.DefaultCamelContext.start(*
DefaultCamelContext.java:1314*)

at poc.test.TestPOC.main(*TestPOC.java:24*)

Caused by: *org.apache.camel.ResolveEndpointFailedException*: Failed to
resolve endpoint: xslt://XMLConverter.xsl due to: No component found with
scheme: xslt

at org.apache.camel.impl.DefaultCamelContext.getEndpoint(*
DefaultCamelContext.java:457*)

at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(*
CamelContextHelper.java:47*)

at org.apache.camel.model.RouteDefinition.resolveEndpoint(*
RouteDefinition.java:180*)

at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
DefaultRouteContext.java:110*)

at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
DefaultRouteContext.java:116*)

at org.apache.camel.model.SendDefinition.resolveEndpoint(*
SendDefinition.java:61*)

at org.apache.camel.model.SendDefinition.createProcessor(*
SendDefinition.java:55*)

at org.apache.camel.model.ProcessorDefinition.makeProcessor(*
ProcessorDefinition.java:410*)

at org.apache.camel.model.ProcessorDefinition.addRoutes(*
ProcessorDefinition.java:181*)

at org.apache.camel.model.RouteDefinition.addRoutes(*
RouteDefinition.java:812*)

... 9 more



i have following jars in the classpath

camel-core

camel-scsv

common-management

commons-csv

xstream

can any one point me what exactly going wrong here?

thanks in advance

Re: Refer to java constant from Simple Expression language

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jul 22, 2011 at 1:57 PM,  <de...@accenture.com> wrote:
> Hi,
>
> I am using simple expression language to define
>
> <camel:choice>
>                        <camel:when>
>                                <camel:
>                                        <camel:simple>${in.headers.abc} ==                                                              'xyz'</camel:simple>
>
> Instead of hard coding 'xyz' I would like to reference it from a constants file (Constants.XYZ). Is that possible in Spring DSL? Or is Java DSL the only option?
>

That is not possible.

You can use some of the dynamic scripting languages like Groovy for that.
http://camel.apache.org/languages.html


> Please recommend.
>
> Thanks,
> Deepa
>
>
>
>  ________________________________
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Refer to java constant from Simple Expression language

Posted by de...@accenture.com.
Hi,

I am using simple expression language to define

<camel:choice>
                        <camel:when>
                                <camel:
                                        <camel:simple>${in.headers.abc} ==                                                              'xyz'</camel:simple>

Instead of hard coding 'xyz' I would like to reference it from a constants file (Constants.XYZ). Is that possible in Spring DSL? Or is Java DSL the only option?

Please recommend.

Thanks,
Deepa



  ________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

Re: Multiple DSL - good practice

Posted by Willem Jiang <wi...@gmail.com>.
There are some pros and cons between the Spring DSL and Java DSL that 
you may already know.
Here is another note for it, when you are planing to deploy the camel 
route artifacts into the container ( OSGi or WebContainer). It will be 
handy if you using Spring DSL.

On 7/22/11 8:58 PM, deepa.va@accenture.com wrote:
> Hi All,
>
> Is it a good practice to use Multiple DSLs. Eg- Spring DSL&  Java DSL.
>
> Thanks,
> Deepa
>
>
>
>    ________________________________
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: Multiple DSL - good practice

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jul 22, 2011 at 2:58 PM,  <de...@accenture.com> wrote:
> Hi All,
>
> Is it a good practice to use Multiple DSLs. Eg- Spring DSL & Java DSL.
>

There is no best practice on that. But I think people either use one
or the other, to keep it similar/consistent so the developers more
easily can understand and maintain the source.

The Camel runtime do not care in which DSL you have use to create the routes.

Some of the GUI tooling works currently with XML only. For example the Fuse IDE.
http://fusesource.com/products/fuse-ide-camel/

For people who want GUI tooling that may tip the preference for XML over Java.
Notice the Fuse IDE can attach to any runtime Camel app and visualize
the route, regardless which DSL was used to create the route. Its only
the GUI designer which currently only supports XML (to be enhanced in
the future).


> Thanks,
> Deepa
>
>
>
>  ________________________________
> This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Multiple DSL - good practice

Posted by de...@accenture.com.
Hi All,

Is it a good practice to use Multiple DSLs. Eg- Spring DSL & Java DSL.

Thanks,
Deepa



  ________________________________
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.

Re: FailedToCreateRouteException While using xslt for formatting XML

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jul 22, 2011 at 6:11 PM, shekher awasthi
<sh...@gmail.com> wrote:
> Thanks Claus for the inputs, some how i detected myself just before your
> reply :),but still a question why this has been made a depedency on Spring
> whih means i have to put other spring jars in my classpath any specific
> reason to use this approach?
>

The xslt component uses some spring api to load the xslt file.
In Camel 2.9 we will rework this and have some components less
dependent on spring, among those is xslt, which we most likely will
moved into camel-core or a separate component.

> On Fri, Jul 22, 2011 at 5:04 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> You need camel-spring on the classpath.
>>
>>
>> On Fri, Jul 22, 2011 at 12:21 PM, shekher awasthi
>> <sh...@gmail.com> wrote:
>> > Hi All,
>> >
>> > I am trying to use xslt to customize my generated XML as per the custom
>> > structure
>> >
>> > here is the code snippet for the same
>> >
>> >
>> > context.addRoutes(*new* RouteBuilder() {
>> >
>> > *public* *void* configure() {
>> >
>> > from("file:data/csv?noop=true").unmarshal().csv().bean(*new
>> > *
>> >
>> > CSVConverterBean(),"processCSVInvoice").to("xslt:XMLConverter.xsl").to(
>> > "file:data/csvoutput?fileName=test11.xml");
>> >
>> >  }
>> >
>> > });
>> >
>> > context.start();
>> >
>> > Thread.*sleep*(10000);
>> >
>> > context.stop();
>> >
>> > i am converting csv to raw XML and than trying to use xslt to convert the
>> > raw XML to the customized structure.but when i am trying to use xslt it
>> > giving me the following exception
>> >
>> > Exception in thread "main"
>> *org.apache.camel.FailedToCreateRouteException*:
>> > Failed to create route route1 at: >>> To[xslt:XMLConverter.xsl] <<< in
>> > route: Route[[From[file:data/csv?noop=true]] -> [Marshal[org.apache...
>> > because of Failed to resolve endpoint: xslt://XMLConverter.xsl due to: No
>> > component found with scheme: xslt
>> >
>> > at org.apache.camel.model.RouteDefinition.addRoutes(*
>> > RouteDefinition.java:815*)
>> >
>> > at org.apache.camel.model.RouteDefinition.addRoutes(*
>> > RouteDefinition.java:165*)
>> >
>> > at org.apache.camel.impl.DefaultCamelContext.startRoute(*
>> > DefaultCamelContext.java:706*)
>> >
>> > at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(*
>> > DefaultCamelContext.java:1643*)
>> >
>> > at org.apache.camel.impl.DefaultCamelContext.doStartCamel(*
>> > DefaultCamelContext.java:1432*)
>> >
>> > at org.apache.camel.impl.DefaultCamelContext.doStart(*
>> > DefaultCamelContext.java:1336*)
>> >
>> > at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:67*)
>> >
>> > at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:54*)
>> >
>> > at org.apache.camel.impl.DefaultCamelContext.start(*
>> > DefaultCamelContext.java:1314*)
>> >
>> > at poc.test.TestPOC.main(*TestPOC.java:24*)
>> >
>> > Caused by: *org.apache.camel.ResolveEndpointFailedException*: Failed to
>> > resolve endpoint: xslt://XMLConverter.xsl due to: No component found with
>> > scheme: xslt
>> >
>> > at org.apache.camel.impl.DefaultCamelContext.getEndpoint(*
>> > DefaultCamelContext.java:457*)
>> >
>> > at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(*
>> > CamelContextHelper.java:47*)
>> >
>> > at org.apache.camel.model.RouteDefinition.resolveEndpoint(*
>> > RouteDefinition.java:180*)
>> >
>> > at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
>> > DefaultRouteContext.java:110*)
>> >
>> > at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
>> > DefaultRouteContext.java:116*)
>> >
>> > at org.apache.camel.model.SendDefinition.resolveEndpoint(*
>> > SendDefinition.java:61*)
>> >
>> > at org.apache.camel.model.SendDefinition.createProcessor(*
>> > SendDefinition.java:55*)
>> >
>> > at org.apache.camel.model.ProcessorDefinition.makeProcessor(*
>> > ProcessorDefinition.java:410*)
>> >
>> > at org.apache.camel.model.ProcessorDefinition.addRoutes(*
>> > ProcessorDefinition.java:181*)
>> >
>> > at org.apache.camel.model.RouteDefinition.addRoutes(*
>> > RouteDefinition.java:812*)
>> >
>> > ... 9 more
>> >
>> >
>> >
>> > i have following jars in the classpath
>> >
>> > camel-core
>> >
>> > camel-scsv
>> >
>> > common-management
>> >
>> > commons-csv
>> >
>> > xstream
>> >
>> > can any one point me what exactly going wrong here?
>> >
>> > thanks in advance
>> >
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: FailedToCreateRouteException While using xslt for formatting XML

Posted by shekher awasthi <sh...@gmail.com>.
Thanks Claus for the inputs, some how i detected myself just before your
reply :),but still a question why this has been made a depedency on Spring
whih means i have to put other spring jars in my classpath any specific
reason to use this approach?

On Fri, Jul 22, 2011 at 5:04 PM, Claus Ibsen <cl...@gmail.com> wrote:

> You need camel-spring on the classpath.
>
>
> On Fri, Jul 22, 2011 at 12:21 PM, shekher awasthi
> <sh...@gmail.com> wrote:
> > Hi All,
> >
> > I am trying to use xslt to customize my generated XML as per the custom
> > structure
> >
> > here is the code snippet for the same
> >
> >
> > context.addRoutes(*new* RouteBuilder() {
> >
> > *public* *void* configure() {
> >
> > from("file:data/csv?noop=true").unmarshal().csv().bean(*new
> > *
> >
> > CSVConverterBean(),"processCSVInvoice").to("xslt:XMLConverter.xsl").to(
> > "file:data/csvoutput?fileName=test11.xml");
> >
> >  }
> >
> > });
> >
> > context.start();
> >
> > Thread.*sleep*(10000);
> >
> > context.stop();
> >
> > i am converting csv to raw XML and than trying to use xslt to convert the
> > raw XML to the customized structure.but when i am trying to use xslt it
> > giving me the following exception
> >
> > Exception in thread "main"
> *org.apache.camel.FailedToCreateRouteException*:
> > Failed to create route route1 at: >>> To[xslt:XMLConverter.xsl] <<< in
> > route: Route[[From[file:data/csv?noop=true]] -> [Marshal[org.apache...
> > because of Failed to resolve endpoint: xslt://XMLConverter.xsl due to: No
> > component found with scheme: xslt
> >
> > at org.apache.camel.model.RouteDefinition.addRoutes(*
> > RouteDefinition.java:815*)
> >
> > at org.apache.camel.model.RouteDefinition.addRoutes(*
> > RouteDefinition.java:165*)
> >
> > at org.apache.camel.impl.DefaultCamelContext.startRoute(*
> > DefaultCamelContext.java:706*)
> >
> > at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(*
> > DefaultCamelContext.java:1643*)
> >
> > at org.apache.camel.impl.DefaultCamelContext.doStartCamel(*
> > DefaultCamelContext.java:1432*)
> >
> > at org.apache.camel.impl.DefaultCamelContext.doStart(*
> > DefaultCamelContext.java:1336*)
> >
> > at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:67*)
> >
> > at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:54*)
> >
> > at org.apache.camel.impl.DefaultCamelContext.start(*
> > DefaultCamelContext.java:1314*)
> >
> > at poc.test.TestPOC.main(*TestPOC.java:24*)
> >
> > Caused by: *org.apache.camel.ResolveEndpointFailedException*: Failed to
> > resolve endpoint: xslt://XMLConverter.xsl due to: No component found with
> > scheme: xslt
> >
> > at org.apache.camel.impl.DefaultCamelContext.getEndpoint(*
> > DefaultCamelContext.java:457*)
> >
> > at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(*
> > CamelContextHelper.java:47*)
> >
> > at org.apache.camel.model.RouteDefinition.resolveEndpoint(*
> > RouteDefinition.java:180*)
> >
> > at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
> > DefaultRouteContext.java:110*)
> >
> > at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
> > DefaultRouteContext.java:116*)
> >
> > at org.apache.camel.model.SendDefinition.resolveEndpoint(*
> > SendDefinition.java:61*)
> >
> > at org.apache.camel.model.SendDefinition.createProcessor(*
> > SendDefinition.java:55*)
> >
> > at org.apache.camel.model.ProcessorDefinition.makeProcessor(*
> > ProcessorDefinition.java:410*)
> >
> > at org.apache.camel.model.ProcessorDefinition.addRoutes(*
> > ProcessorDefinition.java:181*)
> >
> > at org.apache.camel.model.RouteDefinition.addRoutes(*
> > RouteDefinition.java:812*)
> >
> > ... 9 more
> >
> >
> >
> > i have following jars in the classpath
> >
> > camel-core
> >
> > camel-scsv
> >
> > common-management
> >
> > commons-csv
> >
> > xstream
> >
> > can any one point me what exactly going wrong here?
> >
> > thanks in advance
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: FailedToCreateRouteException While using xslt for formatting XML

Posted by Claus Ibsen <cl...@gmail.com>.
You need camel-spring on the classpath.


On Fri, Jul 22, 2011 at 12:21 PM, shekher awasthi
<sh...@gmail.com> wrote:
> Hi All,
>
> I am trying to use xslt to customize my generated XML as per the custom
> structure
>
> here is the code snippet for the same
>
>
> context.addRoutes(*new* RouteBuilder() {
>
> *public* *void* configure() {
>
> from("file:data/csv?noop=true").unmarshal().csv().bean(*new
> *
>
> CSVConverterBean(),"processCSVInvoice").to("xslt:XMLConverter.xsl").to(
> "file:data/csvoutput?fileName=test11.xml");
>
>  }
>
> });
>
> context.start();
>
> Thread.*sleep*(10000);
>
> context.stop();
>
> i am converting csv to raw XML and than trying to use xslt to convert the
> raw XML to the customized structure.but when i am trying to use xslt it
> giving me the following exception
>
> Exception in thread "main" *org.apache.camel.FailedToCreateRouteException*:
> Failed to create route route1 at: >>> To[xslt:XMLConverter.xsl] <<< in
> route: Route[[From[file:data/csv?noop=true]] -> [Marshal[org.apache...
> because of Failed to resolve endpoint: xslt://XMLConverter.xsl due to: No
> component found with scheme: xslt
>
> at org.apache.camel.model.RouteDefinition.addRoutes(*
> RouteDefinition.java:815*)
>
> at org.apache.camel.model.RouteDefinition.addRoutes(*
> RouteDefinition.java:165*)
>
> at org.apache.camel.impl.DefaultCamelContext.startRoute(*
> DefaultCamelContext.java:706*)
>
> at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(*
> DefaultCamelContext.java:1643*)
>
> at org.apache.camel.impl.DefaultCamelContext.doStartCamel(*
> DefaultCamelContext.java:1432*)
>
> at org.apache.camel.impl.DefaultCamelContext.doStart(*
> DefaultCamelContext.java:1336*)
>
> at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:67*)
>
> at org.apache.camel.impl.ServiceSupport.start(*ServiceSupport.java:54*)
>
> at org.apache.camel.impl.DefaultCamelContext.start(*
> DefaultCamelContext.java:1314*)
>
> at poc.test.TestPOC.main(*TestPOC.java:24*)
>
> Caused by: *org.apache.camel.ResolveEndpointFailedException*: Failed to
> resolve endpoint: xslt://XMLConverter.xsl due to: No component found with
> scheme: xslt
>
> at org.apache.camel.impl.DefaultCamelContext.getEndpoint(*
> DefaultCamelContext.java:457*)
>
> at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(*
> CamelContextHelper.java:47*)
>
> at org.apache.camel.model.RouteDefinition.resolveEndpoint(*
> RouteDefinition.java:180*)
>
> at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
> DefaultRouteContext.java:110*)
>
> at org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(*
> DefaultRouteContext.java:116*)
>
> at org.apache.camel.model.SendDefinition.resolveEndpoint(*
> SendDefinition.java:61*)
>
> at org.apache.camel.model.SendDefinition.createProcessor(*
> SendDefinition.java:55*)
>
> at org.apache.camel.model.ProcessorDefinition.makeProcessor(*
> ProcessorDefinition.java:410*)
>
> at org.apache.camel.model.ProcessorDefinition.addRoutes(*
> ProcessorDefinition.java:181*)
>
> at org.apache.camel.model.RouteDefinition.addRoutes(*
> RouteDefinition.java:812*)
>
> ... 9 more
>
>
>
> i have following jars in the classpath
>
> camel-core
>
> camel-scsv
>
> common-management
>
> commons-csv
>
> xstream
>
> can any one point me what exactly going wrong here?
>
> thanks in advance
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/