Solved

Bad file number  error

Posted on 2001-06-13
2
1,649 Views
Last Modified: 2010-08-05
Hi,

I am getting this error
<HTTP> Servlet request terminated with IOException:
java.io.IOException: Bad file number
        at java.net.SocketOutputStream.socketWrite(Native Method)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
        at weblogic.servlet.internal.ChunkUtils.writeChunks(ChunkUtils.java:114)
        at weblogic.servlet.internal.ResponseHeaders.writeHeaders(ResponseHeaders.java:340)
        at weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseImpl.java:701)
        at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:102)
        at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:91)
        at weblogic.servlet.internal.ServletOutputStreamImpl.finish(ServletOutputStreamImpl.java:374)
        at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:254)
        at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:364)
        at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:252)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)

Can you explain me the reason for this.

Thanks,
vinayc25
0
Comment
Question by:vinayc25
2 Comments
 
LVL 2

Accepted Solution

by:
venkat2000120699 earned 50 total points
ID: 6187925
The problem might be that you open a file and don't close it:

eg: output = new BufferedReader(
                new InputStreamReader(
                    process.getInputStream()));

The field output keeps a pointer to the BufferedReader until the containing object is garbage-collected. The BufferedReader object, in turn, contains something called a "file descriptor", which is something created by the operating system to represent an open file. When the containing object is garbage-collected, the file is closed and the file descriptor is released, but your program is running out of file descriptors before it runs low on memory and invokes the garbage collector.
The simplest solution is to call output.close() as soon as you get an end-of-file indication reading from output.

You should do this for all open files, which are no more used in the program.
0
 

Expert Comment

by:SpideyMod
ID: 8145222
Administrative Action - Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Apps blocked by Java 9 88
by zero exception 10 54
CSV file parsing thru Java 13 34
Java: The Public Class Main 4 34
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question