Plugin Loader bug + fix

Openfire will fail to load a plugin under certain circumstances. In these cases, this message gets repeated in the logs:

12:50:16,249 pool-13-thread-1 ERROR org.jivesoftware.util.Log - Error loading plugin: /srv/openfire/plugins/muccleaner

java.lang.ClassNotFoundException:

com.buzzaa.openfire.plugin.muccleaner.MUCCleanerPlugin
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.jivesoftware.openfire.container.PluginClassLoader.loadClass(PluginClassLoad er.java:162)
at org.jivesoftware.openfire.container.PluginManager.loadPlugin(PluginManager.java :345)
at org.jivesoftware.openfire.container.PluginManager.access$200(PluginManager.java :46)
at org.jivesoftware.openfire.container.PluginManager$PluginMonitor.run(PluginManag er.java:916)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101 (ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodi c(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)

The plugin.xml has of the specified plugin has this layout:

<class>
  com.buzzaa.openfire.plugin.muccleaner.MUCCleanerPlugin
</class>

Openfire will now try to load a plugin that has a newline in its name.

A workaround for this problem is replacing the class definition in the plugin.xml file with this:

<class>com.buzzaa.openfire.plugin.muccleaner.MUCCleanerPlugin</class>

To fix this problem, I’ve replaced this line in PluginManager.java:

// String className = pluginXML.selectSingleNode("/plugin/class").getText();
// replace by:
String className = pluginXML.selectSingleNode("/plugin/class").getText().trim();

Hey Guus,

Thanks for the bug report. I filed it as JM-1152 and checked in a fix for 3.4.0.

Regards,

– Gato