You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vishal Changrani <vi...@ericsson.com> on 2013/01/29 18:17:31 UTC

XML Validation fails with 2.10.3. Used to work in 2.9.2

Hi,
 I am in the process of upgrading Camel from 2.9.2 to 2.10.3 and I notice that the validatoin component keeps failing with the exception -
"Source parameter of type 'javax.xml.transform.stream.StreamSource' is not compatible with result parameter of type 'javax.xml.transform.stream.StreamResult'"

That is because the Java api for validate will not accept StreamSource as source for the validate(source,result) method.

I see that the org.apache.camel.processor.validation.ValidatingProcessor.process method in 2.10.3 does an extra check - isInputStreamNeeded which tends to return true causing the input body to be converted to a StreamSource and not a SAX Source as it was the case earlier.

My route is as below,

                                                .from("file://..........")
                                                .to("ejb:cms/AlarmActivityLogManager/local?method=logIngestInfo(*, 'Starting XSD validation')")
                                                .to(validator:my_xsd.xsd)
                                                .to("ejb:cms/AlarmActivityLogManager/local?method=logIngestInfo(*, 'Finished XSD validation')")

The exchange body when it comes to the validator component is just a name of the file that's being processed.

Please can someone comment?

Thanks,
-v-


Re: XML Validation fails with 2.10.3. Used to work in 2.9.2

Posted by Willem jiang <wi...@gmail.com>.
I'm not sure if the openejb did some work to load the xerces jar it ships.  


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, February 7, 2013 at 2:38 AM, vishal1981 wrote:

> Well I had an xerces jar coming from openejb. If I removed that it works.
> This was on 2.10.3.
> What I dont understand is why would the the jre try and use a parser in an
> external jar when it has the same one available as part of the java library.
> Havent tried with 2.10.2 and that jar in the classpath.
> thanks for your replies.
> regards,
> v
>  
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/XML-Validation-fails-with-2-10-3-Used-to-work-in-2-9-2-tp5726504p5727047.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: XML Validation fails with 2.10.3. Used to work in 2.9.2

Posted by vishal1981 <vi...@ericsson.com>.
Well I had an xerces jar coming from openejb. If I removed that it works.
This was on 2.10.3.
What I dont understand is why would the the jre try and use a parser in an
external jar when it has the same one available as part of the java library.
Havent tried with 2.10.2 and that jar in the classpath.
thanks for your replies.
regards,
v





--
View this message in context: http://camel.465427.n5.nabble.com/XML-Validation-fails-with-2-10-3-Used-to-work-in-2-9-2-tp5726504p5727047.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: XML Validation fails with 2.10.3. Used to work in 2.9.2

Posted by Willem jiang <wi...@gmail.com>.
It should be fixed with CAMEL-6020[1] recently.
Please feel free to verify it with last Camel 2.10.x SNAPSHOT

[1]https://issues.apache.org/jira/browse/CAMEL-6020  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Friday, February 1, 2013 at 8:49 PM, Claus Ibsen wrote:

> On Tue, Jan 29, 2013 at 6:17 PM, Vishal Changrani
> <vishal.changrani@ericsson.com (mailto:vishal.changrani@ericsson.com)> wrote:
> > Hi,
> > I am in the process of upgrading Camel from 2.9.2 to 2.10.3 and I notice that the validatoin component keeps failing with the exception -
> > "Source parameter of type 'javax.xml.transform.stream.StreamSource' is not compatible with result parameter of type 'javax.xml.transform.stream.StreamResult'"
> >  
> > That is because the Java api for validate will not accept StreamSource as source for the validate(source,result) method.
> >  
> > I see that the org.apache.camel.processor.validation.ValidatingProcessor.process method in 2.10.3 does an extra check - isInputStreamNeeded which tends to return true causing the input body to be converted to a StreamSource and not a SAX Source as it was the case earlier.
> >  
> > My route is as below,
> >  
> > .from("file://..........")
> > .to("ejb:cms/AlarmActivityLogManager/local?method=logIngestInfo(*, 'Starting XSD validation')")
> > .to(validator:my_xsd.xsd)
> > .to("ejb:cms/AlarmActivityLogManager/local?method=logIngestInfo(*, 'Finished XSD validation')")
> >  
> > The exchange body when it comes to the validator component is just a name of the file that's being processed.
> >  
> > Please can someone comment?
>  
> Try using Camel 2.10.2.
>  
>  
> > Thanks,
> > -v-
>  
>  
>  
>  
>  
> --  
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen




Re: XML Validation fails with 2.10.3. Used to work in 2.9.2

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Jan 29, 2013 at 6:17 PM, Vishal Changrani
<vi...@ericsson.com> wrote:
> Hi,
>  I am in the process of upgrading Camel from 2.9.2 to 2.10.3 and I notice that the validatoin component keeps failing with the exception -
> "Source parameter of type 'javax.xml.transform.stream.StreamSource' is not compatible with result parameter of type 'javax.xml.transform.stream.StreamResult'"
>
> That is because the Java api for validate will not accept StreamSource as source for the validate(source,result) method.
>
> I see that the org.apache.camel.processor.validation.ValidatingProcessor.process method in 2.10.3 does an extra check - isInputStreamNeeded which tends to return true causing the input body to be converted to a StreamSource and not a SAX Source as it was the case earlier.
>
> My route is as below,
>
>                                                 .from("file://..........")
>                                                 .to("ejb:cms/AlarmActivityLogManager/local?method=logIngestInfo(*, 'Starting XSD validation')")
>                                                 .to(validator:my_xsd.xsd)
>                                                 .to("ejb:cms/AlarmActivityLogManager/local?method=logIngestInfo(*, 'Finished XSD validation')")
>
> The exchange body when it comes to the validator component is just a name of the file that's being processed.
>
> Please can someone comment?
>

Try using Camel 2.10.2.


> Thanks,
> -v-
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen