Dojo Library loading error in Worklight project wh

2019-06-13 22:32发布

问题:

I have developed a Worklight project which uses Dojo Library.After deploying project it worked fine in my local machine ,but when i tried to run the application from another PC on the same network the dojo Library host is still pointing to localhost rather than my IP Address.

How to change Dojo library host pointing to my IP Address in Worklight 6 Application.

Library path in "Page Source View" from other Machine Browser

(function(){
    var modules = { dojo: {name: "dojo", location: "http://localhost:53281/dojoLib/xxx/xxx/common/dojo"}, dijit: {name: "dijit", location: "http://localhost:53281/dojoLib/xxx/xxx/common/dijit"}, dojox: {name: "dojox", location: "http://localhost:53281/dojoLib/xxx/xxx/common/dojox"}};

Any help is appretiated.

回答1:

I figured out the problem.

In the first release of Worklight Studio V6.0, there was a problem where the hostname for the dojo library server was getting set to localhost. This caused apps that needed dojo files from the Library to fail if they that weren't running on the same host as Worklight Studio. (even apps running in emulators on the same host could run into problems) However, the latest build of Worklight Studio now selects an IP address for the dojo library server in much the same way that the IP address for the Worklight server was auto-selected in V5.



回答2:

In a standard Dojo project, the idea is that prior to deploy, the Dojo resources get added to the www folder in your Worklight project, and that needs to be done manually, so they are not accessed through Internet at all, but locally.

I recommend you see this response, that should give you an idea what I'm talking about: https://stackoverflow.com/a/18235341/2521698