users@jaxb.java.net

Re: Threading issue with big instance documents

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 30 Jul 2007 12:42:49 -0700

Is there anyway to isolate the problem between XSLT engine vs JAXB
marshaller?

 From what it sounds like, it's not clear to me which is at fault.

Marc Giger wrote:
> Hi all,
>
> I read all the faq's and searched in the archives but found no explanation to my problem.
>
> I have a Webservice with validating JAXB Binding. In this webservice the instancedocument will be processed with multiple xslt _in parallel_. Every xslt process results in a different output document.
>
> If I invoke the service with big documents (e.g 24 MBytes) some of the transformations fail with a error msg like the
> following:
>
> SystemId Unknown; Line #149; Column #105; Illegal value used for
> attribute name:
> SystemId Unknown; Line #149; Column #105; Illegal value used for
> attribute name:
>
> After some debugging I saw that the document contains some garbage elements like:
> <testCase1testCase2>...</testCase1testCase2>
>
> instead of
> <testCase1>...</testCase1>
> <testCase2>...</testCase2>
>
> The transformation is done the following way:
>
> JAXBContext jaxbContext = JAXBContext.newInstance("....");
>
> JAXBElement<MyInputType> myInputTypeElement = ..."instancedocument from service method"....;
> JAXBSource source = new JAXBSource(jaxbContext, myInputTypeElement);
>
> Transformer transformer = template.newTransformer();
> JAXBResult result = new JAXBResult(jaxbContext);
> transformer.transform(source, result);
>
> (JAXBElement<MyOutputType>)result.getResult();
>
> The JAXBContext is just once instanciated as documented in the faqs and docs. I did also test it with a new instance for
> every use but without success.
>
> When the xsl transformations are done serial all is working fine.
> The problem does mostly occur if tomcat is started freshly. If the classes are hot the problem doesn't occur always.
>
> My workaround for the problem is atm that I marshall the whole document to a ByteArrayOutputStream and unmarshall it from there so that every thread has a new instance.
>
> This problem occurs with JAXB 2.0.5 and 2.1.4
>
> Has somebody an explanation?
>
> Thanks for the help
>
> Marc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com