Zimbra Server debugging

When you’re dealing with Zimbra Server Extensions, you occasionally have to have insight into what Zimbra’s actually doing with your code. So you need a way of remote debugging your extension.

As I found out now, it’s pretty simple to achieve that.

In your development Zimbra server as the Zimbra user go to /opt/zimbra/conf and copy your localconfig.xml to keep it safe. Then, edit your localconfig and add the following Java parameters to the option „mailboxd_java_options“:

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n

This can be achieved by runnig:

zmlocalconfig -e mailboxd_java_options="`zmlocalconfig -m nokey mailboxd_java_options` -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

After that as the root user go to /opt/zimbra/libexec, move away zmmailboxdctl and create a link to zmmailboxdctl.unrestricted:

mv zmmailboxdmgr zmmailboxdmgr.sav && ln -s zmmailboxdmgr.unrestricted zmmailboxdmgr

That way Zimbra won’t refuse to start with debugging enabled.

Now you only need an IDE, that supports remote debugging (Eclipse does this) and you’re good to go.

Remember to only do this on your Zimbra development system, not on the production!