Ice getting started

Source: Internet
Author: User
Install ice source code(1) Ice dependent Software Package

(1) GCC 3.3 or above.

(2) more than 4.8 of Berkeley DB

(3) expat 2.0.1

(4) Bzip2 1.0.x

(5) mCPP 2.7.2

 

(2) install the dependency package

(1) install and compile the required software package with APT-Get install bulid-essential

(2) install ice the required dependency package apt-Get install libdb4.6 ++-dev libbz2-dev Bzip2 libssl-dev libreadline5-dev libexpat1-dev mcppi

(3) Add the link ln-S/usr/lib/libmcpp. so.0.2.0/usr/lib/libmcpp. so. Otherwise, the following error will occur: cannot find-lmcpp

 

(3) Go to the CPP directory under ice, run make and make install. The compilation is complete. (4) add Environment Variables

Ice is installed under/opt/by default, such as/opt/ice3.4.1/

In~/Add environment variables and class libraries in. bashrc.

Export ice_home =/opt/ice-1, 3.4.1

Export Path = $ ice_home/bin: $ path

Export LD_LIBRARY_PATH = $ ice_home/lib: $ LD_LIBRARY_PATH

The following command is added:

Slice2cpp slice2freeze slice2html slice2php slice2rb

Slice2cs slice2freezej slice2java slice2py

= The preceding steps are taken from the network. The actual installation may encounter some problems due to different environments. The specific problem is solved =

 

Practice Basic practice steps

1. Compile the ICE file and name related interfaces in it.
2. slice2java compiles the ICE file and automatically generates the Ice-related Java source code.
3. Develop the business class and inherit the _ xxxdisp class to implement the service code of the server.
4. Develop the server-side communication code. The server-side Communication Code does not have business logic, but you can instantiate the server-side business class and put it in the Object Adapter (objectadapter) to provide business services.
5. Write the server configuration file, configure the network port corresponding to the adapter, and other information.
6. Compile the client configuration file, which is mainly used to configure a proxy parameter pointing to the network service provided by the server, including the network protocol, address, port, etc.
5. Develop the client code and read the proxy parameters to communicate with the server.

Icegrid deployment

1. Prepare two machines, A and B, and install ice3.4.1 respectively.

2. In
A. Execute the Ice-3.4.1/Java/demo/icegrid/simple example and configure the config. register file so that ice. Default. locator points to the local port.
B. Run icegridregistry -- ice. Config = config. Register. To run the node, the service must be started.
C. Run icegridadmin -- ice. Config = config. Grid-e \ "application add application_with_replication.xml" to generate application_with_replication.xml into an application.
D. Generate the config. node1 file and run icegridnode -- ice. Config = config. node1 to start the service.


3. In B
A. Generate the config. node2 file. Ice. Default. locator needs to be connected to a (otherwise the service cannot be started)
B. Run icegridnode -- ice. Config = config. node2 to start the service.
C. The class to be called by node2 has been defined in application_with_replication.xml.


4. Start the client on a and point ice. Default. locator to.

Files involved in simple client server programs

1. XX. ICE file, define interface, and execute slice2java XX. Ice to automatically generate corresponding java files and compile these java files
2. Develop a Java program and inherit _ xxdisp, which is used to execute specific services.
3. Develop a Java server program that inherits ice. application, which does not involve specific services
4. Develop a Java client program and inherit from ice. application. The program calls the method in _ xxdisp through the service.
5. You need to adjust application_with_replication.xml to register the application to icegrid.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.