XSLT/JAXB exception

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

XSLT/JAXB exception

Nord, James-2
HI all,
 
I have a Linux only issue with an XLST Transform and JAX-B. The same code runs fine on Windows XP (sun 32bit JDK 1.6.0_16 in both cases)

   TransformerFactory factory = TransformerFactory.newInstance();
   template = factory.newTemplates(xsltFile); // this is an actual java.io.File
   Transformer transformer = template.newTransformer();
   Document dom = ... // obtain w3C DOM
  
   JAXBResult result = new JAXBResult(JAXBContext.newInstance(Catalogue.class)); //Catalogue is a JAXB generated class
  
   transformer.transform(new DOMSource(dom), result);  
   return (Catalogue) result.getResult();

this results in the attached exception when run on Linux only (Windows completes this without issue).

However If I modify the code to go via an intermediate w3c DOM as follows then it works on both windows and Linux.

   TransformerFactory factory = TransformerFactory.newInstance();
   template = factory.newTemplates(xsltFile); // this is an actual java.io.File
   Transformer transformer = template.newTransformer();
   Document dom = ... // obtain w3C DOM
  
   DOMResult result = new DOMResult();
   Document newDoc = transformer.transform(new DOMSource(dom), result);
   Unmarshaller unmarshaller = JAXBContext.newInstance(Catalogue.class).createUnmarshaller();
   return (Catalogue) unmarshaller.unmarshal(newDoc);

I'm not sure why the first block fails only on Linux (there is no custom security manager on either windows or Linux) and it doesn't fill me with that warm fuzzy feeling.  Is there some step I'm missing in the first attempt?  I'm using Saxon HE 9.2.0.2

BTW: the purchase page for the pro and enterprise editions is unusable (http://www.saxonica.com/erol/erol.html gives me a blank page in both Firefox 3.5 and IE 7)

Regards,

    /James


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [hidden email] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 

stack_trace.txt (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: XSLT/JAXB exception

Michael Kay
There's no indication in the stack trace that this problem might have anything to do with Saxon. Saxon is writing the transformation result to a ContentHandler that is part of JAXB code, and the JAXB code has raised an exception. Not knowing JAXB at all well, I've no idea why it's failing.
 
BTW: the purchase page for the pro and enterprise editions is unusable (http://www.saxonica.com/erol/erol.html gives me a blank page in both Firefox 3.5 and IE 7) 
 
It looks OK to me at the moment, though still showing the old product list. But the people who look after it for Saxonica are working on an upgrade (both of the shop software and the Saxon product list) and you might have caught it at a bad moment. Sorry about that.
 

Regards,

    /James


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [hidden email] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT/JAXB exception

Rob Koberg-2
In reply to this post by Nord, James-2
How are you setting saxon to be your XSL processor?

-Rob


On Aug 13, 2009, at 9:58 AM, Nord, James wrote:

> HI all,
>
> I have a Linux only issue with an XLST Transform and JAX-B. The same  
> code runs fine on Windows XP (sun 32bit JDK 1.6.0_16 in both cases)
>    TransformerFactory factory = TransformerFactory.newInstance();
>    template = factory.newTemplates(xsltFile); // this is an actual  
> java.io.File
>    Transformer transformer = template.newTransformer();
>    Document dom = ... // obtain w3C DOM
>
>    JAXBResult result = new  
> JAXBResult(JAXBContext.newInstance(Catalogue.class)); //Catalogue is  
> a JAXB generated class
>
>    transformer.transform(new DOMSource(dom), result);
>    return (Catalogue) result.getResult();
>
> this results in the attached exception when run on Linux only  
> (Windows completes this without issue).
>
> However If I modify the code to go via an intermediate w3c DOM as  
> follows then it works on both windows and Linux.
>
>    TransformerFactory factory = TransformerFactory.newInstance();
>    template = factory.newTemplates(xsltFile); // this is an actual  
> java.io.File
>    Transformer transformer = template.newTransformer();
>    Document dom = ... // obtain w3C DOM
>
>    DOMResult result = new DOMResult();
>    Document newDoc = transformer.transform(new DOMSource(dom),  
> result);
>    Unmarshaller unmarshaller =  
> JAXBContext.newInstance(Catalogue.class).createUnmarshaller();
>    return (Catalogue) unmarshaller.unmarshal(newDoc);
>
> I'm not sure why the first block fails only on Linux (there is no  
> custom security manager on either windows or Linux) and it doesn't  
> fill me with that warm fuzzy feeling.  Is there some step I'm  
> missing in the first attempt?  I'm using Saxon HE 9.2.0.2
>
> BTW: the purchase page for the pro and enterprise editions is  
> unusable (http://www.saxonica.com/erol/erol.html gives me a blank  
> page in both Firefox 3.5 and IE 7)
>
> Regards,
>
>     /James
>
>
> **************************************************************************************
> This message is confidential and intended only for the addressee. If  
> you have received this message in error, please immediately notify  
> the [hidden email] and delete it from your system as well as any  
> copies. The content of e-mails as well as traffic data may be  
> monitored by NDS for employment and security purposes. To protect  
> the environment please do not print this e-mail unless necessary.
>
> NDS Limited. Registered Office: One London Road, Staines, Middlesex,  
> TW18 4EX, United Kingdom. A company registered in England and Wales.  
> Registered no. 3080780. VAT no. GB 603 8808 40-00
> **************************************************************************************
> <
> stack_trace
> .txt
> >
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july_______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT/JAXB exception

Michael Kay
>
> How are you setting saxon to be your XSL processor?
>
> -Rob

I don't think that's the issue, Rob (though it was my first instinct as
well): the stack traces show that Saxon has been successfully loaded. The
failure is happening deep within some JAXB code invoked by Saxon as the
ContentHandler for processing the result tree.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 

>
>
> On Aug 13, 2009, at 9:58 AM, Nord, James wrote:
>
> > HI all,
> >
> > I have a Linux only issue with an XLST Transform and JAX-B.
> The same
> > code runs fine on Windows XP (sun 32bit JDK 1.6.0_16 in both cases)
> >    TransformerFactory factory = TransformerFactory.newInstance();
> >    template = factory.newTemplates(xsltFile); // this is an actual
> > java.io.File
> >    Transformer transformer = template.newTransformer();
> >    Document dom = ... // obtain w3C DOM
> >
> >    JAXBResult result = new
> > JAXBResult(JAXBContext.newInstance(Catalogue.class));
> //Catalogue is a
> > JAXB generated class
> >
> >    transformer.transform(new DOMSource(dom), result);
> >    return (Catalogue) result.getResult();
> >
> > this results in the attached exception when run on Linux
> only (Windows
> > completes this without issue).
> >
> > However If I modify the code to go via an intermediate w3c DOM as
> > follows then it works on both windows and Linux.
> >
> >    TransformerFactory factory = TransformerFactory.newInstance();
> >    template = factory.newTemplates(xsltFile); // this is an actual
> > java.io.File
> >    Transformer transformer = template.newTransformer();
> >    Document dom = ... // obtain w3C DOM
> >
> >    DOMResult result = new DOMResult();
> >    Document newDoc = transformer.transform(new DOMSource(dom),
> > result);
> >    Unmarshaller unmarshaller =
> > JAXBContext.newInstance(Catalogue.class).createUnmarshaller();
> >    return (Catalogue) unmarshaller.unmarshal(newDoc);
> >
> > I'm not sure why the first block fails only on Linux (there is no
> > custom security manager on either windows or Linux) and it doesn't
> > fill me with that warm fuzzy feeling.  Is there some step
> I'm missing
> > in the first attempt?  I'm using Saxon HE 9.2.0.2
> >
> > BTW: the purchase page for the pro and enterprise editions
> is unusable
> > (http://www.saxonica.com/erol/erol.html gives me a blank
> page in both
> > Firefox 3.5 and IE 7)
> >
> > Regards,
> >
> >     /James
> >
> >
> >
> **********************************************************************
> > **************** This message is confidential and intended only for
> > the addressee. If you have received this message in error, please
> > immediately notify the [hidden email] and delete it from your
> > system as well as any copies. The content of e-mails as well as
> > traffic data may be monitored by NDS for employment and security
> > purposes. To protect the environment please do not print
> this e-mail
> > unless necessary.
> >
> > NDS Limited. Registered Office: One London Road, Staines, Middlesex,
> > TW18 4EX, United Kingdom. A company registered in England
> and Wales.  
> > Registered no. 3080780. VAT no. GB 603 8808 40-00
> >
> **********************************************************************
> > ****************
> > <
> > stack_trace
> > .txt
> > >
> >
> ----------------------------------------------------------------------
> > -------- Let Crystal Reports handle the reporting - Free Crystal
> > Reports 2008 30-Day trial. Simplify your report design, integration
> > and deployment - and focus on what you do best, core application
> > coding. Discover what's new with Crystal Reports now.  
> >
> http://p.sf.net/sfu/bobj-july_________________________________________
> > ______ saxon-help mailing list archived at
> http://saxon.markmail.org/ 
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/saxon-help
>
>
> --------------------------------------------------------------
> ----------------
> Let Crystal Reports handle the reporting - Free Crystal
> Reports 2008 30-Day trial. Simplify your report design,
> integration and deployment - and focus on what you do best,
> core application coding. Discover what's new with Crystal
> Reports now.  http://p.sf.net/sfu/bobj-july 
> _______________________________________________
> saxon-help mailing list archived at
> http://saxon.markmail.org/ [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT/JAXB exception

Andrew Welch
2009/8/14 Michael Kay <[hidden email]>:
>>
>> How are you setting saxon to be your XSL processor?
>>
>> -Rob
>
> I don't think that's the issue, Rob (though it was my first instinct as
> well): the stack traces show that Saxon has been successfully loaded. The
> failure is happening deep within some JAXB code invoked by Saxon as the
> ContentHandler for processing the result tree.

I have a distant memory about JAXB complaining if saxon-dom.jar wasnt
on the classpath...



--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT/JAXB exception

Michael Kay
>
> I have a distant memory about JAXB complaining if
> saxon-dom.jar wasnt on the classpath...
>

Wasn't it the other way around? I think there was some bug where it was
loading an identity transformer using the JAXP factory mechanisms, and then
assuming that the loaded identity transformer would always be Xalan.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: XSLT/JAXB exception

Nord, James-2
In reply to this post by Andrew Welch
Hi all,

Thanks for the suggestions guys.

I (think) I've managed to track it down to a JDK issue as the Linux jdk
was different to my windows jdk (update 14 vs update7).

Update 14 included the latest JAX-B and removing saxon from the
classpath and using a simple XLST v1 transform I could still reproduce
it.
In the end the transform was creating XML that was not valid according
to the schema and then JAX-B was throwing a very very non intuitive
error.

An element declared as <xs:element name="myValue" type="xs:boolean" />
Was being written as <myValue/> and this caused the error.
https://jaxb.dev.java.net/issues/show_bug.cgi?id=490.  Very helpful and
descriptive :-0

/James


> -----Original Message-----
> From: Andrew Welch [mailto:[hidden email]]
> Sent: 14 August 2009 12:33
> To: Mailing list for the SAXON XSLT and XQuery processor
> Subject: Re: [saxon] XSLT/JAXB exception
>
> 2009/8/14 Michael Kay <[hidden email]>:
> >>
> >> How are you setting saxon to be your XSL processor?
> >>
> >> -Rob
> >
> > I don't think that's the issue, Rob (though it was my first
> instinct
> > as
> > well): the stack traces show that Saxon has been
> successfully loaded.
> > The failure is happening deep within some JAXB code invoked
> by Saxon
> > as the ContentHandler for processing the result tree.
>
> I have a distant memory about JAXB complaining if
> saxon-dom.jar wasnt on the classpath...
>

**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the [hidden email] and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help