I'm having a problem with some Java NIO code running on an iSeries box (JDK 1.5). Basically the code is splitting a file up into chunks part of a file to another smaller files. The same code has been operating on other iSeries boxes for some time with no problems. Here's the code snippet:
//copy original data file content to temp file
long startPos = dataFile.length() - remaining;
long transferSize = maxSizeBytes - size;
size += inChannel.transferTo(startPos, transferSize, outChannel); //exception here
remaining -= size;
Here's the stack trace:
Caused by: java.io.IOException: Operation not supported. Map failed
at java.lang.Throwable.<init>(Throwable.java:196)
at java.lang.Exception.<init>(Exception.java:41)
at java.io.IOException.<init>(IOException.java:40)
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:742)
at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java:448)
at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:521)
... 11 more
I've done some investigation and the causes so far (file permissions of parent directory, out of memory, shared memory control QSHRMEMCTL switched off, use of SAN) have all proved unsuccessful.
Anyone have any experience of this particular problem?
Thanks, Brad.
It sticks in my mind that reaching the file handle limit can result in non-obvious exceptions being raised by the JVM.
Check to see if you have enough file handles available. ulimit will tell you how many are at your disposal. (Of course, you'll want to know this number for the user the JVM is running under if it is a daemon.) This problem would also be system/user specific, which kinda fits your description of the fact this runs elsewhere just fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With