You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by OrackBahama <jd...@metadok.de> on 2012/02/07 10:55:43 UTC

Problem with Smooks/TypeConverter since camel 2.9.0

Hi,

since the migration to camel version 2.9.0, I'm experiencing the following
problem (in pseudocode for clarity ;-)). ( Was working in versions 2.7.x ...
)

from( "file://inbox-with-flatfiles-in-textformat-no-xml...")
  .to( "smooks://smooks-config.xml" )
;

causes the following exception: 

Caused by: java.lang.IllegalArgumentException:
javax.xml.transform.stax.StAXSource 
Source types not yet supported by the SAX Filter. Only supports StreamSource
and JavaSource at present.
	at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:66)
	at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:61)
	at org.milyn.Smooks._filter(Smooks.java:516)

The following workaround works well - but since I don't know anything about
the maximum filesize to be
expected - I feel uncomfortable by converting the file content to String
class:

from( "file://inbox-with-flatfiles-in-textformat-no-xml...")
  .convertBodyTo( String.class )
  .to( "smooks://smooks-config.xml" )
;

The file passed to smooks is not really a SAXSource since it is a flat
textfile. It is only parsed in a SAX compatible manner by smooks ...

How to use a different TypeConverter (which ?) correctly to even handle huge
files ?
Advice very much appreciated - thanks in advance !




--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Smooks-TypeConverter-since-camel-2-9-0-tp5462700p5462700.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with Smooks/TypeConverter since camel 2.9.0

Posted by Willem Jiang <wi...@gmail.com>.
There are some enhancements to prefer to Stax API instead of the old 
DOMSource in Camel 2.9.0.
I think that could cause your test failed.

As Claus has said it could be better to adapt to Stax API which will be 
much faster if you are using JDK 1.6.


On 2/8/12 12:20 PM, OrackBahama wrote:
> Thanks for the reply - I can confirm that explicitly converting to
> StreamSource does work !
>
> But I'm worrying why - by changing the camel version to 2.9 - I have to
> change formerly tested code ?
>
> Something in the automatic type conversion strategy must have changed.
>
> Maybe somebody can explain how Camel chooses the appropriate type converter,
> since the formerly used one is still available in version 2.9 but an
> obviously inapplicable one has been preferred .... ?!?
>
> (Although I *seems* to decrease complexity or at least the number of lines
> of code, I would prefer less implicit automatisms or hidden logic)
>
> Best regards
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Smooks-TypeConverter-since-camel-2-9-0-tp5462700p5465502.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


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

Re: Problem with Smooks/TypeConverter since camel 2.9.0

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You did not answer which smooks component you are using?

And the StAX API is part of JDK6, which apparently Smooks does not support.
So I suggest to go to Smooks team and ask them to support that.


On Wed, Feb 8, 2012 at 5:20 AM, OrackBahama <jd...@metadok.de> wrote:
> Thanks for the reply - I can confirm that explicitly converting to
> StreamSource does work !
>
> But I'm worrying why - by changing the camel version to 2.9 - I have to
> change formerly tested code ?
>
> Something in the automatic type conversion strategy must have changed.
>
> Maybe somebody can explain how Camel chooses the appropriate type converter,
> since the formerly used one is still available in version 2.9 but an
> obviously inapplicable one has been preferred .... ?!?
>
> (Although I *seems* to decrease complexity or at least the number of lines
> of code, I would prefer less implicit automatisms or hidden logic)
>
> Best regards
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Smooks-TypeConverter-since-camel-2-9-0-tp5462700p5465502.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
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: Problem with Smooks/TypeConverter since camel 2.9.0

Posted by OrackBahama <jd...@metadok.de>.
Thanks for the reply - I can confirm that explicitly converting to
StreamSource does work !

But I'm worrying why - by changing the camel version to 2.9 - I have to
change formerly tested code ?

Something in the automatic type conversion strategy must have changed. 

Maybe somebody can explain how Camel chooses the appropriate type converter,
since the formerly used one is still available in version 2.9 but an
obviously inapplicable one has been preferred .... ?!? 

(Although I *seems* to decrease complexity or at least the number of lines
of code, I would prefer less implicit automatisms or hidden logic)

Best regards

--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Smooks-TypeConverter-since-camel-2-9-0-tp5462700p5465502.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with Smooks/TypeConverter since camel 2.9.0

Posted by Willem Jiang <wi...@gmail.com>.
You can try to convert the body to StreamSource.
I think it could be better.

On 2/7/12 5:55 PM, OrackBahama wrote:
> Hi,
>
> since the migration to camel version 2.9.0, I'm experiencing the following
> problem (in pseudocode for clarity ;-)). ( Was working in versions 2.7.x ...
> )
>
> from( "file://inbox-with-flatfiles-in-textformat-no-xml...")
>    .to( "smooks://smooks-config.xml" )
> ;
>
> causes the following exception:
>
> Caused by: java.lang.IllegalArgumentException:
> javax.xml.transform.stax.StAXSource
> Source types not yet supported by the SAX Filter. Only supports StreamSource
> and JavaSource at present.
> 	at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:66)
> 	at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:61)
> 	at org.milyn.Smooks._filter(Smooks.java:516)
>
> The following workaround works well - but since I don't know anything about
> the maximum filesize to be
> expected - I feel uncomfortable by converting the file content to String
> class:
>
> from( "file://inbox-with-flatfiles-in-textformat-no-xml...")
>    .convertBodyTo( String.class )
>    .to( "smooks://smooks-config.xml" )
> ;
>
> The file passed to smooks is not really a SAXSource since it is a flat
> textfile. It is only parsed in a SAX compatible manner by smooks ...
>
> How to use a different TypeConverter (which ?) correctly to even handle huge
> files ?
> Advice very much appreciated - thanks in advance !
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Smooks-TypeConverter-since-camel-2-9-0-tp5462700p5462700.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


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

Re: Problem with Smooks/TypeConverter since camel 2.9.0

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Which smooks component are you using? The one from the Smooks project itself?
Or the old deprecated from camel-extra ?

On Tue, Feb 7, 2012 at 10:55 AM, OrackBahama <jd...@metadok.de> wrote:
> Hi,
>
> since the migration to camel version 2.9.0, I'm experiencing the following
> problem (in pseudocode for clarity ;-)). ( Was working in versions 2.7.x ...
> )
>
> from( "file://inbox-with-flatfiles-in-textformat-no-xml...")
>  .to( "smooks://smooks-config.xml" )
> ;
>
> causes the following exception:
>
> Caused by: java.lang.IllegalArgumentException:
> javax.xml.transform.stax.StAXSource
> Source types not yet supported by the SAX Filter. Only supports StreamSource
> and JavaSource at present.
>        at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:66)
>        at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:61)
>        at org.milyn.Smooks._filter(Smooks.java:516)
>
> The following workaround works well - but since I don't know anything about
> the maximum filesize to be
> expected - I feel uncomfortable by converting the file content to String
> class:
>
> from( "file://inbox-with-flatfiles-in-textformat-no-xml...")
>  .convertBodyTo( String.class )
>  .to( "smooks://smooks-config.xml" )
> ;
>
> The file passed to smooks is not really a SAXSource since it is a flat
> textfile. It is only parsed in a SAX compatible manner by smooks ...
>
> How to use a different TypeConverter (which ?) correctly to even handle huge
> files ?
> Advice very much appreciated - thanks in advance !
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-Smooks-TypeConverter-since-camel-2-9-0-tp5462700p5462700.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
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/