This forum has been archived. Please start a new discussion on GitHub.

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

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


  • xdm
    xdm La Coruña, Spain

    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

    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.
  • "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

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

    Where did I go wrong?
  • xdm
    xdm La Coruña, Spain

    I have the impression that Ice.js library was not loaded, With your configuration Ice.js should be available at
  • Have Icestorm Demo for Ice javascript

    Thanks xdm!
    It's my wrong.
    In addition, there is Icestorm demo for Ice javascript?
  • xdm
    xdm La Coruña, Spain
    Currently we don't have an IceStorm demo for Ice for JavaScript
  • 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

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

    Clues welcome.

  • xdm
    xdm La Coruña, Spain

    Hi Philip,

    This instructions are for and old version, you better follow 3.7 instructions in, 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

  • 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?

  • Success, thanks for the help!

  • xdm
    xdm La Coruña, Spain

    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.