English 中文(简体)
贾瓦勒——为什么我不时地在双管操作上拿到一个仓库的闭塞?
原标题:JavaMail - why do I sporadically get a StoreClosedException on a folder operation?

我的法典有以下部分:

// using classes from javax.mail.*
// Session / Store setup code
// Store implementation class = com.sun.mail.imap.IMAPStore

Folder folder = store.getFolder("INBOX");  // store setup previously
folder.open(Folder.READ_WRITE);
Message[] messages = folder.getMessages();
Folder anotherFolder = store.getFolder("F1");
if ( !anotherFolder.exists()) {                   [***]
  anotherFolder.create(Folder.HOLDS_MESSAGES);
}
folder.copyMessages(messages, anotherFolder);

我偶尔会得到以下例外:

javax.mail.StoreClosedException: failed to create new store connection
   at com.sun.mail.imap.IMAPFolder.throwClosedException(IMAPFolder.java:2208)
   at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:2335)
   at com.sun.mail.imap.IMAPFolder.exists(IMAPFolder.java:427)
   at [***]

我不知道这是否是因为我错误地利用贾瓦·安普朗斯,或者如果这是服务器问题。 我有两项意见:

  1. 失败发生时,它检查了双手的存亡,而不是援引主人。

  2. 《刑法》中不止一次地引用了“主人”。

我认为,与邮件服务器的连接有可能在文件夹后某个时候消失。 时常获得薪酬,但ALWAYS没有()要求,而没有(或)要求。

一种解决办法是叫卖仓库。 这是先来的,如果需要重新连接,但我想指出,如果在我求助之前,我会做一些错误。

如果能就如何更深入地了解这一例外的渊源,我将不胜感激。 提前感谢!

问题回答

The issue is you are not closing the folder . After usage we must close the folder. Again open the folder once needed. Don t open the same folder many times.

folder.close(false);
.
.
.
.
.
.
if (!folder.isOpen()) {
    folder.open(Folder.READ_ONLY);
}

我将其追踪到服务器本身。 我与Dovecot联系,用一种回收方法复制整个文件结构。

(Basically, I am forking ImapCopy from its 2008 unmaintained version relying on old Log4J and JGoodies to use native Swing/Netbeans forms, and newer Log4j, and also to support servers that don t allow folders&messages intermixed)

它是:2016-06-04T01:48:34.538050-04:00 moz dovecot: im: 用户+IP的连接量最大(电子邮箱:max_userip_linkions=10):用户=、方法=PLAIN, rip=10.1.4.21,lip=10.1.4.235, TLS, session=<6MXUY200UQAKrgQV>

So now I have to update that field to allow more than 10 connections. Or, more properly because I am planning on using it on o365, somehow read the folder structures first recursively (without opening new connections, or closing old ones) and then cycling through the folder structure separately to handle the messages.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签