Questions on Stream Closed

Hi,
I was just testing on this sequence of reopening the input stream. Im having an error when trying to read again to the System.in after I've closed in another function. Please advise what could be the cause of it. Here's the code and output. Thanks.
import java.io.InputStreamReader;
import java.io.IOException;
public class Streams{
    public static void main(String[] args){
        Streams s = new Streams();
        s.closeOne();
        s.closeTwo();
    public void closeOne(){
        InputStreamReader ir = new InputStreamReader(System.in);
        try{
            ir.read();
            ir.close();
        }catch(IOException io){}
    public void closeTwo(){
        InputStreamReader ir = new InputStreamReader(System.in);
        try{
            ir.read();
            ir.close();
        }catch(IOException ioe){ ioe.printStackTrace(); }
java Streams
3
java.io.IOException: Stream closed
        at java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:120)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:270)
        at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
        at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
        at sun.nio.cs.StreamDecoder.read0(StreamDecoder.java:131)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:117)
        at java.io.InputStreamReader.read(InputStreamReader.java:151)
        at Streams.closeTwo(Streams.java:21)
        at Streams.main(Streams.java:7)Regards,
Rhani

java.io.IOException: Stream closed
Oh come on. How mch more clearer can the error
message be? Can you walk through a door after ithas
been closed?May I interest you in some Midol?Bite me!I'm not big on seafood.
I just don't think it's that bad a question.

Similar Messages

  • WebLogic Server 6.1 SP 3 DocumentBuilder throws IOException: Stream closed

    Hi,
              I have a question about XML processing and error handling, and how the
              WebLogic container affects things.
              Here's what happens to us. We have a servlet parsing XML using DOM.
              The servlet has an InputStream with the content. It gets the default
              DocumentBuilderFactory
              (weblogic.xml.jaxp.RegistryDocumentBuilderFactory) and makes it
              validating. It asks for a DocumentBuilder. It gives the builder our
              own custom error handler to collect up all the SAX parse errors. It
              then tells the builder to parse the input stream. We would expect
              that any problems with the content would be reported as an error to
              our error handler, so that we can then report the errors to the user
              as part of the servlet response.
              However, certain malformed XML content causes the WebLogic parser to
              issue several error messages to System.out and throw an IOException
              with the message "Stream closed". No errors are recorded in our error
              handler. This happens on a variety of inputs, which all revolve
              around the root element start tag being malformed or entirely missing.
              We get this behavior with a totally empty stream, with a stream that
              has the <?xml> and <!DOCTYPE> headers but nothing else, with a stream
              that has the headers and then a malformed start tag like
              "<Submit_Contracts a="1"b="2"/>". I think the programmer would expect
              any of these inputs to cause the parser to simply report a fatal error
              and stop. Throwing an IOException makes it look like it's an error in
              the underlying stream, and clearly it's not. (Most of the test code I
              used actually pulled the XML from a ByteArrayInputStream.)
              Shouldn't WebLogic's parser handle these inputs differently? Throwing
              an IOException can't be correct, can it? Should the application
              instead be responsible for checking that the input has a well-formed
              start tag? In that case the application is doing the parsing that we
              want to rely on the parser to do! Should the application instead
              catch IOExceptions from the parser and report them to the user as
              input errors? In that case the application can potentially swallow
              and ignore harmful system errors.
              The messages on System.out are all along the lines of:
              "<Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to open XML
              document. Failed to retrieve PUBLIC id or SYSTEM id from the document.
              Decrease the number of char between the beginning of the document and
              its root element.>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to open XML
              document. Failed to retrieve PUBLIC id. Stream closed>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to parse given XML
              document. Failed to retrieve PUBLIC id. The root element is required
              in a well-formed document.>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to parse given XML
              document. Failed to retrieve SYSTEM id. The root element is required
              in a well-formed document.>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Failed to open XML
              document. Failed to retrieve root tag. Stream closed>
              <Oct 17, 2002 5:38:03 PM EDT> <Error> <XML> <Could not instantiate
              factory class specified in the Server console. Invalid parameters: at
              least one of publicId,systemId, rootTag must be non-null>
              The IOException looks like:
              "java.io.IOException: Stream closed
              at java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:118)
              at java.io.BufferedInputStream.read(BufferedInputStream.java:268)
              at weblogic.apache.xerces.utils.ChunkyByteArray.fill(ChunkyByteArray.java:230)
              at weblogic.apache.xerces.utils.ChunkyByteArray.<init>(ChunkyByteArray.java:106)
              at weblogic.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:153)
              at weblogic.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:499)
              at weblogic.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:318)
              at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:974)
              at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:183)
              at weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:140)
              at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:86)
              at com.isone.sms.participant.contracts.web.WebLogicParserContainerTest.testWebLogicParserTanksOnEmptyStream(WebLogicParserContainerTest.java:448)
              at java.lang.reflect.Method.invoke(Native Method)
              at junit.framework.TestCase.runTest(TestCase.java:166)
              at junit.framework.TestCase.runBare(TestCase.java:140)
              at junit.framework.TestResult$1.protect(TestResult.java:106)
              at junit.framework.TestResult.runProtected(TestResult.java:124)
              at junit.framework.TestResult.run(TestResult.java:109)
              at junit.framework.TestCase.run(TestCase.java:131)
              at junit.framework.TestSuite.runTest(TestSuite.java:173)
              at junit.framework.TestSuite.run(TestSuite.java:168)
              at com.isone.sms.participant.contracts.web.ContractTestServlet.doPost(ContractTestServlet.java:23)
              at com.isone.sms.participant.contracts.web.ContractTestServlet.doGet(ContractTestServlet.java:16)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2546)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2260)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)"
              Judging from the IOException, it looks as though WebLogic's wrapper
              parser, RegistryDocumentBuilder, successfully picked a real parser to
              do its work and is passing off the input to be parsed there, even
              though the input's already closed. Perhaps the
              RegistryDocumentBuilder silently screwed up the stream while trying to
              figure out what parser to use, but didn't take that into account
              before attempting to pass it off for parsing. Perhaps the error
              messages on System.out account for when RegistryDocumentBuilder is
              screwing up the stream.
              But if RegistryDocumentBuilder discovers that the stream can't be
              parsed, why can't it simply report a fatal error and stop before
              starting the real parser?
              Mainly I wanted to put this experience up here on a newsgroup because
              I was so surprised that nobody else had reported similar problems. It
              makes me doubt whether our applications are handling the XML parsing
              correctly. But I can't see any other way that makes sense. Please
              let me know what you think!
              Thanks,
              Jim
              

    Hi,
    I got this error when i used JRUN as plugin server through
    Ineternet Information Server. but it was working fine when used it
    as standalone server.
    The reason was beacuase, the inputstream was getting closed . when i removed it, it started working.
    (To be frank , the Inputstream was closed by XML DOM PARSER , which is third party component.)
    and believe that your case is also the same ....
    If you have doubt on that then see that configuration for proxies under your webservers config files
    best of luck
    LOkesh T.C

  • I/O error: InputSource: Stream closed

    Hi
    I am new to XML. I am trying to modify XML content using DOM parser. After the modification I want to check if the changes have taken place or not by printing the XML on the console.
    This is what I have done:
    1. Read XML from InputSource
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
    Document doc = docBuilder.parse(inputSource);2. Get the nodes to Modify.
    NodeList nodeList = (NodeList)doc.getElementsByTagName("XXX");3. Print the InputSource to check the changes.
    BufferedReader readerTemp = new BufferedReader(new InputStreamReader(inputSource.getByteStream()));
                   String inputLine;
                    while ((inputLine = readerTemp.readLine()) != null) {
                      System.out.println(inputLine);
                    }But however, when I try to view the changes I get an error STREAM CLOSED.
    Please help me, how to open the inputSource again to read the stream from it... what can I do to solve this problem?

    The parser closes the input source, having read it all the way to EOF. So there's nothing left to be read even if the parser didn't close the source.
    So you need a new input source.
    But are the changes taking place on the file, or just in the DOM? In which case re-reading the file won't show any changes - you will need to write the DOM out to the file.
    In which case you can look at it with a text editor. Alternatively you can print the DOM to the console directly.
    So you don't really need the answer to your original question.

  • Stream closed error while testing a composite in EM

    HI,
    I have deployed a simple composite and wanted to test it in EM. I am getting a stream closed popup, not sure whats wrong?
    I have restarted the server and problem still persists.

    its actually remote server, I am able to deploy a simple HelloWorld composite and even able to see the same in Em.I can even browse through all the composites deployed there by many other people.But problem is when I try to test it its giving the Stream closed error.
    Is it something to do with access permissions, if so i would not have deployed it in first case..
    the pop up error message----
    Stream Closed
    For more information, please see the server's error log for
    an entry beginning with: Server Esception beginning with PPR, #14
    _______________________________

  • Stream closed while copying?

    Hi, i am trying to open a connection to a url and then trying to save the page to a location. i frequently face a problem in which the copying terminated by itself. This only happens when i try to copy a webpage with big file size. However sometimes it manage to succesfully copy the files. So, can anyone tell me what wrong? Sometimes it can, sometimes cannot. I put my codes in a try catch block but nothing was done in the catch block although i try to print out the error message. My partial codes shown below.
    URL _url = new URL("http://www.google.com");
    OutputStream out = new FileOutputStream("test.html");
    URLConnection conn = _url.openConnection();
    conn.connect();
    BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    while ((inputString = reader.read()) != -1) {
        out.write(inputString);
    out.flush();
    out.close();Thank you.

    i managed to track down the error stack. i think the code dies during the execution of method available() of java.net.PlainSocketImpl. I think this is the socket connection problem which throw the exception. the socket should be instantiaed when i call url.openConnection() if i not wrong. and why it dies i really clueless. and somemore it does not die at all times. most time it is ok. any help is very appreciated. below is the error msg. thanks.
    java.io.IOException: Stream closed.
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.<init>(Throwable.java:87)
    at java.lang.Exception.<init>(Compiled Code)
    at java.io.IOException.<init>(Compiled Code)
    at java.net.PlainSocketImpl.available(Compiled Code)
    at java.net.SocketInputStream.available(Compiled Code)
    at java.io.BufferedInputStream.read(Compiled Code)
    at java.io.FilterInputStream.read(Compiled Code)
    at java.io.PushbackInputStream.read(Compiled Code)
    at java.io.FilterInputStream.read(Compiled Code)
    at java.io.InputStreamReader.fill(Compiled Code)
    at java.io.InputStreamReader.read(Compiled Code)
    at java.io.BufferedReader.fill(Compiled Code)
    at java.io.BufferedReader.readLine(Compiled Code)
    at java.io.BufferedReader.readLine(Compiled Code)
    at ActionPrintReport.loadPage(Compiled Code)
    at ActionPrintReport.<init>(Compiled Code)

  • Axis Client Web Service call problem: java.io.IOException: Stream closed

    Hi, I tried to call a webservice from Axis Client, and I encounter the following error. Do you guys have any idea what actually happens?
    Please help, I am newbie in web services.
    ==============Root Cause===============
    AxisFault
    faultCode: { h t t p : / / schemas.xmlsoap.org/soap/envelope/}Server.userException
    faultSubcode:
    faultString: java.io.IOException: Stream closed
    faultActor:
    faultNode:
    faultDetail:
         {h t t p : / / xml.apache.org/axis/}stackTrace:java.io.IOException: Stream closed
         at java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:120)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:270)
         at org.apache.commons.httpclient.ContentLengthInputStream.read(ContentLengthInputStream.java:170)
         at java.io.FilterInputStream.read(FilterInputStream.java:111)
         at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
         at java.io.FilterInputStream.read(FilterInputStream.java:90)
         at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:127)
         at org.apache.commons.httpclient.HttpMethodBase.getResponseBody(HttpMethodBase.java:688)
         at org.apache.commons.httpclient.HttpMethodBase.getResponseBodyAsString(HttpMethodBase.java:796)
         at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:224)
         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
         at org.apache.axis.client.Call.invoke(Call.java:2767)
         at org.apache.axis.client.Call.invoke(Call.java:2443)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
         {h t t p : / / xml.apache.org/axis/}hostname:compname
    java.io.IOException: Stream closed
         at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
         at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:301)
         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
         at org.apache.axis.client.Call.invoke(Call.java:2767)
         at org.apache.axis.client.Call.invoke(Call.java:2443)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
         at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
         at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)     
    Caused by: java.io.IOException: Stream closed
         at java.io.BufferedInputStream.ensureOpen(BufferedInputStream.java:120)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:270)
         at org.apache.commons.httpclient.ContentLengthInputStream.read(ContentLengthInputStream.java:170)
         at java.io.FilterInputStream.read(FilterInputStream.java:111)
         at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
         at java.io.FilterInputStream.read(FilterInputStream.java:90)
         at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:127)
         at org.apache.commons.httpclient.HttpMethodBase.getResponseBody(HttpMethodBase.java:688)
         at org.apache.commons.httpclient.HttpMethodBase.getResponseBodyAsString(HttpMethodBase.java:796)
         at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:224)
         ... 17 more  I am calling through proxy, the setting is as follows:
                System.setProperty("https.proxyHost", [proxyname here]);
                System.setProperty("https.proxyPort", [proxyport here]);
                System.setProperty("http.proxyHost", [proxyname here]);
                System.setProperty("http.proxyPort", [proxyport here]);

    Are there any problems showing up in the server's log?

  • Stream Closed Error

    Hello!
    I have this 2-class package which gets informations on Microsoft SQL Server 2005 tables and table content. It worked perfectly on J2SE 5. Today I moved to Java J2SE1.6 u1 and recompiled the project. Now, it triggers bizzare Steam Closed exceptions when trying to read a line from the keyboard (if I let exceptions to be thrown). I found several posts regarding this readLine-stream closed issue on the java forums, but none answered this problem satisfactorily. This is my code:
    package databaseinfo;
    import java.io.*;
    import java.sql.*;
    public class DatabaseInfo {
       private static DBConnection dbConn; // connection to DB
       /** connects to the SQL Server 2005, using the given credntials
       public static boolean connect() {
           String username = "test";
           String password = "test";
           String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; // JDBC driver for connecting to MSSQL 2005
           String url = "jdbc:sqlserver://FIREBLADE\\SQLEXPRESS"; // JDBC connection URL to MSSQL 2005
           try {
               dbConn = new DBConnection(username,password,driver,url);
           catch (Exception e) { return false; }
           return true;
       /** disconnects from the SQL Server 2005
       public static void disconnect() {
           try {
               dbConn.logout();
           catch (Exception e) { }
       /** prints the list of tables belonging to the user (dbo) from the current
        *  database
       public static void printTablesList() {
           try {
                dbConn.printQueryResult("EXEC sp_tables @table_owner=dbo");
           catch (Exception e) { return; }
       /** prints extra information and the content of a user-given table
       public static void printTableInfoAndContent() throws IOException {
           try {
               BufferedReader in = new BufferedReader(
                                   new InputStreamReader(System.in));
               String tableName;
               System.out.println("\nGet extra information and the content of which table? ");
               tableName = in.readLine();
               in.close();
               dbConn.printQueryResult("EXEC sp_columns @table_name=" + tableName);
               System.out.println();
               dbConn.printQueryResult("SELECT * FROM " + tableName);       
           catch (IOException e) { }
       public static void main(String args[]) throws IOException {
           connect();
           printTablesList();
           printTableInfoAndContent();
           disconnect();
    package databaseinfo;
    import java.io.*;
    import java.sql.*;
    public class DBConnection {
        // maximum no. of rows on the user console screen
        private final static int maxRowCount = 25;
        private Connection conn; // connection to DB
        /** connects to the MSSQL 2005 database
        public DBConnection (String username, String password, String driver,
                             String url) throws ClassNotFoundException, SQLException {
             login(username,password,driver,url);
        /** login to SQL Server 2005 for a user having a username and a passsword,
         *  using a certain database driver and a given url
        public int login(String username, String password, String driver, String url)
                                                      throws ClassNotFoundException,
                                                             SQLException {
            Class.forName(driver); // sets the JDBC driver
            conn = DriverManager.getConnection(url,username,password); // obtains the JDBC connection
            if (conn != null)
                System.out.println("\nSQL Server Connection established ...\n");
            else {
                System.out.println("\nBad username and/or password.\n");
                return 0;
            return 1;     
        /** closes the JDBC connection
        public void logout() throws SQLException {   
            conn.close();
            System.out.println("\nSQL Server Connection closed.\n");
        /** executes SQL queries and prints their output to the screen
        public void printQueryResult(String sql) {
            try {
                    BufferedReader in = new BufferedReader(
                                        new InputStreamReader(System.in));
                    int rowCount = 0;
                    Statement st = conn.createStatement();
              ResultSet rs = st.executeQuery(sql);
              ResultSetMetaData rsmd = rs.getMetaData();
              int numberOfColumns = rsmd.getColumnCount();   
              int i;
                    for (i = 1; i <= numberOfColumns; i++)
                        System.out.print(rsmd.getColumnName(i)+"\t");
                    System.out.println();
              while (rs.next()) {
                            if ((rowCount != 0) && (rowCount % maxRowCount == 0)) {
                                    System.out.println("\nPress ENTER to continue ... ");
                                    in.read();
                            for (i = 1; i <= numberOfColumns; i++)     
                       System.out.print(rs.getString(i) + "\t\t");
                            rowCount++;
                            System.out.println();
                    in.close();
             catch (Exception e) { }
    }Thanks for reading this post!

    Don't close the input stream, and don't create a new one every time you want to read - create one for the life of the program.

  • Stream Closed

    public static void stylize(InputStream style, InputStream in, OutputStream out) throws ..{
    StreamSource      styleSheet      = new StreamSource(style);
    StreamResult      outStream     = new StreamResult(out);
    StreamSource XMLin = new StreamSource(new BufferedInputStream(in));
    Transformer      transform = TransformerFactory.newInstance().newTransformer(styleSheet);
    transformer.transform(XMLin,outStream);
    If i call the function reported above more than 1 time on the same input xml doc, i get :
    java.io.IOException: Stream closed
    at org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:741)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:715)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
    at utilities.xml.Utilities.stylize(Utilities.java:57)
    Caused by: java.io.IOException: Stream closed
    It seams the transform() method closes the inputstream after transformation has performed.
    There's a way to avoid this?
    Thanks.

    Hi,
    I've experienced the same problem, the transform method closes the InputStream that contains the xsl stylesheet (no way to use InputStream.mark() / reset()).
    The correct way to reuse the same stylesheet with many XML documents is to create an instance of your transformer and to use it with all your xml documents.
    You should not create a new transformer each time you want to use your XSLStylesheet stored in your InputStream.
    You should do something like this :
    public initTransformer (InputStream style){
    StreamSource      styleSheet      = new StreamSource(style);
    this.theTransformer = TransformerFactory.newInstance().newTransformer(styleShet);
    public static void stylize(InputStream in, OutputStream out) throws ..{
    StreamResult      outStream     = new StreamResult(out);
    StreamSource XMLin = new StreamSource(new BufferedInputStream(in));
    this.theTransformer.transform(XMLin,outStream);
    Hope this helps,
    Olivier
    public static void stylize(InputStream style, InputStream in, OutputStream out) throws ..{
    StreamSource      styleSheet      = new StreamSource(style);
    StreamResult      outStream     = new StreamResult(out);
    StreamSource XMLin = new
    StreamSource(new BufferedInputStream(in));
    Transformer      transform =
    TransformerFactory.newInstance().newTransformer(styleShet);
    transformer.transform(XMLin,outStream);
    If i call the function reported above more than 1 time
    on the same input xml doc, i get :
    java.io.IOException: Stream closed
    at org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerImpl.java:741)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:715)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
    at utilities.xml.Utilities.stylize(Utilities.java:57)
    Caused by: java.io.IOException: Stream closed
    It seams the transform() method closes the inputstream
    after transformation has performed.
    There's a way to avoid this?
    Thanks.

  • Ejbc error: Stream Closed

    I get this error when i build my ejb jar file using weblogic.ejbc. I
    have defined WL_HOME and have applied sp12 of weblogic. Please help
    D:\xyz>C:\jdk1.2.2\jre\..\bin\java.exe -mx256m -classpath
    C:\xerces-1_2_1\xerces.jar;C:\Weblogic\lib
    \weblogic510sp12.jar;C:\Weblogic\lib\weblogic510sp12boot.jar;C:\Weblogic\classes\boot;C:\Weblogic\li
    cense;C:\Weblogic\classes;C:\Weblogic\lib\weblogicaux.jar;C:\Weblogic\myserver\clientclasses;C:\Webl
    ogic\myserver\serverclasses;C:\Weblogic\mssqlserver4v70\classes;C:\TOPLink3.6\TLJ\Classes\JDK1.2;C:\
    TOPLink3.6\TLJ\Classes\JDK1.2\Tools.jar;C:\TOPLink3.6\TLJ\Classes\JDK1.2\Toplink.jar;C:\TOPLink3.6\T
    LJ\Classes\JDK1.2\Toplinkx.jar;C:\TOPLink3.6\TLWL51\Classes\JDK1.2\TOPLinkWLX.jar;C:\qt_v2001_1p0;%J
    AVAMAIL_CLASSPATH%;%J2EE_CLASSPATH%;D:\hbp\build weblogic.ejbc
    -verbose -normi "-J-mx256m" -nowarn -
    compiler sj D:\abc\dist\lib\abc-generic.jar D:\abc\dist\lib\abc.jar
    I keep getting this error - ejbc error: Stream Closed
    Any help will be appreciated.

    I am using ant 1.4.1 for building this. The error message is just EJB
    Error: Stream Closed. It says that ejbc reported an error. No details
    at all. i know it is difficult to reproduce anywhere. When i installed
    jdk1.3, it gave error on the public id of the toplink meta-inf cmp xml
    files.
    Rob Woollen <[email protected]> wrote in message news:<[email protected]>...
    Can you show us the full error message?
    -- Rob
    Bala wrote:
    I get this error when i build my ejb jar file using weblogic.ejbc. I
    have defined WL_HOME and have applied sp12 of weblogic. Please help
    D:\xyz>C:\jdk1.2.2\jre\..\bin\java.exe -mx256m -classpath
    C:\xerces-1_2_1\xerces.jar;C:\Weblogic\lib
    \weblogic510sp12.jar;C:\Weblogic\lib\weblogic510sp12boot.jar;C:\Weblogic\classes\boot;C:\Weblogic\li
    cense;C:\Weblogic\classes;C:\Weblogic\lib\weblogicaux.jar;C:\Weblogic\myserver\clientclasses;C:\Webl
    ogic\myserver\serverclasses;C:\Weblogic\mssqlserver4v70\classes;C:\TOPLink3.6\TLJ\Classes\JDK1.2;C:\
    TOPLink3.6\TLJ\Classes\JDK1.2\Tools.jar;C:\TOPLink3.6\TLJ\Classes\JDK1.2\Toplink.jar;C:\TOPLink3.6\T
    LJ\Classes\JDK1.2\Toplinkx.jar;C:\TOPLink3.6\TLWL51\Classes\JDK1.2\TOPLinkWLX.jar;C:\qt_v2001_1p0;%J
    AVAMAIL_CLASSPATH%;%J2EE_CLASSPATH%;D:\hbp\build weblogic.ejbc
    -verbose -normi "-J-mx256m" -nowarn -
    compiler sj D:\abc\dist\lib\abc-generic.jar D:\abc\dist\lib\abc.jar
    I keep getting this error - ejbc error: Stream Closed
    Any help will be appreciated.

  • Stream Closed BufferedReader in Java

    I do sometimes see an error "Stream Closed" while trying to read a file which has more than 8192 chars (default size of buffer).
    And the buffer sometimes consumes the entire file and some of the times only 8192 characters.
    Will appreciate some one help me on this urgently

    String fileName = "D:/Venkat/test files/file.txt";
    try{
    BufferedReader in = new BufferedReader ( new FileReader
    (fileName));
    String s1 ;
    while ( ( (s1 =in.readLine())!= null) ) {
    count++;      
    if(s1.length() <=75){
    System.out.println("Record length less than 75 "+s1);
    in.close();
    }catch(Exception e){
    //Each Line "s1" contains 80 chars. and when it reaches Line No. 102 it only reads 11 chars from the line. So it totally reads only 8192 chars from the file.When i try to execute the program again it runs with no errors.
    }

  • Content Filter - Stream Closed error

    Hello,
    i have created a Content-Filter for xml files. Within the filter i parse the file with SAX. Then i want to render this xml file with an XSLT Filter, but there i get always the error message: 'IOException: stream closed'. Any hints to solve the problem?
    regards,
    Marco

    Hi Marco,
    if the stream is parsed through an steeam handle, ensure that the implementation of the handle does not close the stream. The stream should be reseted after the handler call, or you simply creat a new buffered stream (java.io.BufferedInputStream) containing the parsed data, which is than passed to the RF.
    Regards,
    Thilo

  • Help please!     java.io.IOException: Stream closed

    When I run my webapp under Tomcat5.5, it works fine, but I got the following Exception in Tomcat stdout.log:
    2005.04.19. 15:54:47 org.apache.jasper.runtime.PageContextImpl release
    WARNING: Internal error flushing the buffer in release()
    2005.04.19. 15:54:47 org.apache.catalina.core.StandardWrapperValve invoke
    WARNING: Servlet.service() for servlet jsp threw exception
    java.io.IOException: Stream closed
         at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204)
         at org.apache.jasper.runtime.JspWriterImpl.clearBuffer(JspWriterImpl.java:159)
         at org.apache.jsp.pages.tree_jsp._jspService(org.apache.jsp.pages.tree_jsp:58)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:534)I dont have an idea why did my webapp throw this. I got it when I logged in the webapp. I cant find the root problem, because there is no a word from my package in the exception-list above. What happened?
    Thanks in advance.

    SEVERE: Servlet.service() for servlet jsp threw exception
    java.io.IOException: Stream closed
         at org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204)
         at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:115)
         at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:186)
         at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:118)
         at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:77)
         at org.apache.jsp.accSubAccount_jsp._jspService(accSubAccount_jsp.java:244)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:619)It is in JSP, I was just quoting that looking into error stack I opened genrated java file accSubAccount_jsp.java at line 244 and came to know that this file has only 196 lins.
    At successfull submission I am opening a page through javascript window.location directive, probably it may be the reason?

  • Is stream closing needed here?

    Is stream closing needed when an object, whose instance variable is a stream, is removed from a Vector?
    I want to be sure whether getting rid of the object also gets rid of the streams, or should I explicitly close the stream before getting rid of the object?
    The following is my situation.
    class MyClass1{
         BufferedReader in;
         PrintWriter out;
    class MyClass2{
         Vector v; //holds MyClass1 objects
    void someMethod(MyClass1 mc1){ // To remove mc1 from Vector.
         v.remove(mc1); // Is this sufficient?
         // Or, should I do as follows?
    //     mc1.in.close();
    //     mc1.out.close();
    //     v.remove(mc1);
         }Thank you.

    You should always expicitly closea stream when you're done using it. And the close call should be inside a finally block so it gets executed even if an exception occurs.
    A stream may or may not be closed for you upon GC, but even if it is, you should never rely on that, as you don't know when or even if it will be GCed.

  • Input Stream closed error

    Hi,
    Iam using jsch API for connecting to SFTP, but my code is giving the error saying :"com.jcraft.jsch.JSchException: java.io.IOException: inputstream is closed", though Iam clossing the channel. So, can anyone suggest what could be the reason for this?

    So you are getting "input stream is closed" and you are "closing the channel".
    Your question?

  • Is request/reponse-streams closed by ServletContainer?

    Hi,
    Im trying to use a servlet for httptunneling of objects. The thing is that I would like to use the ServletResponse stream to send (serialize) objects asynchronously to a connected client by fire off a thread that handles the object-sending, but it seems like the Request/Response streams are closed when doGet/doPost returns? Is there any possibility to avoid the streams getting closed.
    I know this may not be the correct way of using the HTTP-protocol, but I like the feature of tunnel objects through http/https.
    regards
    Magnus

    Http defines a Keep-Alive attribute that the client can send to the server to request that the connection remain up between requests. However the Application server builds new streams for you each time a request is made, which are typically not directly connected to the raw stream from the socket.
    So no i don't think there is an answer to your question.
    I've always thought that the Servlet api, should provide a
    response.doLater() method, which allows the http thread to be returned to the containers pool for work, and allow you to hold onto the streams for later processing. I agree that that would improve performance tremendously for hightraffic services that use remote services to process there requests, such as a message queue, or the like.
    The problem is that that introduces the thought that the web app has the audacity to think of creating it's own threads, something that web containers don't want you to do.
    as an aside it would be nice if an api was present where you could post Job objects (perhaps an extension of Runnable) to the servlet, that it would run for you periodically/asynchronously.

Maybe you are looking for

  • Error in creation of custom PD infotype

    Hi, I have a task of creating a custom PD infotype(p9xxx). I created HRI9xxx structure with all the custom fields and when I try to create the infotype using tcode PPCI(selected 'field infotype' option and create button in the 'infotype' block was pr

  • Will not boot with P4 3.06 Gig

    I have just update BIOS to the MSI latest available for the MS 6850 PE Max 2 and then after successful reboot and correcting date and time I removed the 1.7 Gig celeron and tried to install a Northwood 3.06 Gig P4.  However though the BIOS starts OK

  • Displaying 20 checkboxes in three columns

    In order to display a database item (table 1) item as check box. the values of chexk boxes are the results of another table with 20 records (table2), this I will have 20 check box in my form. I proceed like the following : I created a region with typ

  • Return to Base State

    Hello, I have a Flex canvas that contains several buttons. When I click the button it changes to the next state which brings up a custom component that has a panel with buttons on it. One of the buttons should close the panel and return to the origin

  • PSD thumbnails in Win7 explorer

    Is there a way to activate PSD and other thumbnails in Win7 Explorer?