从资源流读取时导致IOException读取错误的JBoss

时间:2013-08-08 19:38:22

标签: jboss5.x java-io

我从资源获取输入流,如下所示:

InputStream is = clazz.getClassLoader().getResourceAsStream(resourcePath);

最终,此输入流包含在InputStreamReader中,读取器与java.io.LineNumberReader一起用于从CSV文件中读取行。

代码适用于Tomcat,但是当我在JBoss 5.1.0 GA应用服务器上运行代码时,我遇到以下例外情况:

Caused by: java.io.IOException: Bad file descriptor
    at java.io.FileInputStream.readBytes(Native Method)
    at java.io.FileInputStream.read(FileInputStream.java:220)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
    at java.io.InputStreamReader.read(InputStreamReader.java:167)
    at java.io.BufferedReader.fill(BufferedReader.java:136)
    at java.io.BufferedReader.readLine(BufferedReader.java:299)
    at java.io.LineNumberReader.readLine(LineNumberReader.java:182)


Caused by: java.io.IOException: Read error
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:220)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.LineNumberReader.readLine(LineNumberReader.java:182)

有谁知道为什么这可以在Tomcat上运行而不在JBoss上运行?

0 个答案:

没有答案