You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Suire Rekv <su...@yahoo.com> on 2009/06/05 01:20:29 UTC

Re: xmlobject stream closure upon parse affecting httpservletrequest application/xml

The container is spring/tomcat. I'm not setting anything, so it must be using the default. Also, I tested the same xsd with JAXB and it has no problem with cxf.

I can try setting the xmloptions. Which parser do you suggest.?

Also can you tell me if the parse method of xmlbeans closes the stream?
The wierd thing is that the first request works, the second maybe, the third or fourth fails.
But once the failure happens, alternate requests fail consistently, unless tomcat is restarted.

- Suire.

--- On Thu, 6/4/09, Radu Preotiuc <ra...@oracle.com> wrote:

From: Radu Preotiuc <ra...@oracle.com>
Subject: Re: xmlobject stream closure upon parse affecting httpservletrequest application/xml
To: dev@xmlbeans.apache.org
Date: Thursday, June 4, 2009, 6:17 PM

What makes you think this is not a problem with the container in the way
it handles the stream?

With XMLBeans, you can usually change the parser with
XmlOptions.setLoadUseXMLReader(). If you change the parser and the
problem persists, that would be a strong indication that the problem is
in the container.

Radu

On Sat, 2009-05-30 at 11:54 -0700, Suire Rekv wrote:
> Hi,
> 
> When I use XmlObject.Factory.parse(InputStream is) to read the request
> object's InputStream for request type application/xml I sporadically
> get errors as attempting to read from a closed stream. This problem
> happens directly when I read it from a spring controller or via cxf.
> 
> To fix this I had to parse the inputstream to a string and then
> construct the xmlobject from the string. By default the cxf xmlbeans
> provider reads the stream directly and cannot be used as such.
> 
> To test this:
> 
> public ModelAndView handleRequest(HttpServletRequest request,
> HttpServletResponse response)
>     throws ServletException, IOException, Exception {
>              XmlObject.Factor.parse(request.getInputStream());       
> }
> 
> Try hitting the webpage multiple times and you will the exception.
> 
> Any suggestions?
> 
> Thanks,
> Suire.
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org




      

RE: xmlobject stream closure upon parse affecting httpservletrequest application/xml

Posted by Radu Preotiuc-Pietro <ra...@oracle.com>.
I would try the Java default one.
 
What version of XMLBeans are you using? We had a bug like that a while ago where the stream was being closed inadvertently, but it has since been fixed.
 
Radu


  _____  

From: Suire Rekv [mailto:suirerekv@yahoo.com] 
Sent: Thursday, June 04, 2009 7:20 PM
To: dev@xmlbeans.apache.org
Subject: Re: xmlobject stream closure upon parse affecting httpservletrequest application/xml


The container is spring/tomcat. I'm not setting anything, so it must be using the default. Also, I tested the same xsd with JAXB and it has no problem with cxf.

I can try setting the xmloptions. Which parser do you suggest.?

Also can you tell me if the parse method of xmlbeans closes the stream?
The wierd thing is that the first request works, the second maybe, the third or fourth fails.
But once the failure happens, alternate requests fail consistently, unless tomcat is restarted.

- Suire.

--- On Thu, 6/4/09, Radu Preotiuc <ra...@oracle.com> wrote:



From: Radu Preotiuc <ra...@oracle.com>
Subject: Re: xmlobject stream closure upon parse affecting httpservletrequest application/xml
To: dev@xmlbeans.apache.org
Date: Thursday, June 4, 2009, 6:17 PM


What makes you think this is not a problem with the container in the way
it handles the stream?

With XMLBeans, you can usually change the parser with
XmlOptions.setLoadUseXMLReader(). If you change the parser and the
problem persists, that would be a strong indication that the problem is
in the container.

Radu

On Sat, 2009-05-30 at 11:54 -0700, Suire Rekv wrote:
> Hi,
> 
> When I use XmlObject.Factory.parse(InputStream is) to read the request
> object's InputStream for request type application/xml I sporadically
> get errors as attempting to read from a closed stream. This problem
> happens directly when I read it from a spring controller or via cxf.
> 
> To fix this I had to parse the inputstream to a string and then
> construct the xmlobject from the string. By default the cxf xmlbeans
> provider reads the stream directly and cannot be used as such.
> 
> To test this:
> 
> public ModelAndView handleRequest(HttpServletRequest request,
> HttpServletResponse response)
>     throws ServletException, IOException, Exception {
>              XmlObject.Factor.parse(request.getInputStream());       
> }
> 
> Try hitting the webpage multiple times and you will the exception.
> 
> Any suggestions?
> 
> Thanks,
> Suire.
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org