Project

General

Profile

Unable using REST API

Cyrille Voluter
Added over 3 years ago

Hello,

I have problems with using and setting up TIGASE HTTP REST API .

When I try to use send request with url like this :

http://myserver:8080/rest/user/admin@mydomain (with admin credential on basic authentication, with or without content-type header json or Xml)

I obtain only http error 500 (internal server fault)

In my server logs, I have:

java_util_logging_Logger$log.call()  SEVERE: exception processing request
java.lang.SecurityException: class "javax.servlet.http.HttpUpgradeHandler"'s signer information does not match signer information of other classes in the same package
 at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)
[sess-man tasks]   ThreadExceptionHandler.uncaughtException()  SEVERE: Uncaught thread: "sess-man tasks" exception
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
       at tigase.server.xmppsession.SessionManager.everyMinute(SessionManager.java:2211)
        at tigase.server.AbstractMessageReceiver$3.run(AbstractMessageReceiver.java:1247)
        at java.util.TimerThread.mainLoop(Timer.java:555)

Here my configuration (init.properties) file :

--comp-class-1 = tigase.muc.cluster.MUCComponentClustered
--virt-hosts = tigasebridge.cloudapp.net, newco.com, activation.newco.com
--user-db-uri = jdbc:mysql://localhost/tigasedb?user=tigase&password=Xmpp2015%21
--user-db = mysql
--admins = admin@tigasebridge.cloudapp.net, admin@newco.com
--comp-name-6 = message-archive
--comp-name-5 = http
--comp-name-4 = stun
--comp-name-3 = proxy
config-type = --gen-config-all
--comp-name-2 = pubsub
--comp-name-1 = muc
--cluster-mode = false
--sm-plugins = +message-archive-xep-0136,-jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp-sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+prese$
--comp-class-6 = tigase.archive.MessageArchiveComponent
--debug = server,xmpp.impl,db,cluster
--comp-class-5 = tigase.http.HttpMessageReceiver
--comp-class-4 = tigase.stun.StunComponent
--comp-class-3 = tigase.socks5.Socks5ProxyComponent
--comp-class-2 = tigase.pubsub.cluster.PubSubComponentClustered
stun/stun-primary-ip=10.0.0.1
stun/stun-primary-port[I]=3478
stun/stun-secondary-ip=10.0.0.2
stun/stun-secondary-port[I]=7001

.jar-files are in ./home/user/jars

.html and .groovy-files are deployed into sub folders on ./home/user/scripts/rest

I used wizard installation on console mode, but does other file must be intalled ?

My configuration is :

Version : Tigase community ediion 7.0.2-b3821
Server : Linux UBUNTU 15.05 LTS on Azure VM over SSH
SGBD : MySQL 5.1 community edition in same server VM
Java and JDK version : java version "1.7.0_79", OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-0ubuntu1), OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode).

Thank you for helping to resolve those problems.


Replies (5)

Added by Wojciech Kapcia TigaseTeam over 3 years ago

Cyrille Voluter wrote:

There are two issues actually:

java_util_logging_Logger$log.call() SEVERE: exception processing request

java.lang.SecurityException: class "javax.servlet.http.HttpUpgradeHandler"'s signer information does not match signer information of other classes in the same package

at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)

Please make sure you have exact set of jars provided in Tigase package without any duplicates.

[sess-man tasks] ThreadExceptionHandler.uncaughtException() SEVERE: Uncaught thread: "sess-man tasks" exception

java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;

at tigase.server.xmppsession.SessionManager.everyMinute(SessionManager.java:2211)

at tigase.server.AbstractMessageReceiver$3.run(AbstractMessageReceiver.java:1247)

at java.util.TimerThread.mainLoop(Timer.java:555)

This is a result of using Tigase package build with JDK8 under previous version of Java and can be ignored.

Added by Cyrille Voluter over 3 years ago

Wojciech Kapcia wrote:

Cyrille Voluter wrote:

There are two issues actually:

java_util_logging_Logger$log.call() SEVERE: exception processing request

java.lang.SecurityException: class "javax.servlet.http.HttpUpgradeHandler"'s signer information does not match signer information of other classes in the same package

at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)

Please make sure you have exact set of jars provided in Tigase package without any duplicates.

Here my jars folder content :

drwxrwxr-x  2 myuser myuser    4096 Jul  7 15:09 ./
drwxr-xr-x 38 myuser myuser    4096 Jul 15 10:23 ../
-rwxrw-r--  1 myuser myuser 2703892 May 14 20:55 derby.jar*
-rwxrw-r--  1 myuser myuser  174932 May 14 20:55 derbytools.jar*
-rwxrw-r--  1 myuser myuser 6317783 May 14 20:55 groovy-all.jar*
-rwxrw-r--  1 myuser myuser   45024 May 15 00:44 hamcrest-core.jar*
-rwxr--r--  1    501 staff   200387 May  6  2013 javax.servlet.jar*
-rwxr--r--  1    501 staff    21146 May  6  2013 jetty-continuation.jar*
-rwxr--r--  1    501 staff    60749 Jul 15  2013 jetty-deploy.jar*
-rwxr--r--  1    501 staff    95691 May  6  2013 jetty-http.jar*
-rwxr--r--  1    501 staff   103285 May  6  2013 jetty-io.jar*
-rwxr--r--  1    501 staff    89693 May  6  2013 jetty-security.jar*
-rwxr--r--  1    501 staff   347872 May  6  2013 jetty-server.jar*
-rwxr--r--  1    501 staff    98935 May  6  2013 jetty-servlet.jar*
-rwxr--r--  1    501 staff   284472 May  6  2013 jetty-util.jar*
-rwxr--r--  1    501 staff   110161 Jul 15  2013 jetty-webapp.jar*
-rwxr--r--  1    501 staff    38982 Jul 15  2013 jetty-xml.jar*
-rwxrw-r--  1 myuser myuser   68274 May 15 00:44 jstun.jar*
-rwxrw-r--  1 myuser myuser  301946 May 15 00:44 jtds.jar*
-rwxrw-r--  1 myuser myuser   22922 May 15 00:44 licence-lib.jar*
-rwxrw-r--  1 myuser myuser  703265 May 14 20:55 mysql-connector-java.jar*
-rwxrw-r--  1 myuser myuser  551290 May 14 20:55 postgresql.jar*
-rwxrw-r--  1 myuser myuser   95806 Jul  6 18:00 servlet-api-3.1.jar*
-rwxrw-r--  1 myuser myuser   56815 May 15 00:44 tigase-acs.jar*
-rwxrw-r--  1 myuser myuser   67322 May 15 00:44 tigase-acs-muc.jar*
-rwxrw-r--  1 myuser myuser   33408 May 15 00:44 tigase-acs-pubsub.jar*
-rwxrw-r--  1 myuser myuser   49592 Jul  7 15:09 tigase-extras-1.0.0.jar*
-rwxrw-r--  1 myuser myuser   43441 May 15 00:44 tigase-extras.jar*
-rwxrw-r--  1 myuser myuser  209250 May 15 00:44 tigase-http-api.jar*
-rwxrw-r--  1 myuser myuser 1347880 Jul  6 18:11 tigase-http-api-libraries.tar.gz*
-rwxrw-r--  1 myuser myuser   55141 May 15 00:44 tigase-message-archiving.jar*
-rwxrw-r--  1 myuser myuser  157257 May 15 00:44 tigase-muc.jar*
-rwxrw-r--  1 myuser myuser  274716 May 15 00:44 tigase-pubsub-2.2.0.jar.old*
-rwxrw-r--  1 myuser myuser  354973 May 15 00:44 tigase-pubsub.jar*
-rwxrw-r--  1 myuser myuser 1990114 May 15 00:44 tigase-server.jar*
-rwxrw-r--  1 myuser myuser   60275 May 15 00:44 tigase-socks5.jar*
-rwxrw-r--  1 myuser myuser    8656 May 15 00:44 tigase-stats-collector-library.jar*
-rwxrw-r--  1 myuser myuser    7689 May 15 00:44 tigase-stats-collector-provider.jar*
-rwxrw-r--  1 myuser myuser   12484 May 15 00:44 tigase-stun.jar*
-rwxrw-r--  1 myuser myuser 6998410 May 15 00:44 tigase-web-ui.war*

Added by Cyrille Voluter over 3 years ago

Hello,

You are finally all right, i have left necessary jars for old 1.0.0.0 rest api and change open jdk 7 for oracle jdk 8 and all working fine (just add http/api-key[s]=open_access for enabling access).

Tanks for help,

Added by Abhinav Gupta about 3 years ago

Hi I am also facing the same issue while calling the rest api, i am also getting the 500 internal server error.

Attaching the logs and init files.

Please help me

In my logs,

I am facing this error,

2015-11-17 18:02:08.207 [main] java_util_logging_Logger$log.call() SEVERE: Exception loading handler from script = /home/vostro/tigase/scripts/rest/pubsub/PublishItem.groovy

org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'tigase.admin.PublishItem@b25b095' with class 'tigase.admin.PublishItem' to class 'tigase.http.rest.Handler'

at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:360)

at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)

at tigase.http.rest.HandlersLoader.loadHandler(HandlersLoader.groovy:42)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)

at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:361)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)

at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)

at tigase.http.rest.HandlersLoader$_loadHandlers_closure1.doCall(HandlersLoader.groovy:54)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)

at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909)

at groovy.lang.Closure.call(Closure.java:411)

at groovy.lang.Closure.call(Closure.java:427)

at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1326)

at org.codehaus.groovy.runtime.DefaultGroovyMethods.each(DefaultGroovyMethods.java:1298)

at org.codehaus.groovy.runtime.dgm$148.invoke(Unknown Source)

at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoMetaMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:271)

at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)

at tigase.http.rest.HandlersLoader.loadHandlers(HandlersLoader.groovy:51)

at tigase.http.rest.HandlersLoader$loadHandlers.call(Unknown Source)

at tigase.http.rest.RestServlet.loadHandlers(RestServlet.groovy:65)

at tigase.http.rest.RestExtServlet.super$4$loadHandlers(RestExtServlet.groovy)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:497)

at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)

at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)

at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085)

at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:128)

at tigase.http.rest.RestExtServlet.loadHandlers(RestExtServlet.groovy:43)

at tigase.http.rest.RestExtServlet$loadHandlers.callCurrent(Unknown Source)

at tigase.http.rest.RestServlet.init(RestServlet.groovy:60)

at javax.servlet.GenericServlet.init(GenericServlet.java:244)

at tigase.http.java.RequestHandler.registerServlet(RequestHandler.java:94)

at tigase.http.java.RequestHandler.<init>(RequestHandler.java:59)

at tigase.http.java.JavaStandaloneHttpServer.deploy(JavaStandaloneHttpServer.java:98)

at tigase.http.java.JavaStandaloneHttpServer.deploy(JavaStandaloneHttpServer.java:77)

at tigase.http.HttpServer.deploy(HttpServer.java:99)

at tigase.http.rest.RestModule.start(RestModule.java:112)

at tigase.http.HttpMessageReceiver.setProperties(HttpMessageReceiver.java:237)

at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:540)

at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:177)

at tigase.conf.Configurator.componentAdded(Configurator.java:50)

at tigase.conf.Configurator.componentAdded(Configurator.java:33)

at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java:116)

at tigase.server.MessageRouter.addComponent(MessageRouter.java:108)

at tigase.server.MessageRouter.addRouter(MessageRouter.java:145)

at tigase.server.MessageRouter.setProperties(MessageRouter.java:704)

at tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:540)

at tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:177)

at tigase.conf.Configurator.componentAdded(Configurator.java:50)

at tigase.conf.Configurator.componentAdded(Configurator.java:33)

at tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java:116)

at tigase.server.MessageRouter.addRegistrator(MessageRouter.java:131)

at tigase.server.MessageRouter.setConfig(MessageRouter.java:603)

at tigase.server.XMPPServer.start(XMPPServer.java:142)

at tigase.server.XMPPServer.main(XMPPServer.java:112)

Any advice and suggestions will be highly appreciated.

Thanks and Regards,

Abhinav

Added by Wojciech Kapcia TigaseTeam about 3 years ago

Please make sure you are using correct versions. Ideally you should use complete distribution package.

    (1-5/5)