Home Help Center

How to run IceJS-0.1.0-demos in Tomcat or Apache?

abchjbabchjb Member jianbin huOrganization: pinan securities Co, LtdProject: use Ice as middleware and publish quote
Hi, How to run IceJS-0.1.0-demos in Tomcat or Apache?

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    First you need to build the demos, as documented here Sample Programs - Ice for JavaScript 0.1 - ZeroC

    After you have build the demos you need to edit the endpoints to match your deployment.

    For the hello demo client endpoints are defined in demojs/Ice/hello/browser/Client.js in this file change the line
    var proxy = communicator.stringToProxy("hello" + 
                                           ":ws -h " + hostname + " -p 8080 -r /demows" + 
                                           ":wss -h " + hostname + " -p 9090 -r /demowss");
    

    By this new configuration
    var proxy = communicator.stringToProxy("hello" + 
                                           ":ws -h " + hostname + " -p 10002" + 
                                           ":wss -h " + hostname + " -p 10003");
    

    Now copy the demos to your Apache document root or a web server directory of your choice.
    cd /var/www
    cp -rf ~/IceJS-0.1.0-demos js 
    

    You also need to copy the Ice for JavaScript libraries to the same directory in your webserver
    cd /var/www
    mkdir lib
    cp /opt/IceJS-0.1.0/lib/*.js lib/ 
    

    Now open a web browser and point it to the demo page http://127.0.0.1/js/index.html

    For WSS (secure endpoints) to work , you need to access the demos using HTTPS and configure the web browsers to trust the demos certificate.

    Similar changes to client endpoints are required for other demos, that is because the NodeJS web server provided in the demo distribution uses a reverse proxy, clients are configured to connect to the reverse proxy and not to the Ice server, so that web sockets and HTPP connections can share the port configurations and simplify SSL deployment.
  • abchjbabchjb Member jianbin huOrganization: pinan securities Co, LtdProject: use Ice as middleware and publish quote
    "Slice" undefined

    hi, thanks for your reply!
    According to your instruction, I deploy demos in Tomcat 7.0.56, and open it in IE 11
    http://127.0.0.1:8080/js/demojs/Ice/hello/index.html

    but no "Hello world" in server.exe, debug in IE F12, in Hello.js show
    "Slice" undefined

    Where did I go wrong?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    I have the impression that Ice.js library was not loaded, With your configuration Ice.js should be available at http://127.0.0.1:8080/js/lib/Ice.js
  • abchjbabchjb Member jianbin huOrganization: pinan securities Co, LtdProject: use Ice as middleware and publish quote
    Have Icestorm Demo for Ice javascript

    Thanks xdm!
    It's my wrong.
    In addition, there is Icestorm demo for Ice javascript?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Currently we don't have an IceStorm demo for Ice for JavaScript
  • pjtait2pjtait2 Member Philip TaitOrganization: Subaru TelescopeProject: Control of astronomical instrument

    I followed all the above directions. I found I had to mv the assets directory tree up one level to document root to eliminate most of the errors. I'm left with this:

    Loading failed for the with source “http://localhost/js/{{.}}”. index.html:114:1
    ReferenceError: $ is not defined
    common.js:8:1

    The error is on this line of js/index.html

    Clues welcome.

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff

    Hi Philip,

    This instructions are for and old version, you better follow 3.7 instructions in https://github.com/zeroc-ice/ice-demos/tree/3.7/js, the HTML files use a JavaScript template that is not being expand in this case. You should run them with the included JavaScript server as mentioned in the 3.7 demos README

  • pjtait2pjtait2 Member Philip TaitOrganization: Subaru TelescopeProject: Control of astronomical instrument

    Just to clarify: The current version of the demos cannot be run with an Apache server, correct? But it is still possible to write a browser-based IceJS client to work with Apache, without requiring Node.js?

  • pjtait2pjtait2 Member Philip TaitOrganization: Subaru TelescopeProject: Control of astronomical instrument

    Success, thanks for the help!

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff

    Yes current demos cannot run on Apache because we use a JavaScript template system for the HTML, but you can use Ice for JavaScript with any web server.

    Glad you get things to work.

Sign In or Register to comment.