powered by Jive Software

Websocket-plugin in Openfire 4.2.1 - NoSuchMethodError - HttpBindManager.getInstance().getContexts()

Had implemented a websocket plugin on Openfire 4.1.1 based on the below project
openfire-websockets

Migrating to Openfire 4.2.1 throws error
NoSuchMethodError - HttpBindManager.getInstance().getContexts()

Based on this link - https://www.igniterealtime.org/projects/openfire/plugins/websocket/readme.html
, I understand that this plugin is no longer needed for Openfire 4.2.0 or later

Any suggestions on how to fix this NoSuchMethodError, or is there any other way to add this plugin on the new version (like using the OpenfireWebSocketServlet).

Thanks,
Srividhya

I have solved this by using the addJettyHandler() method available in HttpBindManager

On Openfire 4.1.1, in the plugin class

ContextHandlerCollection contexts = HttpBindManager.getInstance().getContexts();
ServletContextHandler context = new ServletContextHandler(null, base_url, ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(new XMPPServlet(properties)), uri);

On Openfire 4.2.1,

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.addServlet(new ServletHolder(new XMPPServlet(properties)), base_url + uri);
HttpBindManager.getInstance().addJettyHandler( context );

Hope this is the right approach.

Thanks,
Srividhya

I can confirm that this is the right approach. Background for this change is tracked as https://issues.igniterealtime.org/browse/OF-1326

Thank you.

Thanks,
Srividhya

do we still need wss://your.openfire.host:7443/ws/ statement or we can use https://your.openfire.host:7443/http-bind/ to access websocket?