Getting and Setting JiveGlobals properties from a plugin jsp

I have a plugin that needs to get and set 2 properties in JiveGlobals. I have created public getters and setters in this plugin for the purpose (they call JiveGlobals.setProperty(String, String) and JiveGlobals.getProperty(String).

In the JSP I’ve created for the admin console, I have an HTML form to submit new values for these. The file starts with this code:

<%@ page import="org.jivesoftware.util.ParamUtils,

com.gestalt.nettoolkit.nac.producer.listener.XmppPlugin,

org.jivesoftware.openfire.XMPPServer,

org.jivesoftware.openfire.container.PluginManager,

org.jivesoftware.openfire.container.Plugin" %>

<%

boolean save = request.getParameter(“save”) != null;

String hostname = “test”;

String port = “test”;

XmppPlugin plugin = (XmppPlugin) (XMPPServer.getInstance().getPluginManager().getPlugin(“listener-plugin”));

if (save) {

hostname = (String)ParamUtils.getParameter(request, “hostname”);

port = (String)ParamUtils.getParameter(request, “port”);

// plugin.setHostname(hostname);

// plugin.setPort(port);

} else {

hostname = plugin.getHostname();

port = plugin.getPort();

}

%>

SOME HTML

The problem is, this code serves up a blank page. If I comment out the code within the else block, however, it displays fine.

Any thoughts?

Hi Sam,

If I had to guess I would say that your call to getPlugin(“listener-plugin”) is returning a null, so when you try to get the hostname/port values there’s a NullPointerException being thrown. Are there any errors in your logs?

Thanks,

Ryan