0

I have uploaded WSO2 IoTS 3.1.0 to my remote virtual machine with static IP address.

I have unzipped zip file then run sudo ./change-ip.sh

In first step I have entered localhost

In second step I have entered my_own_ip_address

Then my hostname is my_own_ip_address

When I launch IoT Server and open device management then I login where it shows me this page:

Error page

When I try to open any other page and even try to logout it redirects me to this page.

My logs shows this:

TID[-1234] [IoT] [2017-09-09 08:32:30,079] ERROR {auth-module} - 
org.wso2.carbon.apimgt.integration.client.exception.APIMClientOAuthException: failed to retrieve oauth token using jwt 

org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1754) 
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:148) 
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225) 
org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:85) 

It shows that there is an error in jaggery JS.

What did I miss?

Community
  • 1
  • 1
Mr.D
  • 7,353
  • 13
  • 60
  • 119

1 Answers1

1

One reason for the issue could be that you are having a DNS entry against that IP in /etc/hosts file. Please make sure that your /etc/hosts file does not contain any DNS entry pointing your IP to a hostname. When WSO2 IoT Server tries to resolve DNS to call the endpoints, the first thing it looks at is your local DNS setting. If your IP is pointing to a hostname, it takes that host name as the server hostname. And when IoT server tries to verify the common name of the SSL certificate, it gets conflicting information. This leads to hostname verification fail issue. And that could result in JWT token failure as it cannot access the endpoints.

Similar issue was discussed here

  • Hi, I am getting the same issue, as mentioned in the link in the above comment. And the guy who solved it mentioned that my he mapped his ip to localhost but you are saying that IP should not be mapped to localhost. – omer khalid Oct 11 '17 at 15:43
  • Can you please clarify? – omer khalid Oct 11 '17 at 15:43
  • Yes, Because when you have IP mapped to localhost, and you have run the change-ip.sh scripts, the server is configured with the IP. When the server tries to resolve the IP and finds out, that there is a matching hostname for that. And IoT server has backend APIs which are exposed. So when a http client tries to call the backend and tries to verify the common name of the SSL certificate, it is given both IP and the hostname. This error happens when trying to call APIs. – Geeth Munasinghe Oct 11 '17 at 15:47
  • Thanks a lot for your answer. But how should I solve it , I tried mapping my local IP to the localhost but it still won't work. Any suggestions you can provide? – omer khalid Oct 12 '17 at 16:27
  • I have run the change-ip.sh scripts and now I have tried both ways by mapping my IP to localhost and by removing the mapping as well. it is still not working. – omer khalid Oct 12 '17 at 16:28
  • Can you please follow these steps to enable debug logs? Go to the IOT_HOME/conf/log4j.properties file. Uncomment the following #log4j.logger.org.apache.synapse.transport.http.wire=DEBUG #log4j.logger.feign=DEBUG Comment the following log4j.category.org.apache.synapse=WARN Then restart the IoT server and try to login to the devicemgt application. And check the log file in IoT_Home/repository/logs/wso2carbon.log and attach the error. – Geeth Munasinghe Oct 12 '17 at 16:52
  • Hi , this is the error that is in my log file:TID: [-1] [] [2017-10-12 21:49:13,899] ERROR {org.apache.synapse.transport.passthru.TargetHandler} - I/O error: Host name verification failed for host : vm-0e2d9174-fb03-4fc4-8e55-ba675b7a795f.public.cloudvps.com {org.apache.synapse.transport.passthru.TargetHandler} javax.net.ssl.SSLException: Host name verification failed for host : vm-0e2d9174-fb03-4fc4-8e55-ba675b7a795f.public.cloudvps.comat org.apache.synapse.transport.http.conn.ClientSSLSetupHandler.verify(ClientSSLSetupHandler.java:171)at org.apache.http.nio.reactor.ssl.SSLIOSession.doH – omer khalid Oct 12 '17 at 19:52
  • And this is my /etc/hosts file:127.0.0.1 cvpslnx04 #127.0.0.1 localhost #127.0.1.1 ubuntu.cloudvps ubuntu # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters – omer khalid Oct 12 '17 at 19:57
  • Add this to /etc/hosts file. ----- 127.0.0.1 vm-0e2d9174-fb03-4fc4-8e55-ba675b7a795f.public.cloudvps.com ----- It is because your machine name cannot be resolved. This should fix your issue. – Geeth Munasinghe Oct 13 '17 at 04:45
  • Hi, thanks a lot the solution worked. I was able to open it and enroll my android device with it. But devicemgmt portal is not showing the other features of the device like memory , battery , location and other stuff. All ports are open and there are no errors in carbon log as well, do u have any idea or tip what might be off? – omer khalid Oct 13 '17 at 21:10
  • It might take a few minutes to retrieve those pieces of information from the device. As default communication mechanism of Android devices with the WSO2 IoT server is polling at one minute. – Geeth Munasinghe Oct 14 '17 at 02:04
  • org.mozilla.javascript.EcmaError: SyntaxError: Unexpected token: i (/devicemgt/lib/utils.js#386) {org.jaggeryjs.jaggery.core.manager.WebAppManager} org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: SyntaxError: Unexpected token: i (/devicemgt/lib/utils.js#386) at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571) – NovusMobile Sep 05 '19 at 14:01