commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Diggory" <mdigg...@latte.harvard.edu>
Subject Re: Possible Http Client Problem
Date Thu, 12 Sep 2002 21:31:34 GMT
Thanks I've done what you've asked.

I've tried to discern where exactly this error is occuring, 
unfortunately, it is only occuring in certain cases where I'm using the 
library inside a "Custom Tag" I've written, when I strip out the custom 
tags and just work with the smallest possible examples I get the 
following results. Here are the details I can figure out to date.

1.) When I get the InputStream from the Http Client and dump it to the 
JSPWriter of a JSP page. (See example TestOutput.jsp in Test.war)  The 
InputStream hangs open at the end of the content. I think until the 
Server on the other end times out. Look at TestOutput.out for the log

To see the hang you need to install it in your Tomcat, in this case I'm 
using version 4.0.3 on a Redhat 7.2 box. I'm currently testing it on 
Tomcat 4.0.3, 4.0.4 and 4.1 on a Windows 2000 machine as well. I will 
forward those results later.

2.) When this InputStream is handed to a JAXP Transformer/Parser the 
InputStream stays open indefinity and never seems to close (See 
TestTransform.jsp) Look at TestTransform.out for the log. Notice it 
seems to go into infinite loop while reading the end of the content. I 
have to kill by instance of tomcat to get it to stop.

I'm providing a link to the War file that you can download to try this 
out yourself (It also has copies of the attached output files).
http://osprey.hmdc.harvard.edu:8180/Test.war

-Mark Diggory


Jeff Dever wrote:

>So a java Error is being thrown from withing the new io package (assume you
>are using java1.4).  Its quite weird that the Error is thrown, and without
>any apparent message string.
>
>We need a little more help in debugging this.  Can you turn on the debug log
>in httpclient, and perhaps catch the error and try to print out any message
>with the stack trace?
>
>-Dorg.apache.commons.logging.simplelog.defaultlog=trace 
>-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog
>
>
>  
>
>>-----Original Message-----
>>From: Mark R. Diggory [mailto:mdiggory@latte.harvard.edu]
>>Sent: Tuesday, September 10, 2002 1:59 PM
>>To: commons-dev@jakarta.apache.org
>>Subject: Possible Http Client Problem 
>>
>>
>>I've been playing witht he CVS Checkout of the Http Client and I'm 
>>getting a wierd exception which I've included below. This code worked 
>>with the previous version of the Http Client I was using:
>>
>>java.lang.Error
>>	at 
>>sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:417)
>>	at 
>>sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:442)
>>	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:179)
>>	at java.io.InputStreamReader.read(InputStreamReader.java:167)
>>	at 
>>org.apache.xerces.readers.CharReader.fillCurrentChunk(CharReader.java)
>>	at 
>>org.apache.xerces.readers.AbstractCharReader.slowLoadNextChar(
>>AbstractCharReader.java)
>>	at 
>>org.apache.xerces.readers.AbstractCharReader.scanQName(Abstrac
>>tCharReader.java)
>>	at 
>>org.apache.xerces.framework.XMLDocumentScanner.scanElementType
>>(XMLDocumentScanner.java)
>>	at 
>>org.apache.xerces.framework.XMLDocumentScanner.access$1(XMLDoc
>>umentScanner.java)
>>	at 
>>org.apache.xerces.framework.XMLDocumentScanner$ContentDispatch
>>er.dispatch(XMLDocumentScanner.java)
>>	at 
>>org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDo
>>cumentScanner.java)
>>	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java)
>>	at com.icl.saxon.om.Builder.build(Builder.java:258)
>>	at com.icl.saxon.Controller.transform(Controller.java:925)
>>
>>
>>I'm using the InputStream from method.getContentAsStream() in 
>>a JAXP transform like this:
>>
>>/* SNIP */
>>
>>URL url = new 
>>URL("http://vdc.fas.harvard.edu/VDC/Repository/0.1/Access?name
>>    
>>
>=http://purl.thedata.org/VDC/0.1/PURL/1.1.2/06635"> );
>  
>
>>HttpConnection connection = new HttpConnection(url.getHost(),80);
>>GetMethod method = new GetMethod(url.getPath());
>>method.setQueryString(url.getQuery());
>>
>>int state = method.execute(new HttpState(), connection);
>>
>>if(state != 200){
>>    out.println("<p>State = "+ state+" Reason = " + 
>>method.getStatusText()+"</p>");
>>}else{
>>     TransformerFactory tfactory  = TransformerFactory.newInstance();
>>     Templates templates = tfactory.newTemplates(new 
>>StreamSource("MainView.xsl"));
>>     Transformer transformer = templates.newTransformer();
>>     transformer.transform(new 
>>StreamSource(method.getResponseBodyAsStream()),new StreamResult(out));
>>   
>>}
>>
>>/* SNIP */
>>
>>if I use the following test, I do get the content from the response:
>>
>>InputStream in = method.getResponseBodyAsStream();
>>
>>    int c;
>>    while((c = in.read()) != -1){
>>        out.write(c);
>>      }
>>
>>
>>Any Ideas?
>>Mark
>>
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   
>><mailto:commons-dev-unsubscribe@jakarta.apache.org>
>>For additional commands, e-mail: 
>><mailto:commons-dev-help@jakarta.apache.org>
>>
>>
>>    
>>
>
>  
>



Mime
View raw message