Solved

Bad file number  error

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
for i loop in grovy 1 45
rhino JavaScript import, load 25 67
web services creation SOAP vs REST 5 20
oracle 11g 23 49
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)
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

910 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

19 Experts available now in Live!

Get 1:1 Help Now