Upgrade to 5.0.4 java issue

Hello,

I upgraded my openfire server from debian 11 to debian13. Openfire was running version 4.6. I tried to install version 5.0.4 but encountered an issue with a “NoClassDefFound” exception in caffeine.

Default jre is openjdk-21, I also ran tests with openjdk-25 and OpenFire 5.0.3

I had to downgrade OpenFire to version 4.9.2.

Any ideas?

Exception in thread “Thread-0” java.lang.NoClassDefFoundError: Could not initialize class org.jivesoftware.util.cache.CacheFactory
  at org.jivesoftware.openfire.cluster.ClusterManager.isClusteringStarted(ClusterManager.java:409)
  at org.jivesoftware.openfire.cluster.ClusterManager.shutdown(ClusterManager.java:339)
  at org.jivesoftware.openfire.XMPPServer.shutdownServer(XMPPServer.java:1219)
  at org.jivesoftware.openfire.XMPPServer$ShutdownHookThread.run(XMPPServer.java:1177)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/Policy$Expiration \[in thread “main”\]
  at org.jivesoftware.util.cache.CacheFactory.(CacheFactory.java:248)
  at org.jivesoftware.openfire.XMPPServer.initialize(XMPPServer.java:380)
  at org.jivesoftware.openfire.XMPPServer.start(XMPPServer.java:660)
  at org.jivesoftware.openfire.XMPPServer.(XMPPServer.java:220)
  at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
  at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
  at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:79)
  at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:189)
  at java.base/java.lang.Class.newInstance(Class.java:715)
  at org.jivesoftware.openfire.starter.ServerStarter.start(ServerStarter.java:92)
  at org.jivesoftware.openfire.starter.ServerStarter.main(ServerStarter.java:56)

This is a curious error. The most likely cause is a mix of ‘old’ and ‘new’ libraries on your system. It’s possible that the upgrade process left behind files from the previous installation, which are now interfering with Openfire 5.x.

The stack trace points to a problem with the Caffeine cache library (caffeine-*.jar). Openfire 5.x expects a newer version of this library, but it appears that an older version is being picked up at runtime. There should only be one caffeine-*.jar in your installation. If multiple versions are present, the wrong one can end up on the classpath. If that’s happening, it’s likely that other outdated libraries are also still present.

To resolve this, I’d recommend doing a clean installation of Openfire instead of upgrading in place. That should eliminate any leftover library conflicts and confirm if this is indeed the root cause.

The point is that I cannot find any other versions :

root:~# updatedb
root:~# locate caffeine
/usr/share/openfire/lib/caffeine-3.2.0.jar
root:~# find / -name caffeine*.jar
/usr/share/openfire/lib/caffeine-3.2.0.jar

I will try with a fresh install. Thank you.