In my zimlet, I am trying to instantiate the mailbox with the current account but I have few errors.
I would like to get the following source code to work :
1) MailboxManager mgr = MailboxManager.getInstance();Code:// import com.zimbra.cs.mailbox.MailboxManager .... [...] MailboxManager mgr = MailboxManager.getInstance(); Mailbox mbox = mgr.getMailboxByAccountId(account.getId());
With this line, I have the errror in log/mailbox.log :
After comparing the zimbra v.6 source code with the zimbra v5 source code I have noticed several things :Code:com.zimbra.common.service.ServiceException: system failure: Database connection pool not initialized. [...] Code:service.FAILURE at com.zimbra.common.service.ServiceException.FAILURE(ServiceException.java:247) at com.zimbra.cs.db.DbPool.getConnection(DbPool.java:297) at com.zimbra.cs.db.DbPool.getConnection(DbPool.java:292)
- the DbPool class doesn't have the startup() method.
- the Account class inherits attributes and methods from the com.zimbra.cs.account.ZAttrAccount class which doesn't exist in Zimbra v5.
So I have added this line :and I have no more errors.Code:DbPool.startup();
2) Mailbox mbox = mgr.getMailboxByAccountId(account.getId());
With this line, I get the following error in firefox :
In mailbox.log I have :Code:HTTP ERROR 500 Problem accessing /service/zimlet/com_myZimlet/test.jsp. Reason: org/apache/lucene/store/Directory
If I use the method getMailboxByAccount(account) or another getMailbox method the error will be the same.Code:java.lang.NoClassDefFoundError: org/apache/lucene/store/Directory at com.zimbra.cs.index.LuceneFactory.create(LuceneFactory.java:26) at com.zimbra.cs.index.LuceneFactory.create(LuceneFactory.java:22) at com.zimbra.cs.index.MailboxIndex.<init>(MailboxIndex.java:312) at com.zimbra.cs.mailbox.IndexHelper.instantiateMailboxIndex(IndexHelper.java:103) [...] Caused by: java.lang.ClassNotFoundException: org.apache.lucene.store.Directory [...] ... 55 more
So I guess that means the problem comes from the Directory class in org.apache.lucene.store.Directory. In zimbra v6 it corresponds to the .jar used which is /jetty-6.1.5/webapps/service/WEB-INF/lib/lucene-core-2.4.1.jar (in zimbra v5 it is lucene-core-2.3.2.jar). I really don't know how to solve this issue
When I use the methods getAccountIds(), getAllLoadedMailboxes(), getMailboxIds() or isMailboxLoadedAndAvailable(long mailboxId) it works fine (however there is no mailboxes loaded).
And I have checked the values of the account object (account.getId() and others attributes) to be sure that the problem wasn't due to the account but everything is normal.
Thank you in advance for your help.
My current version of Zimbra is 6.0.3_GA_1915.RHEL5.FOSS 18 Nov 09.