You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Christian Cryder <ch...@granitepeaks.com> on 2003/10/15 03:21:14 UTC

Connection reset by peer exception

Hi folks,

I am using  Batik to try and render a document like this:

    //---Get a DOMImplementation
    DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();

    //---Create an instance of org.w3c.dom.Document
    Document document = domImpl.createDocument( null, "svg", null );

    //---Create an instance of the SVG Generator
    SVGGraphics2D svgGenerator = new SVGGraphics2D( document );

    chart.setGraphics2D( svgGenerator );
    chart.render();

    Writer writer = new OutputStreamWriter( outputStream, "UTF-8" );
    svgGenerator.stream( writer, false );

    writer.flush();
    writer.close();

The chart object here is an instance of jChart (Java charting framework that
uses Batik). I am working in Win2k, JDK 1.4.2_01, Tomcat 4.1, and I'm not
having a problem finding the libraries. Instead, when I get to this line
here:

    svgGenerator.stream( writer, false );

I get the following exception:

    error encoding chart:org.apache.batik.svggen.SVGGraphics2DIOException:
    Connection reset by peer: socket write error
    org.apache.batik.svggen.SVGGraphics2DIOException: Connection reset by
peer: socket write error
        at org.apache.batik.svggen.XmlWriter.writeXml(Unknown Source)
        at org.apache.batik.svggen.SVGGraphics2D.stream(Unknown Source)
        at org.apache.batik.svggen.SVGGraphics2D.stream(Unknown Source)
        at org.jCharts.encoders.SVGEncoder.encode(SVGEncoder.java:103)
        at
org.jCharts.encoders.ServletEncoderHelper.encodeServlet(ServletEncoderHelper
.java:76)

Any suggestions on what I'm doing wrong here? The problem occurs in both IE
and Mozilla...

tia,
Christian
----------------------------------------------
Christian Cryder
Internet Architect, ATMReports.com
Project Chair, BarracudaMVC - http://barracudamvc.org
----------------------------------------------
"Coffee? I could quit anytime, just not today"


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Re: Connection reset by peer exception

Posted by Thomas DeWeese <Th...@Kodak.com>.
Christian Cryder wrote:

> Hi folks,
> 
> I am using  Batik to try and render a document like this:
> [...] Instead, when I get to this line here:
> 
>     svgGenerator.stream( writer, false );
> 
> I get the following exception:
> 
>     error encoding chart:org.apache.batik.svggen.SVGGraphics2DIOException:
>     Connection reset by peer: socket write error
> 
> Any suggestions on what I'm doing wrong here? The problem occurs in both IE
> and Mozilla...

    I suspect that the problem is that IE and Mozilla are
doing 'content sniffing' so they fetch the document once
and suddenly realizes it isn't HTML and close the connection
and forward the URL to the plug-in.  In this case you
should _very_ shortly after see an identical request to your
service (this time from the plug-in), so you might want to
cache the generated document for a short while on the server.




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org