REST API installation on Windows
|
|
---|---|
Hello tangoer. I want to use tango REST API to access device (WEB and REST are new to me). My environment: Windows10, libtango_9.3.4_v141_x64, Java11(11.0.12), rest-server-2.2(download from https://github.com/hereon-wpi/rest-server), waltz-1.0.10, TANGO_HOST=localhost:10000 Based on https://github.com/tango-controls/rest-server/wiki and https://waltz-docs.readthedocs.io/en/latest/installation_guide/ (some information is outdated?), i test rest-server-2.2 on windows 10 as: 1. copy tango.war (rest-server-2.2) into %CATALINA_HOME%\webapps directory 2. start tomcat: startup.bat Firstly i test with tomcat-10.0.10, tango.war can't start! then test with tomcat-9.0.52, tango.war start successfully, but after access http://localhost:8080/tango/rest/v11/hosts/localhost/devices, http://localhost:8080/tango/rest/v11/hosts/localhost;port=10000/devices/sys/tg_test/1/attributes, etc. when exit tomcat there is a memory leak error, last i test with tomcat-8.5.69, the result is same with tomcat-9.0.52. 1. Whether i missed some configuration? 2. TangoDatabase's create_db.sql script file created a device named sys/rest/0 (TangoRestServer/rest) in tango database, when use rest-server-2.2, if we need to configure this device's property (as for rest-server-1.x.jar)? or if we need to config and start rest-server-1.x.jar? Lastly, i copy waltz.war(1.0.10) into %CATALINA_HOME%\webapps/ directory, start tomcat9, waltz start successfully, Open browser and go to http://localhost:8080/waltz, but it waiting response forever, nothing displayed in browser. |
|
|
---|---|
Hi Jimmy, Thank for giving a try to rest-server and waltz! Based on https://github.com/tango-controls/rest-server/wiki and https://waltz-docs.readthedocs.io/en/latest/installation_guide/ (some information is outdated?), Yeah, the documentation is a bit outdated. if you can contribute an update that would be awesome! There is also a tutorial in the Tango docs related to your topic - here Firstly i test with tomcat-10.0.10, tango.war can't start! then test with tomcat-9.0.52, tango.war start successfully, but after access http://localhost:8080/tango/rest/v11/hosts/localhost/devices, http://localhost:8080/tango/rest/v11/hosts/localhost;port=10000/devices/sys/tg_test/1/attributes, etc. when exit tomcat there is a memory leak error, last i test with tomcat-8.5.69, the result is same with tomcat-9.0.52. Do you get any meaningful response in this case e.g. list of attributes? If so then the rest is ok. 1. Whether i missed some configuration? The only thing I can think of - setting up tomcat users and roles as described here 2. TangoDatabase's create_db.sql script file created a device named sys/rest/0 (TangoRestServer/rest) in tango database, when use rest-server-2.2, if we need to configure this device's property (as for rest-server-1.x.jar)? or if we need to config and start rest-server-1.x.jar? TangoRestServer tango server is deprecated since 2.0. Since then it is only a web application and does not require any Tango environment. So just ignore it. Lastly, i copy waltz.war(1.0.10) into %CATALINA_HOME%\webapps/ directory, start tomcat9, waltz start successfully, Open browser and go to http://localhost:8080/waltz, but it waiting response forever, nothing displayed in browser. That probably means something is wrong on the tomcat side. If you do not get any response most probably due to the tomcat does not accept any requests. Do you deploy both apps into a single tomcat instance? Are there any errors in the logs? Hope this helps. Cheers, |
|
|
---|---|
Hi Ingvord, thanks I had attached a tomcat's log file on my first post, as for debug i provide some one information as follow:
http://localhost:8080/tango/rest/v11/hosts/localhost/devices/sys/tg_test/1/attributes/double_scalar/value not return any data, at same time tomcat cosole output:
stop and restart tomcat, then:
The output is every strange, same repeated command's return data element may different!!! tomcat cosole output the same WARN message as above! I have another question: is tango.war or waltz.war must configure a TangoAccessControl device for it? I'll check my tomcat configuration to find the problem! thanks for your help. |
|
|
---|---|
Hi. I had successfully deloyed tango REST API and waltz, it's great, thanks to developer(s). After browse the waltz source code, i find that my first failure of access waltz is that my computer not connect to internet! Only one remaining problems:curl -u "tango-cs:tango" http://localhost:8080/tango/rest/v11/hosts/localhost/devices/sys/tg_test/1/attributes/double_scalar/value will cause the rest server throw an exception! |
|
|
---|---|
Hi Jimmy, I would recommend to deliberately pass required response type using request headers, e.g.
Please find out more here: link |