在jacorb中编译存根

时间:2014-05-27 19:11:51

标签: java stub jacorb

我正在关注jacorb documentation的第4章中的例子。当我启动客户端时,我收到此错误

INFO Initialising ORB with ID: 
WARNING Warning - unknown codeset (MacRoman) - defaulting to ISO-8859-1
Exception in thread "main" java.lang.NoClassDefFoundError: stock/_MyServerStub
    at stock.MyServerHelper.narrow(MyServerHelper.java:62)
    at stock.Client.main(Client.java:15)
Caused by: java.lang.ClassNotFoundException: stock._MyServerStub
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 2 more

所以问题是_MyServerStub。当我尝试编译_MyServerStub.java时,我得到了这个错误

javac stock/_MyServerStub.java 
stock/_MyServerStub.java:82: cannot find symbol
symbol  : class ServantObjectExt
location: package org.omg.CORBA.portable
                if ( _so instanceof org.omg.CORBA.portable.ServantObjectExt) 
                                                          ^
stock/_MyServerStub.java:83: cannot find symbol
symbol  : class ServantObjectExt
location: package org.omg.CORBA.portable
                    ((org.omg.CORBA.portable.ServantObjectExt)_so).normalCompletion();
                                            ^
stock/_MyServerStub.java:88: cannot find symbol
symbol  : class ServantObjectExt
location: package org.omg.CORBA.portable
                if ( _so instanceof org.omg.CORBA.portable.ServantObjectExt) 
                                                          ^
stock/_MyServerStub.java:89: cannot find symbol
symbol  : class ServantObjectExt
location: package org.omg.CORBA.portable
                    ((org.omg.CORBA.portable.ServantObjectExt)_so).exceptionalCompletion(re);
                                            ^
stock/_MyServerStub.java:94: cannot find symbol
symbol  : class ServantObjectExt
location: package org.omg.CORBA.portable
                if ( _so instanceof org.omg.CORBA.portable.ServantObjectExt) 
                                                          ^
stock/_MyServerStub.java:95: cannot find symbol
symbol  : class ServantObjectExt
location: package org.omg.CORBA.portable
                    ((org.omg.CORBA.portable.ServantObjectExt)_so).exceptionalCompletion(err);
                                            ^
6 errors

1 个答案:

答案 0 :(得分:0)

您需要将JacORB jar添加到类路径中。

我建议在jacorb-developer列表中询问有关JacORB的问题(http://www.jacorb.org/contact.html