Install Zimbra as Local Project & IntelliJ Remote Debug

Prepare Your Zimbra Workspace Ready for Debug

Nil Seri
3 min readJan 25, 2021
Photo by Lance Asper on Unsplash

For steps about how to set up development environment for zm mailbox repository, you can see https://github.com/Zimbra/zm-mailbox/wiki/Setting-up-IntelliJ-IDEA-Community-Edition

There isn’t enough information about Ivy (plugin) in the link provided above so you can see https://github.com/Zimbra/zm-mailbox/wiki/Setting-up-Eclipse for details about Ivy plugin and how to install it.

I had errors because of dependency version parameters so I had to replace them with their real values by looking at the diff in github as below (you may not get this error though):

<dependency org="org.apache.httpcomponents" name="httpclient" rev="4.5.8"/>
<dependency org="org.apache.httpcomponents" name="httpasyncclient" rev="4.1.3"/>
<dependency org="org.apache.httpcomponents" name="httpcore" rev="4.4.11"/>
<dependency org="org.apache.httpcomponents" name="httpcore-nio" rev="4.4.11"/>
<dependency org="org.apache.httpcomponents" name="httpmime" rev="4.5.8"/>
<dependency org="xerces" name="xercesImpl" rev="2.9.1"/>

client:

common:

soap:

store:

Remote Debug

These links are very useful for setting up remote debug:

https://dennis.dieploegers.de/zimbra-server-debugging/ https://github.com/Zimbra-Community/zimbra-tools/blob/master/java-debug-zimbra-intellij-ide.md

cd /opt/zimbra/conf
sudo cp localconfig.xml localconfig_ORIGINAL.xml
sudo -u zimbra /opt/zimbra/bin/zmcontrol stopsudo cp /opt/zimbra/libexec/zmmailboxdmgr /opt/zimbra/libexec/zmmailboxdmgr.ORIGINAL
sudo cp /opt/zimbra/libexec/zmmailboxdmgr.unrestricted /opt/zimbra/libexec/zmmailboxdmgr
cd /opt/zimbra/libexecsudo mv zmmailboxdmgr zmmailboxdmgr.sav
sudo ln -s zmmailboxdmgr.unrestricted zmmailboxdmgr
sudo nano /opt/zimbra/conf/localconfig.xml* search "mailboxd_java_options" and append
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"*
sudo -u zimbra /opt/zimbra/bin/zmcontrol start

After these steps, you may be getting errors about LDAP like “Connect: Unable to determine enabled services from ldap. Unable to determine enabled services. Cache is out of date or doesn’t exist.” To fix these:

chown -R zimbra:zimbra /opt/zimbra
/opt/zimbra/libexec/zmfixperms -verbose
sudo -u zimbra /opt/zimbra/bin/zmcontrol start

After all Zimbra modules are up, you can check port 5005 belongs to Java process with these commands:

sudo netstat — tcp — udp — listening — programsudo netstat -tulpn | grep LISTEN

IntelliJ remote debug config:

Go to “Debug → Edit Configurations”, with “+” you “Add New Configuration”, choose “Remote” from the list as template, rename and then save it.

Debug with this configuration and make sure the same message appears in your IntelliJ console:

Happy Coding!

--

--

Nil Seri
Nil Seri

Written by Nil Seri

I would love to change the world, but they won’t give me the source code | coding 👩🏻‍💻 | coffee ☕️ | jazz 🎷 | anime 🐲 | books 📚 | drawing 🎨

No responses yet