Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Bad file number  error

Posted on 2001-06-13
2
Medium Priority
?
1,658 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 200 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

670 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