Project

General

Profile

Problem with http api while upgrade to tigase 5.2.0 beta3

Keren Meir
Added about 5 years ago

Hi,

I used to have tigase 5.2.0 (not sure if beta1 or beta2) and added the HTTP REST API. I used it and it works good!

Now I upgraded the version to 5.2.0 beta3, added the same files of the HTTP REST API and it doesn't work:

I get an exception while I'm trying to connect (the same way as before the upgrade)

@[ConnectionOpenThread] ConnectionOpenThread.addAllWaiting() WARNING: Error: creating connection for: {secret=fef9d7d57dd58621a891c7c5699e1ab4532137ac0e080fe8a744b15620cbe9c0, local-host=isr021732703.corp.audiocodes.com, type=connect, socket=plain, remote-host=debian-7.1, ifc=[Ljava.lang.String;@1c14014, max-reconnects=99999999, port-no=5277}

java.nio.channels.UnresolvedAddressException

at sun.nio.ch.Net.checkAddress(Unknown Source)

at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)

at tigase.net.ConnectionOpenThread.addISA(ConnectionOpenThread.java:357)

at tigase.net.ConnectionOpenThread.addPort(ConnectionOpenThread.java:378)

at tigase.net.ConnectionOpenThread.addAllWaiting(ConnectionOpenThread.java:311)

at tigase.net.ConnectionOpenThread.run(ConnectionOpenThread.java:240)

at java.lang.Thread.run(Unknown Source)@

This exception running in loop every couple of seconds...

Is this problem fixable?

Thanks


Replies (20)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 5 years ago

Are you sure you use the HTTP Rest API component from the package of Tigase server 5.2.0 Beta3? We work on the code and it changes often, therefore, please make sure you use a correct library versions with a correct server version. The best way to make sure you have right libraries is to use only libraries provided within the package. Please also make sure you do not have 2 versions of the same library as this may cause problem.

The error you are attaching is related to a cluster mode. You have activated a cluster mode and provided cluster node address: debian-7.1. Therefore Tigase tries to connect to the other cluster node and fails as the address cannot be resolved. Then it tries again after a few seconds, and again, and again, and again..... This is all correct and expected. You have to either deactivate cluster mode and fix the configuration of the cluster node names. You need to use a canonical hostname as the address of the cluster node.

Added by Keren Meir about 5 years ago

  1. Is the HTTP Rest Library already include in the beta3? cause I didn't see it, that's why I added the Library I already have.

  2. I do activated the cluster mode, but didn't enter any address, here is my init.properties:

@config-type=--gen-config-def

basic-conf/virt-hosts-cert-*.mydomain.com=certs/mydomain.com.pem

--admins=admin@mydomain.com

--virt-hosts = mydomain.com, mydomain2.com

--inactive-time=1

--comp-name-3=rest

--comp-class-3=tigase.http.rest.RestMessageReceiver

--use-local-server=false

--rest-port=8080

--rest-ip=10.38.2.1

--cluster-mode=true

--cluster-connect-all=true

--tls-jdk-nss-bug-workaround-active = true

--user-db=mysql

--user-db-uri=jdbc:mysql://dbIP:3306/db?user=user&password=password&useUnicode=true&characterEncoding=UTF-8&autoCreateUser=true

--auth-db=tigase-auth

--auth-db-uri=jdbc:mysql://dbIP:3306/db?user=user&password=password=tigase_passwd&useUnicode=true&characterEncoding=UTF-8&autoCreateUser=true

--sm-plugins=+mobile_v1,+mobile_v2

@

So I don't know where the "Debian-7.1" comes from.

Added by Wojciech Kapcia TigaseTeam about 5 years ago

  1. Is the HTTP Rest Library already include in the beta3? cause I didn't see it, that's why I added the Library I already have.

Yes, it's already included with all dependencies, but in package dist-max.

  1. I do activated the cluster mode, but didn't enter any address, here is my init.properties:

New clustering automatically configure all your nodes so it's very important that all your cluster nodes have proper configuration of hostnames and those hostnames are correctly mapped and resolvable to each other. The "Debian-7.1" is probably name of one of the hosts to which tigase tries to connect and it was taken from the DB (each cluster node stores it's hostname in the DB and other nodes reads this data and make connection to the machines listed in there).

Added by Keren Meir about 5 years ago

  1. I don't have the package dist-max.... Where is it exactly?

  2. I'll clean the cluster in DB..... thanks!

Added by Wojciech Kapcia TigaseTeam about 5 years ago

It's in the files section, direct link tigase-server-5.2.0-beta3-b3269-dist-max.tar.gz

Added by Keren Meir about 5 years ago

Thank you, But...

I need the src files of the HTTP Rest API, Where can I find it?

Added by Keren Meir about 5 years ago

Ye, I found it just now... Thanks! I'll check it out

Added by Keren Meir about 5 years ago

Ok, it works but not all of the scripts....

When I'm trying to get a list of available command (HTTP GET - http://myIP:myPORT/rest/adhoc/vhost-man@mydomain.com) I get:

Error 404 Not Found

HTTP ERROR: 404

Problem accessing /rest/adhoc/sess-man@mydomain.com. Reason:

<hr /><i><small>Powered by Jetty://</small></i>


Is there a new way to get this list?

Thanks

Added by Wojciech Kapcia TigaseTeam about 5 years ago

first of all: in the URL you use vhost-man and in the response you have sess-man? I've used same url (with adjusted domain/port/ip) and it worked without any problem - first asked me for credentials and subsequently showed me list of all commands.

Did you:

  • correctly setup everything (especially put scripts in correct paths)?

  • used admin account while trying to obtain list of commands?

Added by Keren Meir about 5 years ago

Sorry, I copied the wrong link but i tried it now again, and it is not working. (the link is "http://myIP:myPORT/rest/adhoc/sess-man@mydomain.com")

The scripts located at: /tigase/scripts/admin/...

                    /tigase/scripts/rest/...

I used admin when I asked for credentials.

The script "comp-repo-reload" (in vhost-man) is working, so the problem is not in the credentials...

Added by Wojciech Kapcia TigaseTeam about 5 years ago

Again, can't confirm, for the URL http://tigase.org:8080/rest/adhoc/sess-man@tigase.org :

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<items>
<item>
<jid>sess-man@tigase.org</jid>
<node>http://jabber.org/protocol/admin#delete-user</node>
<name>Delete user</name>
</item>
<item>
<jid>sess-man@tigase.org</jid>
<node>http://jabber.org/protocol/admin#get-active-users</node>
<name>Get list of active users</name>
</item>
<item>
...
  • where you able to obtain list of commands for any component?

  • does this (listing commands) works from regular XMPP client?

Added by Keren Meir about 5 years ago

I tried "vhost-man" and "c2s"and it doesn't work (I don't even get any response)

I tried from psi client and don't even have the option to get (it doesn't work anyway...)

Added by Wojciech Kapcia TigaseTeam about 5 years ago

What do you mean by "don't even have the option to get (it doesn't work anyway...)"?

  • do you have any exceptions in the logs?

  • are the admin ad-hoc scripts loaded correctly (please check the logs), do you have groovy libraries?

Added by Keren Meir about 5 years ago

From the log:

Loading adhoc.groovy:

2013-10-30 15:34:09.725 [main]             java_util_logging_Logger$info.call()  INFO:  loading handler from file = C:\Users\...\...\Tigase_5.2.0-beta3\scripts\rest\adhoc\AdHoc.groovy
2013-10-30 15:34:09.872 [main]             java_util_logging_Logger$info.call()  INFO:  handler loaded

after open the http connection:

2013-10-30 15:34:26.593 [qtp23713876-78 - /rest/adhoc/sess-man@domain.com]  java_util_logging_Logger$warning.call()  WARNING: got calling with params = [tigase.http.rest.RestMessageReceiver@1ee7137, tigase.http.rest.RestSerlvet$_execute_closure4@a1b04e, admin@domain.com, sess-man, domain.com]
2013-10-30 15:34:26.648 [in_0-message-router]  MessageRouter.processPacket()  FINEST:   Processing packet: from=rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7, to=null, DATA=<iq from="admin@domain.com" to="sess-man@domain.com" type="get" id="1c53a49d-7ad9-4e13-8086-0c93973263dd"><query node="http://jabber.org/protocol/commands" xmlns="http://jabber.org/protocol/disco#items"/></iq>, SIZE=211, XMLNS=null, PRIORITY=NORMAL, PERMISSION=ADMIN, TYPE=get
2013-10-30 15:34:26.653 [in_0-message-router]  MessageRouter.getLocalComponent()  FINEST: Called for : sess-man@domain.com
2013-10-30 15:34:26.653 [in_0-message-router]  MessageRouter.getLocalComponent()  FINEST: None compId matches: sess-man@domain.com, for map: {rest@isr021732703.corp.myDomain.com=tigase.http.rest.RestMessageReceiver@1ee7137, s2s@isr021732703.corp.myDomain.com=tigase.server.xmppserver.S2SConnectionManager@b53eb8, vhost-man@isr021732703.corp.myDomain.com=tigase.vhosts.VHostManager@19d96dd, monitor@isr021732703.corp.myDomain.com=tigase.server.monitor.MonitorComponent@54ecc2, basic-conf@isr021732703.corp.myDomain.com=tigase.conf.Configurator@115da09, bosh@isr021732703.corp.myDomain.com=tigase.server.bosh.BoshConnectionManager@107a5ec, amp@isr021732703.corp.myDomain.com=tigase.server.amp.AmpComponent@b219e4, c2s@isr021732703.corp.myDomain.com=tigase.server.xmppclient.ClientConnectionManager@193836, stats@isr021732703.corp.myDomain.com=tigase.stats.StatisticsCollector@1ec4e4b, ws2s@isr021732703.corp.myDomain.com=tigase.server.websocket.WebSocketClientConnectionManager@adaaca, sess-man@isr021732703.corp.myDomain.com=tigase.server.xmppsession.SessionManager@7744d3}
2013-10-30 15:34:26.654 [in_0-message-router]  MessageRouter.processPacket()  FINEST:   1. Packet will be processed by: sess-man@isr021732703.corp.myDomain.com, from=rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7, to=null, DATA=<iq from="admin@domain.com" to="sess-man@domain.com" type="get" id="1c53a49d-7ad9-4e13-8086-0c93973263dd"><query node="http://jabber.org/protocol/commands" xmlns="http://jabber.org/protocol/disco#items"/></iq>, SIZE=211, XMLNS=null, PRIORITY=NORMAL, PERMISSION=ADMIN, TYPE=get
2013-10-30 15:34:26.654 [in_10-sess-man]   SessionManager.processPacket()     FINEST:   Received packet: from=rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7, to=null, DATA=<iq from="admin@domain.com" to="sess-man@domain.com" type="get" id="1c53a49d-7ad9-4e13-8086-0c93973263dd"><query node="http://jabber.org/protocol/commands" xmlns="http://jabber.org/protocol/disco#items"/></iq>, SIZE=211, XMLNS=null, PRIORITY=NORMAL, PERMISSION=ADMIN, TYPE=get
2013-10-30 15:34:26.654 [in_10-sess-man]   SessionManager.getXMPPResourceConnection()  FINEST: Searching for resource connection for: sess-man@domain.com
2013-10-30 15:34:26.654 [in_10-sess-man]   SessionManager.isBrokenPacket()    FINE:     Broken packet: from=rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7, to=null, DATA=<iq from="admin@domain.com" to="sess-man@domain.com" type="get" id="1c53a49d-7ad9-4e13-8086-0c93973263dd"><query node="http://jabber.org/protocol/commands" xmlns="http://jabber.org/protocol/disco#items"/></iq>, SIZE=211, XMLNS=null, PRIORITY=NORMAL, PERMISSION=ADMIN, TYPE=get
2013-10-30 15:34:26.655 [in_0-message-router]  MessageRouter.processPacket()  FINEST:   Processing packet: from=sess-man@domain.com, to=rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7, DATA=<iq from="sess-man@domain.com" to="admin@domain.com" type="error" id="1c53a49d-7ad9-4e13-8086-0c93973263dd"><query node="http://jabber.org/protocol/commands" xmlns="http://jabber.org/protocol/disco#items"/><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Service not available.</text></error></iq>, SIZE=412, XMLNS=null, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=error
2013-10-30 15:34:26.655 [in_0-message-router]  MessageRouter.getLocalComponent()  FINEST: Called for : rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7
2013-10-30 15:34:26.655 [in_0-message-router]  MessageRouter.getLocalComponent()  FINEST: None compId matches: rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7, for map: {rest@isr021732703.corp.myDomain.com=tigase.http.rest.RestMessageReceiver@1ee7137, s2s@isr021732703.corp.myDomain.com=tigase.server.xmppserver.S2SConnectionManager@b53eb8, vhost-man@isr021732703.corp.myDomain.com=tigase.vhosts.VHostManager@19d96dd, monitor@isr021732703.corp.myDomain.com=tigase.server.monitor.MonitorComponent@54ecc2, basic-conf@isr021732703.corp.myDomain.com=tigase.conf.Configurator@115da09, bosh@isr021732703.corp.myDomain.com=tigase.server.bosh.BoshConnectionManager@107a5ec, amp@isr021732703.corp.myDomain.com=tigase.server.amp.AmpComponent@b219e4, c2s@isr021732703.corp.myDomain.com=tigase.server.xmppclient.ClientConnectionManager@193836, stats@isr021732703.corp.myDomain.com=tigase.stats.StatisticsCollector@1ec4e4b, ws2s@isr021732703.corp.myDomain.com=tigase.server.websocket.WebSocketClientConnectionManager@adaaca, sess-man@isr021732703.corp.myDomain.com=tigase.server.xmppsession.SessionManager@7744d3}
2013-10-30 15:34:26.655 [in_0-message-router]  MessageRouter.processPacket()  FINEST:   1. Packet will be processed by: rest@isr021732703.corp.myDomain.com, from=sess-man@domain.com, to=rest@isr021732703.corp.myDomain.com/702d331f-e13f-4a07-b78e-fe8810300db7, DATA=<iq from="sess-man@domain.com" to="admin@domain.com" type="error" id="1c53a49d-7ad9-4e13-8086-0c93973263dd"><query node="http://jabber.org/protocol/commands" xmlns="http://jabber.org/protocol/disco#items"/><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Service not available.</text></error></iq>, SIZE=412, XMLNS=null, PRIORITY=NORMAL, PERMISSION=NONE, TYPE=error

Added by Wojciech Kapcia TigaseTeam about 5 years ago

  • could you share your @init.properties@?

  • have you disabled any plugins? does the service discovery works at all for you?

Added by Keren Meir about 5 years ago

Sure,

  • init.properties:
config-type=--gen-config-def
#basic-conf/virt-hosts-cert-*.myDomain.com=certs/myDomain.com.pem
--admins=admin@qa-dc.local
--virt-hosts = myDomain.com, a.myDomain.com

--inactive-time=1

--comp-name-3=rest
--comp-class-3=tigase.http.rest.RestMessageReceiver
--use-local-server=false
--rest-port=1234
--rest-ip=x.x.x.x (the real IP)

#--cluster-mode=true
#--cluster-connect-all=true

--tls-jdk-nss-bug-workaround-active = true
--user-db=mysql
--user-db-uri=jdbc:mysql://DBip:3306/tigasedb?user=user&password=password&useUnicode=true&characterEncoding=UTF-8&autoCreateUser=true

--auth-db=tigase-auth
--auth-db-uri=jdbc:mysql://DBip:3306/tigasedb?user=user&password=password&useUnicode=true&characterEncoding=UTF-8&autoCreateUser=true

--sm-plugins=+mobile_v1,+mobile_v2

#--debug = server

  • I didn't disable any plugin. And what is service discovery?

Thanks

Added by Wojciech Kapcia TigaseTeam about 5 years ago

Service Discovery is the mechanism that actually allows you to get information about xmpp entities (e.g. list of commands). Packet you are sending to the server should be processed by it but for no apparent reason (judging from your log excerpt) it's not.

OK, I've just notieced. In your configuration you have:

--virt-hosts = myDomain.com, a.myDomain.com

yet you are sending query to:

to="sess-man@domain.com"

Added by Keren Meir about 5 years ago

It is not my real domain, I changed it for writing here in the forum.... they are the same (in init.properties and in the query)

All these scripts are work good: "comp-repo-relaod", "comp-repo-item-add", "http://jabber.org/protocol/admin#add-user" (and maybe more, I just tried those)

Only the "main" query doesn't work (the one that retrieve a list of available services....

Added by Wojciech Kapcia TigaseTeam about 5 years ago

Ececution of those is a bit different than querying Service Discovery. Have you made any changes to Tigase sources? Can you please provide log output from logs/tigase-console.log?

    (1-20/20)