Solved

Bad file number  error

Posted on 2001-06-13
2
1,654 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

623 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