Solved

Bad file number  error

Posted on 2001-06-13
2
1,643 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

758 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now