安装前需要注意,JAVA_HOME配置的路径不能含有空格(例如/Program Files/),另外Ant可以正常使用
1. 从svn上下载JacORB-2.3.0-bin.zip(不包含源码)或者JacORB-2.3.0-src.zip(包含源码)
2. 解压的任意目录下,如E:/JacORB
3. 在E:/JacORB下新建一个目录classes
4. 添加如下的系统环境变量
1) JACORB_HOME=E:/JacORB
2) Path环境变量添加%JACORB_HOME%/bin
3) 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. % JACORB_HOME%下的etc目录有一个文件jacorb_properties.template,将此文件copy到步骤3所新建的classes目录下,并修改文件为jacorb.properties
6. 编辑jacorb.properties文件,将其中的ORBInitRef.NameService对应的键值更改为file:/c:/NS_Ref,如下:
ORBInitRef.NameService=file:/c:/NS_Ref
7. % JACORB_HOME%下的etc目录有一个文件orb.properties,修改其中的jacorb.config.dir对应的键值为e:/JacORB,如下:
jacorb.config.dir=e:/JacORB
8.% JACORB_HOME%下的etc目录有一个文件commom.xml,定位到如下位置:
<path id="path.base" >
<!-- <pathelement location="${dirs.base}/classes"/> -->
<pathelement location="${basedir}/classes"/>
<!-- include all jars located in lib except the jacorb.jar -->
<fileset dir="${basedir}/lib" >
<include name="*.jar" />
<exclude name="jacorb.jar" />
<!--
<exclude name="idl.jar" />
-->
</fileset>
<pathelement path="${java.class.path}"/>
<pathelement path="${sun.boot.class.path}"/>
</path>
修改为粗体部分
9. 定位到% JACORB_HOME%下的bin目录,发现存在下列4个文件:
a) idl.bat.tpl
b) idl.tpl
c) jaco.bat.tpl
d) jaco.tpl
分别将上述4个文件的tpl后缀去掉(tpl表示template模板,不知为何从官方网站下载的文件会出现这样的问题,不修改直接导致jacorb无法工作)
10. 修改jaco.bat:
原先内容:
@JAVA_CMD@ -Djava.endorsed.dirs=@JACORB_HOME@/lib -Djacorb.home=@JACORB_HOME@ -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -classpath %CLASSPATH% %*
修改后为:
JAVA -Djava.endorsed.dirs=%JACORB_HOME%/lib -Djacorb.home=%JACORB_HOME% -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton -classpath %CLASSPATH% %*
11. 修改idl.bat:
原先内容:
@JAVA_CMD@ -classpath "@JACORB_HOME@/lib/idl.jar;@JACORB_HOME@/lib/logkit-1.2.jar;%CLASSPATH%" org.jacorb.idl.parser %*
修改后为:
JAVA -classpath "%JACORB_HOME%/lib/idl.jar;%JACORB_HOME%/lib/logkit-1.2.jar;%CLASSPATH%" org.jacorb.idl.parser %*
完成上述步骤无误后,可以测试一下jacorb是否正确安装,测试步骤如下:
1. 命令行窗口定位到% JACORB_HOME%下的demo/grid/目录,输入ant后直接回车开始ant编译,出现BUILD SUCCESSED表示编译成功
2. 这样会进行idl编译server.idl文件,在% JACORB_HOME%/demo/grid/generated下生成corba所需的源文件 ,同时,ant会编译所有的java源文件,% JACORB_HOME%/classes下面生成 .class文件
3. 打开一个命令行窗口,输入ns或ns.bat,出现如下信息:
C:/Documents and Settings/muning>ns.bat
[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 (GBK) - defaulting to IS
O-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
表示JacORB正常启动
4. 打开一个新的命令行窗口,输入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 (GBK) - defaulting to IS
O-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 23 22 0E 02 3C 18 01 2C 37 ..#"..<..,7
object is activated
[jacorb.poa] INFO : Using server ID (7483177760) for transient POA
[jacorb.orb.singleton] INFO : created ORBSingleton
[jacorb.orb.giop] INFO : ClientConnectionManager: created new ClientGIOPConnecti
on to 192.168.100.47:1407 (9f671b)
[jacorb.orb.iiop] INFO : Connected to 192.168.100.47:1407 from local port 1409
[jacorb.orb] INFO : ORB run
同时在步骤3打开的窗口中出现:
[jacorb.naming] INFO : re-Bound name: grid.example
表示测试范例的ORB服务端正常启动
5. 打开一个新的命令行窗口,输入,出现如下信息:
[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 (GBK) - defaulting to IS
O-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.orb.giop] INFO : ClientConnectionManager: created new ClientGIOPConnecti
on to 192.168.100.47:1407 (1db699b)
[jacorb.orb.iiop] INFO : Connected to 192.168.100.47:1407 from local port 1419
[jacorb.orb.giop] INFO : ClientConnectionManager: created new ClientGIOPConnecti
on to 192.168.100.47:1408 (cbf30e)
[jacorb.orb.iiop] INFO : Connected to 192.168.100.47:1408 from local port 1420
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 :-)
[jacorb.orb] INFO : prepare ORB for shutdown...
[jacorb.orb] INFO : ORB going down...
[jacorb.orb.iiop] INFO : Client-side TCP transport to 192.168.100.47:1408 closed
.
[jacorb.orb.iiop] INFO : Client-side TCP transport to 192.168.100.47:1407 closed
.
[jacorb.orb] INFO : ORB shutdown complete
看到这些表示你已经成功的运行了一个极其简单的例子