After upgrading Zimbra version to the newest, I started getting NoClassDefFoundError for slf4j dependency in Sentry on start up.
WARN [main] [] Sentry - Overwriting statically stored SentryClient instance SentryClient{release='null', dist='null', environment='null', serverName='null', tags={}, mdcTags=[], extra={}, connection=io.sentry.connection.AsyncConnection@1fc5c0b2, builderHelpers=[io.sentry.event.helper.HttpEventBuilderHelper@45ad3cd8, io.sentry.event.helper.ContextBuilderHelper@2b90cc1], contextManager=io.sentry.context.ThreadLocalContextManager@5a2f401a, uncaughtExceptionHandler=io.sentry.SentryUncaughtExceptionHandler@6bdedbbd} with SentryClient{release='null', dist='null', environment='null', serverName='null', tags={}, mdcTags=[], extra={}, connection=io.sentry.connection.AsyncConnection@47b961e2, builderHelpers=[io.sentry.event.helper.HttpEventBuilderHelper@d2cb2d0, io.sentry.event.helper.ContextBuilderHelper@2d230cff], contextManager=io.sentry.context.ThreadLocalContextManager@30bd39d5, uncaughtExceptionHandler=io.sentry.SentryUncaughtExceptionHandler@3c87e851}.2021-05-04 10:55:19,581 FATAL [main] [] soap - Unable to start servletjava.lang.NoClassDefFoundError: Could not initialize class org.slf4j.MDCat io.sentry.connection.AsyncConnection.send(AsyncConnection.java:98)at io.sentry.SentryClient.sendEvent(SentryClient.java:139)at io.sentry.SentryClient.sendEvent(SentryClient.java:159)at io.sentry.Sentry.capture(Sentry.java:259)
I had connected my extension to Sentry for logging info/error purposes and was using version 1.7.29.
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>1.7.29</version>
</dependency>
To get fix this error, you need to upgrade your Sentry version such as:
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
<version>4.3.0</version>
</dependency>
After that, you need to update your captureEvent code like below:
I had known Zimbra jar paths as “/opt/zimbra/lib/jars” and “/opt/zimbra/jetty/common/lib” and tried copying gson-2.8.5.jar (downloaded from mvnrepository), used in Sentry’s 4.3.0 version as a runtime dependency, see sentry-4.3.0.pom file contents here) to these paths and performed a restart on Zimbra.
Apparently, there is another library directory as “/opt/zimbra/jetty/webapps/service/WEB-INF/lib/” (see this link).
So I removed the jar from the previously given paths and just copied it there:
sudo cp gson-2.8.5.jar /opt/zimbra/jetty/webapps/service/WEB-INF/lib/
Voilà!
Happy Coding!