software

博客介绍了WinMerge代码对比工具。该工具可用于代码对比,在信息技术领域能帮助开发者高效发现代码差异,提升开发效率。
WinMerge 代码对比工具
[root@yfw ~]# cd /opt/openfire [root@yfw openfire]# [root@yfw ~]# cd /opt/openfire -bash: [root@yfw: command not found [root@yfw openfire]# [root@yfw openfire]# cd ~/openfire-plugin-build eaning - Stop old timer if started 2025.10.03 04-bash: [root@yfw: command not found [root@yfw openfire]# [root@yfw openfire-plugin-build]# rm -rf src/RestApiPlugin.java :31:49.980 INFO [Thread-2]: org.jivesoftware.openfire.XMPPServe-bash: [root@yfw: command not found [root@yfw openfire]# [root@yfw openfire-plugin-build]# mkdir -p src r - Openfire stopped 2025.10.03 04:31:51.473 IN-bash: [root@yfw: command not found [root@yfw openfire]# [root@yfw openfire-plugin-build]# cat > src/RestApiPlugin.java << 'EOF' > > public class RestApiPlugin implements org.jivesoftware.openfire.container.Plugin { > > > > static { > > System.out.println("[PLUGIN-DEBUG] 💡 静态块执行:RestApiPlugin 类已被 JVM 加载!"); Plugin.class"));em.out.println("[PLUGIN-DEBUG] 📦 类资源位置: " + RestApiPlugin.class.getResource("RestApiP > > } > > > > public RestApiPlugin() { > > System.out.println("[PLUGIN-DEBUG] 🆕 构造函数执行:RestApiPlugin 实例已创建"); > > } > > > > @Override > > public void initializePlugin(org.jivesoftware.openfire.container.PluginManager manager, java.io.File pluginDirectory) { ePath()); System.out.println("[PLUGIN-DEBUG] 🎉 插件初始化成功!插件目录: " + pluginDirectory.getAbsolute > > } > > > > @Override > > public void destroyPlugin() { org.ji> > System.out.println("[PLUGIN-DEBUG] 🔌 插件已销毁"); > > } > > } > > EOF > [root@yfw openfire-plugin-build]# # 编译 > [root@yfw openfire-plugin-build]# /usr/lib/jvm/java-11-openjdk/bin/javac \ > > -source 11 -target 11 \ > > -cp "/opt/openfire/lib/xmppserver-4.9.2.jar" \ > > -d classes \ > > src/RestApiPlugin.java > [root@yfw openfire-plugin-build]# > [root@yfw openfire-plugin-build]# # 打包 > [root@yfw openfire-plugin-build]# jar cf restapi.jar -C classes . > [root@yfw openfire-plugin-build]# > [root@yfw openfire-plugin-build]# # 清除旧插件和缓存 > [root@yfw openfire-plugin-build]# rm -rf /opt/openfire/plugins/restapi > [root@yfw openfire-plugin-build]# rm -rf /opt/openfire/work/plugins/restapi* > [root@yfw openfire-plugin-build]# > [root@yfw openfire-plugin-build]# # 部署 > [root@yfw openfire-plugin-build]# mkdir -p /opt/openfire/plugins/restapi > [root@yfw openfire-plugin-build]# cp restapi.jar /opt/openfire/plugins/restapi/ > [root@yfw openfire-plugin-build]# > [root@yfw openfire-plugin-build]# # 写入 plugin.xml(确保没问题) > [root@yfw openfire-plugin-build]# cat > /opt/openfire/plugins/restapi/plugin.xml << 'EOF' > > <?xml version="1.0" encoding="UTF-8"?> > > <plugin> > > <className>RestApiPlugin</className> > > <name>REST API Plugin</name> > > <description>Simple REST API Plugin with Debug Logs</description> > > <author>Admin</author> > > <version>1.0.0</version> > > <date>2025-10-03</date> > > <minServerVersion>4.0.0</minServerVersion> > > </plugin> > > EOF > [root@yfw openfire-plugin-build]# > [root@yfw openfire-plugin-build]# # 权限 > [root@yfw openfire-plugin-build]# chown -R openfire:openfire /opt/openfire/plugins/restapi > [root@yfw openfire-plugin-build]# chmod -R 755 /opt/openfire/plugins/restapi > [root@yfw openfire-plugin-build]# > [root@yfw openfire-plugin-build]# # 重启 > [root@yfw openfire-plugin-build]# systemctl restart openfire > [root@yfw openfire-plugin-build]# > [root@yfw openfire-plugin-build]# # 查看日志 > [root@yfw openfire-plugin-build]# tail -f /opt/openfire/logs/openfire.log > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > 2025.10.03 04:31:49.782 INFO [Thread-2]: org.jivesoftware.openfire.XMPPServer - Shutting down plugins ... > 2025.10.03 04:31:49.782 INFO [Thread-2]: org.jivesoftware.openfire.container.PluginManager - Shutting down. Unloading all loaded plugins... tLocalCacheStrategy] for Components Sessions 2025.10.03 04:31:52.353 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Connection Managers Sessions 20> 2025.10.03 04:31:49.789 INFO [Thread-2]: org.jivesoftware.openfire.XMPPServer - Shutting down 54 modus ... > 2025.10.03 04:31:49.962 INFO [shutdown-thread-0]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Flushing write cache to database > 2025.10.03 04:31:49.966 INFO [shutdown-thread-0]: org.jivesoftware.openfire.OfflineMessageStore - Offline message cleaning - Stop old timer if started > 2025.10.03 04:31:49.980 INFO [Thread-2]: org.jivesoftware.openfire.XMPPServer - Openfire stopped > 2025.10.03 04:31:51.473 INFO [main]: org.jivesoftware.openfire.XMPPServer - Registering shutdown hook (standalone mode) > 2025.10.03 04:31:52.088 INFO [main]: org.jivesoftware.util.cache.ConsistencyMonitor - Applying configuration for cache consistency check. Enabled: false > 2025.10.03 04:31:52.110 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing Servers Cache > 2025.10.03 04:31:52.112 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing Components Cache > 2025.10.03 04:31:52.113 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing Users Cache > 2025.10.03 04:31:52.113 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing AnonymousUsers Cache > 2025.10.03 04:31:52.114 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing User Sessions > 2025.10.03 04:31:52.118 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Roster > 2025.10.03 04:31:52.121 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for RosterItems .03 04:31:52.381 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocal> 2025.10.03 04:31:52.139 INFO [main]: org.jivesoftware.util.cache.CacheFactory - software.util.cache.DefaultLocalCacheStrategy] for Routing Result Listeners > 2025.10.03 04:31:52.142 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Multicast Service > 2025.10.03 04:31:52.147 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Offline Message Size > 2025.10.03 04:31:52.150 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for VCard > 2025.10.03 04:31:52.254 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Privacy Lists > 2025.10.03 04:31:52.258 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for File Transfer Cache > 2025.10.03 04:31:52.334 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Offline Presence Cache > 2025.10.03 04:31:52.335 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Last Activity Cache > 2025.10.03 04:31:52.339 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for User > 2025.10.03 04:31:52.339 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Remote Users Existence > 2025.10.03 04:31:52.352 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Components Sessions > 2025.10.03 04:31:52.353 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Connection Managers Sessions > 2025.10.03 04:31:52.353 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Incoming Server Session Info Cache 0.03 04:31:52.723 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.Default> 2025.10.03 04:31:52.353 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Creasoftware.util.cache.DefaultLocalCacheStrategy] for Sessions by Hostname > 2025.10.03 04:31:52.353 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Client Session Info Cache > 2025.10.03 04:31:52.355 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Directed Presences > 2025.10.03 04:31:52.356 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for PEPServiceManager > 2025.10.03 04:31:52.358 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for File Transfer > 2025.10.03 04:31:52.361 INFO [main]: org.jivesoftware.openfire.pubsub.PubSubPersistenceProviderManager - Loading PubSub persistence provider: class org.jivesoftware.openfire.pubsub.CachingPubsubPersistenceProvider. > 2025.10.03 04:31:52.363 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Published Items > 2025.10.03 04:31:52.364 INFO [main]: org.jivesoftware.openfire.pubsub.CachingPubsubPersistenceProvider - Loading PubSub persistence provider to delegate to: class org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider. > 2025.10.03 04:31:52.368 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Default Node Configurations > 2025.10.03 04:31:52.381 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Disco Server Features > 2025.10.03 04:31:52.386 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Disco Server Items > 2025.10.03 04:31:52.386 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Components > 2025.10.03 04:31:52.612 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Entity Capabilities LDAP UserDN 2025.10.03 04:31:53.526 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'ANONYMOUS' SASL mechanism. 2> 2025.10.03 04:31:52.612 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cace [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Entity Capabilities Users > 2025.10.03 04:31:52.662 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Group (Shared) Metadata Cache > 2025.10.03 04:31:52.666 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Group > 2025.10.03 04:31:52.667 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Group Metadata Cache > 2025.10.03 04:31:52.700 INFO [main]: org.jivesoftware.openfire.pubsub.PubSubModule - 发布–订阅域:pubsub.localhost > 2025.10.03 04:31:52.711 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service Pings Sent > 2025.10.03 04:31:52.713 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC History > 2025.10.03 04:31:52.717 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'conference' Rooms > 2025.10.03 04:31:52.717 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'conference' Room Statistics > 2025.10.03 04:31:52.723 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'lobby' Rooms > 2025.10.03 04:31:52.723 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'lobby' Room Statistics > 2025.10.03 04:31:52.733 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - Rescheduling user idle task, recurring every PT15M > 2025.10.03 04:31:52.738 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - 多用 户聊天域:conference.localhost > 2025.10.03 04:31:52.757 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - Rescheduling user idle task, recurring every PT15M > 2025.10.03 04:31:52.759 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - 多用 户聊天域:lobby.localhost > 2025.10.03 04:31:52.792 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:31:52.797 INFO [main]: org.jivesoftware.openfire.XMPPServer - Openfire 4.9.2 [2025年10月3日 上午4:31:52] > 2025.10.03 04:31:52.794 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > 2025.10.03 04:31:52.998 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for LDAP UserDN > 2025.10.03 04:31:53.526 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'ANONYMOUS' SASL mechanism. > 2025.10.03 04:31:53.526 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'CRAM-MD5' SASL mechanism. > 2025.10.03 04:31:53.526 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'DIGEST-MD5' SASL mechanism. > 2025.10.03 04:31:53.526 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'EXTERNAL' SASL mechanism. > 2025.10.03 04:31:53.527 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'GSSAPI' SASL mechanism. > 2025.10.03 04:31:53.527 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'JIVE-SHAREDSECRET' SASL mechanism. > 2025.10.03 04:31:53.527 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'PLAIN' SASL mechanism. > 2025.10.03 04:31:53.527 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'SCRAM-SHA-1' SASL mechanism. > 2025.10.03 04:31:53.568 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Remote Server Configurations > 2025.10.03 04:32:12.807 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:32:12.808 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > 2025.10.03 04:32:32.810 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:32:32.810 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > 2025.10.03 04:32:52.811 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:32:52.811 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] onitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] at java.util.concurrent.Exec> at java.lang.Thread.run(Thread.java:829) [?:?] > 2025.10.03 04:33:12.813 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:33:12.813 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > 2025.10.03 04:33:32.814 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:33:32.814 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > 2025.10.03 04:33:52.816 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:33:52.816 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > 2025.10.03 04:34:12.817 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. > 2025.10.03 04:34:12.817 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: > java.lang.NullPointerException: null > at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] > at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] > at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] > at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] > at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] > 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) [?:?] > > [root@yfw ~]# cd /opt/openfire [root@yfw openfire]# cd ~/openfire-plugin-build [root@yfw openfire-plugin-build]# rm -f src/RestApiPlugin.java [root@yfw openfire-plugin-build]# [root@yfw openfire-plugin-build]# echo -e 'public class RestApiPlugin implements org.jivesoftware.openfire.container.Plugin {\n' \ > ' static {\n' \ > ' System.out.println("[PLUGIN-DEBUG] 💡 静态块执行:RestApiPlugin 类已被 JVM 加载!");\n' \ tApiPlugin.class"));\n' \t.println("[PLUGIN-DEBUG] 📦 类资源位置: " + RestApiPlugin.class.getResource("Rest > ' }\n' \ > '\n' \ > ' public RestApiPlugin() {\n' \ > ' System.out.println("[PLUGIN-DEBUG] 🆕 构造函数执行:RestApiPlugin 实例已创建");\n' \ > ' }\n' \ > '\n' \ > ' @Override\n' \ > ' public void initializePlugin(org.jivesoftware.openfire.container.PluginManager manager, java.io.File pluginDirectory) {\n' \ olutePath());\n' \stem.out.println("[PLUGIN-DEBUG] 🎉 插件初始化成功!插件目录: " + pluginDirectory.getAbso > ' }\n' \ > '\n' \ > ' @Override\n' \ > ' public void destroyPlugin() {\n' \ > ' System.out.println("[PLUGIN-DEBUG] 🔌 插件已销毁");\n' \ > ' }\n' \ > '}' > src/RestApiPlugin.java [root@yfw openfire-plugin-build]# cat src/RestApiPlugin.java public class RestApiPlugin implements org.jivesoftware.openfire.container.Plugin { static { System.out.println("[PLUGIN-DEBUG] 💡 静态块执行:RestApiPlugin 类已被 JVM 加载!"); System.out.println("[PLUGIN-DEBUG] 📦 类资源位置: " + RestApiPlugin.class.getResource("RestApiPlugin.class")); } public RestApiPlugin() { System.out.println("[PLUGIN-DEBUG] 🆕 构造函数执行:RestApiPlugin 实例已创建"); } @Override public void initializePlugin(org.jivesoftware.openfire.container.PluginManager manager, java.io.File pluginDirectory) { System.out.println("[PLUGIN-DEBUG] 🎉 插件初始化成功!插件目录: " + pluginDirectory.getAbsolutePath()); } @Override public void destroyPlugin() { System.out.println("[PLUGIN-DEBUG] 🔌 插件已销毁"); } } [root@yfw openfire-plugin-build]# # 编译 [root@yfw openfire-plugin-build]# /usr/lib/jvm/java-11-openjdk/bin/javac \ > -source 11 -target 11 \ > -cp "/opt/openfire/lib/xmppserver-4.9.2.jar" \ > -d classes \ > src/RestApiPlugin.java [root@yfw openfire-plugin-build]# [root@yfw openfire-plugin-build]# # 打包 [root@yfw openfire-plugin-build]# jar cf restapi.jar -C classes . [root@yfw openfire-plugin-build]# [root@yfw openfire-plugin-build]# # 清除旧插件和缓存 [root@yfw openfire-plugin-build]# rm -rf /opt/openfire/plugins/restapi [root@yfw openfire-plugin-build]# rm -rf /opt/openfire/work/plugins/restapi* [root@yfw openfire-plugin-build]# [root@yfw openfire-plugin-build]# # 部署 [root@yfw openfire-plugin-build]# mkdir -p /opt/openfire/plugins/restapi [root@yfw openfire-plugin-build]# cp restapi.jar /opt/openfire/plugins/restapi/ [root@yfw openfire-plugin-build]# [root@yfw openfire-plugin-build]# # 确保 plugin.xml 存在且正确 [root@yfw openfire-plugin-build]# cat > /opt/openfire/plugins/restapi/plugin.xml << 'EOF' > <?xml version="1.0" encoding="UTF-8"?> > <plugin> > <className>RestApiPlugin</className> > <name>REST API Plugin</name> > <description>Simple REST API Plugin with Debug Logs</description> > <author>Admin</author> > <version>1.0.0</version> > <date>2025-10-03</date> > <minServerVersion>4.0.0</minServerVersion> > </plugin> > EOF [root@yfw openfire-plugin-build]# [root@yfw openfire-plugin-build]# # 重启 Openfire [root@yfw openfire-plugin-build]# systemctl restart openfire [root@yfw openfire-plugin-build]# [root@yfw openfire-plugin-build]# # 查看日志 [root@yfw openfire-plugin-build]# tail -f /opt/openfire/logs/openfire.log at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] 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) [?:?] 2025.10.03 04:49:02.536 INFO [Thread-2]: org.jivesoftware.openfire.XMPPServer - Shutting down plugins ... 2025.10.03 04:49:02.536 INFO [Thread-2]: org.jivesoftware.openfire.container.PluginManager - Shutting down. Unloading all loaded plugins... 2025.10.03 04:49:02.541 INFO [Thread-2]: org.jivesoftware.openfire.XMPPServer - Shutting down 54 modules ... 2025.10.03 04:49:02.982 INFO [shutdown-thread-0]: org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider - Flushing write cache to database 2025.10.03 04:49:03.022 INFO [shutdown-thread-0]: org.jivesoftware.openfire.OfflineMessageStore - Offline message cleaning - Stop old timer if started 2025.10.03 04:49:03.032 INFO [Thread-2]: org.jivesoftware.openfire.XMPPServer - Openfire stopped 2025.10.03 04:49:04.608 INFO [main]: org.jivesoftware.openfire.XMPPServer - Registering shutdown hook (standalone mode) 2025.10.03 04:49:05.196 INFO [main]: org.jivesoftware.util.cache.ConsistencyMonitor - Applying configuration for cache consistency check. Enabled: false 2025.10.03 04:49:05.213 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing Servers Cache 2025.10.03 04:49:05.214 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing Components Cache 2025.10.03 04:49:05.215 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing Users Cache 2025.10.03 04:49:05.215 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing AnonymousUsers Cache 2025.10.03 04:49:05.215 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing User Sessions 2025.10.03 04:49:05.220 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Roster 2025.10.03 04:49:05.222 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for RosterItems 2025.10.03 04:49:05.239 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Routing Result Listeners 2025.10.03 04:49:05.242 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Multicast Service 2025.10.03 04:49:05.245 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Offline Message Size 2025.10.03 04:49:05.248 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for VCard 2025.10.03 04:49:05.353 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Privacy Lists 2025.10.03 04:49:05.354 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for File Transfer Cache 2025.10.03 04:49:05.431 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Offline Presence Cache 2025.10.03 04:49:05.431 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Last Activity Cache 2025.10.03 04:49:05.435 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for User 2025.10.03 04:49:05.435 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Remote Users Existence 2025.10.03 04:49:05.453 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Components Sessions 2025.10.03 04:49:05.453 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Connection Managers Sessions 2025.10.03 04:49:05.453 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Incoming Server Session Info Cache 2025.10.03 04:49:05.453 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Sessions by Hostname 2025.10.03 04:49:05.453 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Client Session Info Cache 2025.10.03 04:49:05.454 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Directed Presences 2025.10.03 04:49:05.459 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for PEPServiceManager 2025.10.03 04:49:05.462 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for File Transfer 2025.10.03 04:49:05.465 INFO [main]: org.jivesoftware.openfire.pubsub.PubSubPersistenceProviderManager - Loading PubSub persistence provider: class org.jivesoftware.openfire.pubsub.CachingPubsubPersistenceProvider. 2025.10.03 04:49:05.469 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Published Items 2025.10.03 04:49:05.469 INFO [main]: org.jivesoftware.openfire.pubsub.CachingPubsubPersistenceProvider - Loading PubSub persistence provider to delegate to: class org.jivesoftware.openfire.pubsub.DefaultPubSubPersistenceProvider. 2025.10.03 04:49:05.474 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Default Node Configurations 2025.10.03 04:49:05.488 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Disco Server Features 2025.10.03 04:49:05.494 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Disco Server Items 2025.10.03 04:49:05.494 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Components 2025.10.03 04:49:05.701 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Entity Capabilities 2025.10.03 04:49:05.702 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Entity Capabilities Users 2025.10.03 04:49:05.750 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created local-only cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Group (Shared) Metadata Cache 2025.10.03 04:49:05.750 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Group 2025.10.03 04:49:05.751 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Group Metadata Cache 2025.10.03 04:49:05.770 INFO [main]: org.jivesoftware.openfire.pubsub.PubSubModule - 发布–订阅域:pubsub.localhost 2025.10.03 04:49:05.778 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service Pings Sent 2025.10.03 04:49:05.780 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC History 2025.10.03 04:49:05.782 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'conference' Rooms 2025.10.03 04:49:05.782 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'conference' Room Statistics 2025.10.03 04:49:05.785 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'lobby' Rooms 2025.10.03 04:49:05.785 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for MUC Service 'lobby' Room Statistics 2025.10.03 04:49:05.793 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - Rescheduling user idle task, recurring every PT15M 2025.10.03 04:49:05.797 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - 多用户聊天域:conference.localhost 2025.10.03 04:49:05.818 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - Rescheduling user idle task, recurring every PT15M 2025.10.03 04:49:05.819 INFO [main]: org.jivesoftware.openfire.muc.spi.MultiUserChatServiceImpl - 多用户聊天域:lobby.localhost 2025.10.03 04:49:05.841 INFO [main]: org.jivesoftware.openfire.XMPPServer - Openfire 4.9.2 [2025年10月3日 上午4:49:05] 2025.10.03 04:49:05.867 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. 2025.10.03 04:49:05.868 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: java.lang.NullPointerException: null at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] 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) [?:?] 2025.10.03 04:49:06.097 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for LDAP UserDN 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'ANONYMOUS' SASL mechanism. 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'CRAM-MD5' SASL mechanism. 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'DIGEST-MD5' SASL mechanism. 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'EXTERNAL' SASL mechanism. 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'GSSAPI' SASL mechanism. 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'JIVE-SHAREDSECRET' SASL mechanism. 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'PLAIN' SASL mechanism. 2025.10.03 04:49:06.588 INFO [main]: org.jivesoftware.openfire.net.SASLAuthentication - Support added for the 'SCRAM-SHA-1' SASL mechanism. 2025.10.03 04:49:06.630 INFO [main]: org.jivesoftware.util.cache.CacheFactory - Created cache [org.jivesoftware.util.cache.DefaultLocalCacheStrategy] for Remote Server Configurations 2025.10.03 04:49:25.887 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. 2025.10.03 04:49:25.888 ERROR [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - An unexpected exception occurred: java.lang.NullPointerException: null at org.jivesoftware.openfire.container.PluginManager.unloadPlugin(PluginManager.java:883) ~[xmppserver-4.9.2.jar:4.9.2] at org.jivesoftware.openfire.container.PluginMonitor$MonitorTask.run(PluginMonitor.java:305) [xmppserver-4.9.2.jar:4.9.2] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?] at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) [?:?] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) [?:?] 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) [?:?]
10-04
太棒了!你已经非常接近成功了,而且这次我们有关键进展: --- ## ✅ 重要确认:你这次的 `RestApiPlugin.java` 写入是正确的! 运行命令: ```bash cat src/RestApiPlugin.java ``` 输出如下(已格式化): ```java public class RestApiPlugin implements org.jivesoftware.openfire.container.Plugin { static { System.out.println("[PLUGIN-DEBUG] 💡 静态块执行:RestApiPlugin 类已被 JVM 加载!"); System.out.println("[PLUGIN-DEBUG] 📦 类资源位置: " + RestApiPlugin.class.getResource("RestApiPlugin.class")); } public RestApiPlugin() { System.out.println("[PLUGIN-DEBUG] 🆕 构造函数执行:RestApiPlugin 实例已创建"); } @Override public void initializePlugin(org.jivesoftware.openfire.container.PluginManager manager, java.io.File pluginDirectory) { System.out.println("[PLUGIN-DEBUG] 🎉 插件初始化成功!插件目录: " + pluginDirectory.getAbsolutePath()); } @Override public void destroyPlugin() { System.out.println("[PLUGIN-DEBUG] 🔌 插件已销毁"); } } ``` ✅ **完全正确**!没有断行、没有拼接错误。这意味着编译出来的 `.class` 文件中确实包含调试日志。 --- ## ❌ 但是:Openfire 仍然没有加载它 你在日志中看到的是: ``` 2025.10.03 04:49:05.867 INFO [PluginMonitorTask-2]: org.jivesoftware.openfire.container.PluginMonitor - Plugin 'restapi' was removed from the file system. 2025.10.03 04:49:05.868 ERROR [PluginMonitorTask-2]: ... java.lang.NullPointerException: null at PluginManager.unloadPlugin(PluginManager.java:883) ``` 这说明 Openfire 扫描到了 `/opt/openfire/plugins/restapi` 目录,但尝试加载失败 → 标记为“已删除” → 触发 NPE。 但我们最关心的是:**为什么看不到任何 `[PLUGIN-DEBUG]` 日志?** --- ## 🔍 原因分析:很可能是因为 `System.out.println` 输出被重定向或未显示在 `openfire.log` Openfire 使用 Log4j 管理日志,而 `System.out` 默认可能不写入 `openfire.log`,尤其是在生产配置下。 👉 即使类被加载、静态块执行了,你也**看不到 `System.out.println` 的输出**! --- ## ✅ 解决方案:改用 Openfire 的日志系统 —— `Log.debug()` 或 `Log.info()` 我们需要使用 Openfire 自带的日志工具类:`org.slf4j.Logger` 和 `org.slf4j.LoggerFactory` ### 修改后的 `RestApiPlugin.java`(使用 SLF4J 日志) ```bash cd ~/openfire-plugin-build rm -f src/RestApiPlugin.java ``` 然后写入: ```bash echo -e 'import org.slf4j.Logger;\n' \ 'import org.slf4j.LoggerFactory;\n' \ '\n' \ 'public class RestApiPlugin implements org.jivesoftware.openfire.container.Plugin {\n' \ '\n' \ ' private static final Logger Log = LoggerFactory.getLogger(RestApiPlugin.class);\n' \ '\n' \ ' static {\n' \ ' Log.info("[PLUGIN-DEBUG] 💡 静态块执行:RestApiPlugin 类已被 JVM 加载!");\n' \ ' Log.info("[PLUGIN-DEBUG] 📦 类资源位置: {}", RestApiPlugin.class.getResource("RestApiPlugin.class"));\n' \ ' }\n' \ '\n' \ ' public RestApiPlugin() {\n' \ ' Log.info("[PLUGIN-DEBUG] 🆕 构造函数执行:RestApiPlugin 实例已创建");\n' \ ' }\n' \ '\n' \ ' @Override\n' \ ' public void initializePlugin(org.jivesoftware.openfire.container.PluginManager manager, java.io.File pluginDirectory) {\n' \ ' Log.info("[PLUGIN-DEBUG] 🎉 插件初始化成功!插件目录: {}", pluginDirectory.getAbsolutePath());\n' \ ' }\n' \ '\n' \ ' @Override\n' \ ' public void destroyPlugin() {\n' \ ' Log.info("[PLUGIN-DEBUG] 🔌 插件已销毁");\n' \ ' }\n' \ '}' > src/RestApiPlugin.java ``` --- ### ✅ 重新编译 & 部署 ```bash # 编译(保持原有 classpath) /usr/lib/jvm/java-11-openjdk/bin/javac \ -source 11 -target 11 \ -cp "/opt/openfire/lib/xmppserver-4.9.2.jar" \ -d classes \ src/RestApiPlugin.java # 打包 jar cf restapi.jar -C classes . # 删除旧插件和缓存 rm -rf /opt/openfire/plugins/restapi rm -rf /opt/openfire/work/plugins/restapi* # 部署 mkdir -p /opt/openfire/plugins/restapi cp restapi.jar /opt/openfire/plugins/restapi/ # 确保 plugin.xml 正确 cat > /opt/openfire/plugins/restapi/plugin.xml << 'EOF' <?xml version="1.0" encoding="UTF-8"?> <plugin> <className>RestApiPlugin</className> <name>REST API Plugin</name> <description>Simple REST API Plugin with SLF4J Logs</description> <author>Admin</author> <version>1.0.0</version> <date>2025-10-03</date> <minServerVersion>4.0.0</minServerVersion> </plugin> EOF # 权限 chown -R openfire:openfire /opt/openfire/plugins/restapi chmod -R 755 /opt/openfire/plugins/restapi # 重启 systemctl restart openfire # 查看日志 tail -f /opt/openfire/logs/openfire.log ``` --- ## ✅ 成功标志(你会看到这些日志) ``` [PLUGIN-DEBUG] 💡 静态块执行:RestApiPlugin 类已被 JVM 加载! [PLUGIN-DEBUG] 📦 类资源位置: jar:file:/opt/openfire/plugins/restapi/restapi.jar!/RestApiPlugin.class [PLUGIN-DEBUG] 🆕 构造函数执行:RestApiPlugin 实例已创建 [PLUGIN-DEBUG] 🎉 插件初始化成功!插件目录: /opt/openfire/plugins/restapi INFO [PluginManager] Successfully loaded plugin: restapi ``` 这一次,由于使用了 `Log.info()`,日志一定会出现在 `openfire.log` 中! --- ## 🛠️ 补充验证:检查 JAR 是否真的包含了新代码 ```bash unzip -p restapi.jar RestApiPlugin.class | strings | grep PLUGIN-DEBUG ``` 你应该能看到所有四条日志字符串。 --- ## 🧩 总结 | 问题 | 原因 | 解决 | |------|------|-------| | ❌ 没有看到调试日志 | 使用了 `System.out.println`,但输出未进入 `openfire.log` | 改用 `Log.info()`(SLF4J) | | ⚠️ `NullPointerException` in `unloadPlugin` | Openfire 尝试卸载一个加载失败的插件 | 是现象不是根本原因 | | 🔁 插件被反复标记“已删除” | 加载失败导致扫描器认为插件消失 | 修复后自动消失 | ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值