JacORB的简单配置

Jacorb配置:
1. Download  JacORB-2.3.0-bin.zip
2. 解压到磁盘   例如:c:/JacORB
3. 在c:/JacORB下新建个文件夹classes
4. 为了在调试时可以找到有关包,需要在系统环境变量中设置
JACORB_HOME=C:/JacORB
path=%JACORB_HOME%/bin
classpath=.;%JACORB_HOME%/lib/idl.jar;%JACORB_HOME%/lib/jacorb.jar;%JACORB_HOME%/lib/logkit-1.2.jar;%JACORB_HOME%/lib/avalon-framework-4.1.5.jar;%JACORB_HOME%/classes
5. 把c:/JacORB/etc中的jacorb_properties.template复制到c:/JacORB/classes下,并更名为jacorb.properties 。
6. 编辑jacorb.properties文件,设置ORBInitRef.NameService=file:/c:/NS_Ref
7.
在dos窗口下 输入 ns  出现下面的输出 说明正常启动
C:/Documents and Settings/WB01>ns
[jacorb.orb.print_ver] INFO :
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        JacORB V 2.3.0, www.jacorb.org
        (C) The JacORB project 17-Feb-2007
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[jacorb.orb] INFO : Property "jacorb.hashtable_class" is set to: java.util.Hasht
able
[org.jacorb.orb.codes] WARN : Warning - unknown codeset (GB18030) - defaulting t
o ISO-8859-1
[jacorb.orb.intercept] INFO : InterceptorManager started with 0 Server Intercept
ors, 0 Client Interceptors and 1 IOR Interceptors
[jacorb.orb.singleton] INFO : created ORBSingleton
[jacorb.naming] INFO : NS up
[jacorb.orb] INFO : ORB run


配置ant的环境 
1. 下载apache-ant-1.7.0-bin.tar
2. 解压到磁盘 例如:C:/Downloads/apache-ant-1.7.0
3. 设置环境变量: ANT_HOME=C:/Downloads/apache-ant-1.7.0 
path=%ANT_HOME%/bin


demo运行:
1. 在dos窗口下 进入到c:/JacORB/demo/grid目录下执行 ant
2. c:/JacORB/demo/grid >    ant    
   这样会进行idl编译server.idl文件,在 c:/JacORB/demo/grid/generated下生成corba所需的源文件  ,同时,ant会编译所有的java源文件,E:/JacORB/classes下面生成 .class文件
3. 启动 grid server :在dos窗口中执行(需在c:/JacORB目录下)
Jaco  demo.grid.Server
C:/JacORB/demo/grid>jaco demo.grid.Server
[jacorb.orb.print_ver] INFO :
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        JacORB V 2.3.0, www.jacorb.org
        (C) The JacORB project 17-Feb-2007
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[jacorb.orb] INFO : Property "jacorb.hashtable_class" is set to: java.util.Hasht
able
[org.jacorb.orb.codes] WARN : Warning - unknown codeset (GB18030) - defaulting t
o ISO-8859-1
[jacorb.orb.intercept] INFO : InterceptorManager started with 0 Server Intercept
ors, 0 Client Interceptors and 1 IOR Interceptors
[jacorb.poa] INFO : oid:
00 15 0A 0E 3F 43 3C 10 04 32                               ....?C<..2
object is activated

这时在ns输出窗口可以看到:
     [jacorb.naming] INFO : Bound name: grid.example

4. 启动grid client :
Jaco demo.grid.Client
输出结果:
    Height =  31
        Width = 14
        Old value at (30,13): 0.21
        Setting (30,13) to 470.11
        New value at (30,13): 470.11
        MyException, reason: This is only a test exception, no harm done :-)

看到这个结果说明已经成功运行了grid例子.



acORB工具使用介绍:

Idl –d 编译后目录 idl文件

编译idl文件。

Ns ior文件位置

启动name service服务

lsns

文本方式列出当前服务中的name serviec列表

nmg

图形方式工作的name service列表,还可以新建Context(没有太明白这个概念)

dior –f ior文件位置

ior文件解码器,将ior文件翻译成用户可读格式。

Pingo –f ior文件位置

测试联结ior对象

5. 运行demo.grid例子程序:

例子程序源码在demo目录下,我们运行grid程序,它用来在一个表格中添加几个数字,再返回表格内容。

如果有ant的话,会很方便,在命令行方式下进入e:/JacORB/demo/grid目录下,敲入ant,编译好的class文件将放在classes/demo/grid目录下。如果不用ant,那你可以一个一个编译,或者在ide中编译。在命令行方式进入classes目录,敲入start jaco demo.grid.Server,将启动 服务Server。

敲入start jaco demo.grid.Client,启动client,我们就能看到运行结果了。相应的Server和ns显示联结信息。

你可能感兴趣的:(exception,server,ant,dos,service,Class)