igniterealtime / openfire-monitoring-plugin

Adds support for chat archiving and server statistics to Openfire
Apache License 2.0
18 stars 27 forks source link

Remove method usage deprecated in Openfire 4.8.0 #362

Open guusdk opened 1 year ago

guusdk commented 1 year ago

Version 2.5.0 (the latest release) of the Monitoring plugin is not compatbile with the upcoming release of Openfire 4.8.0.

2023.09.04 18:00:53 ERROR [PluginMonitorExec-4]: org.jivesoftware.openfire.container.PluginManager - An exception occurred while loading plugin 'monitoring':
java.lang.NoSuchMethodError: 'java.lang.String org.jivesoftware.util.JiveGlobals.getHomeDirectory()'
        at org.jivesoftware.openfire.archive.ArchiveIndexer.<init>(ArchiveIndexer.java:70) ~[?:?]
        at org.jivesoftware.openfire.plugin.MonitoringPlugin.<init>(MonitoringPlugin.java:128) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
        at java.lang.Class.newInstance(Class.java:584) ~[?:?]
        at org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.java:586) [xmppserver-4.8.0-SNAPSHOT.jar:4.8.0-SNAPSHOT]
        at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask$4.call(PluginMonitor.java:380) [xmppserver-4.8.0-SNAPSHOT.jar:4.8.0-SNAPSHOT]
        at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask$4.call(PluginMonitor.java:368) [xmppserver-4.8.0-SNAPSHOT.jar:4.8.0-SNAPSHOT]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
guusdk commented 1 year ago

The Openfire 4.8.0 release candidate has been modified to avoid this issue. The getHomeDirectory method, based on a String argument, has been restored. This prevents the runtime issue. The restored method has been marked as being deprecated. The Path based API is now available under the name getHomePath.

This plugin should be updated to migrate to the new Path based API, as the deprecated API will eventually be removed.