The sourcecode of MimePull, which produces the Exception, says this:
if (!config.isOnlyMemory() && dataHead.inMemory >= config.memoryThreshold) {
try {
String prefix = config.getTempFilePrefix();
String suffix = config.getTempFileSuffix();
File dir = config.getTempDir();
File tempFile = (dir == null)
? File.createTempFile(prefix, suffix) // here your code crashes
: File.createTempFile(prefix, suffix, dir);
LOGGER.fine("Created temp file = "+tempFile);
dataHead.dataFile = new DataFile(tempFile);
} catch(IOException ioe) {
throw new MIMEParsingException(ioe);
}
It tries to open a temp file, because the memory size threshold is passed.
It is called
at MyCode.MyServlet.doPost(MyServlet.java:215)
It looks like you are using SAAJ to receive the messages and have enabled the MimePull plugin (using -Dsaaj.use.mimepull=true
flag). It should allow receiving larger files, as the MimePull implementation uses temporary files as a fallback.
Now the bad news seems to be, that you can't configure the MimePull reader through your SAAJ configuration.
The good news may be that you are able to tweak the logic of File.createTempFile(...)
through the system property java.io.tmpdir
.
Try starting with -Djava.io.tmpdir=/path/to/tmpdir
.
Else maybe try to consume the message directly with MimePull I never did this myself, so don't ask me about it. ;-)
EDIT:
Or switch off MimePull completely by setting -Dsaaj.use.mimepull=false
if you do not expect your attachments to soak up all your memory.