igniterealtime / Openfire-Chat

Chat API (REST) for Openfire
https://discourse.igniterealtime.org/t/openfire-chat-api/68792
15 stars 8 forks source link

rest api exception #9

Closed samusa123 closed 5 years ago

samusa123 commented 5 years ago

First, thanks for the great work.

I downloaded the latest master branch, built the code and deployed it into Openfire 4.3.2.

The rest api swagger UI is blank screen with the following error message.

2019.05.17 17:17:38 org.jivesoftware.util.LocaleUtils - Can't find bundle for base name ofchat-openfire-plugin-assembly_i18n, locale en java.util.MissingResourceException: Can't find bundle for base name ofchat-openfire-plugin-assembly_i18n, locale en at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1581) ~[?:1.8.0_212] at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396) ~[?:1.8.0_212] at java.util.ResourceBundle.getBundle(ResourceBundle.java:1091) ~[?:1.8.0_212] at org.jivesoftware.util.LocaleUtils.getLocalizedString(LocaleUtils.java:489) [xmppserver-4.3.2.jar:4.3.2] at org.jivesoftware.util.LocaleUtils.getLocalizedString(LocaleUtils.java:440) [xmppserver-4.3.2.jar:4.3.2] at org.jivesoftware.util.LocaleUtils.getLocalizedString(LocaleUtils.java:424) [xmppserver-4.3.2.jar:4.3.2] at org.jivesoftware.admin.AdminConsole.getAdminText(AdminConsole.java:202) [xmppserver-4.3.2.jar:4.3.2] at org.jivesoftware.admin.TabsTag.doEndTag(TabsTag.java:178) [xmppserver-4.3.2.jar:4.3.2] at org.jivesoftware.openfire.admin.decorators.main_jsp._jspx_meth_admin_005ftabs_005f1(main_jsp.java:849) [xmppserver-4.3.2.jar:4.3.2] at org.jivesoftware.openfire.admin.decorators.main_jsp._jspService(main_jsp.java:310) [xmppserver-4.3.2.jar:4.3.2] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [apache-jsp-8.5.24.2.jar:2.3] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865) [jetty-servlet-9.4.12.v20180830.jar:9.4.12.v20180830] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:535) [jetty-servlet-9.4.12.v20180830.jar:9.4.12.v20180830]

Further, when I tried the rest api login /restapi/v1/chat/{username}/login with the following payload:

{ "password": "password" }

The api always return 401. Even though I confirmed the correct username and password with other xmpp client.

Please look into this.

Thanks!

ravi8x commented 5 years ago

To make this work, I followed below steps.

  1. Uninstalled REST API, MUC Service plug ins.
  2. Installed the Openfire-Chat jar from the releases page of this repo instead of building it by my own. https://github.com/igniterealtime/Openfire-Chat/releases

Even though you have uninstalled REST API, it still works as it's part of Openfire-Chat (but on 7070 port)

deleolajide commented 5 years ago

Can't find bundle for base name ofchat-openfire-plugin-assembly_i18n, locale en

Looks like you did not rename the final jar file from ofchat-openfire-plugin-assembly to chat.jar before deploying in openfire. The new openfire plugin maven script does that when the plugin is deployed to the GitHub repository. Sorry, it is not documented for local deployment.

deleolajide commented 5 years ago

Further, when I tried the rest api login /restapi/v1/chat/{username}/login with the following payload: { "password": "password" }

image

Again, poor documentation. The payload is the actual password text. The best option is to just look at the source code. See https://github.com/igniterealtime/Openfire-Chat/blob/8e52be08f36eb075ac5f553f61d37f82a829b87f/src/java/org/jivesoftware/openfire/plugin/rest/service/ChatService.java#L231

ravi8x commented 5 years ago

Okay. But I am getting streamId even though I haven't sent the password. If I send a wrong password, it's throwing 500 error.

Will it make any difference if we don't send password?

deleolajide commented 5 years ago

Will it make any difference if we don't send password?

It will assume an anonymous connection and you will still get a stream id for that type of connection.

deleolajide commented 5 years ago

Updated documentation