我正在尝试使用jacorb 3.9执行我的Java 11(openjdk)应用程序。该应用程序开始执行但因抱怨丢失而崩溃:
javax.rmi.CORBA.Stub
我已将所有jacorb库包含在CLASSPATH中
set CLASSPATH = ${JACORB_PATH}/jacorb.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/jacorb-3.9.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/jacorb-omgapi.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/slf4j-api.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/slf4j-jdk14-1.7.14.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/jacorb-services.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/picocontainer.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/wrapper.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/antlr.jar:${CLASSPATH}
set CLASSPATH = ${JACORB_PATH}/idl.jar:${CLASSPATH}
执行时,我得到这个:
java.lang.reflect.InvocationTargetException
...
Caused by: java.lang.ClassNotFoundException: javax.rmi.CORBA.Stub
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
我也尝试用以下方法设置JDK_JAVA_OPTIONS:
--module-path ${JACORB_PATH} --add-modules java.corba
-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
但是抱怨“找到了两个版本的模块slf4j.jdk14”
执行程序的命令是:
java -classpath $CLASSPATH myprog.MYPROG
该应用程序最初是为Java 8编写的,可以通过jacorb将以下参数传递给Java命令来正常工作:
-Djava.endorsed.dirs=JACORB_PATH
-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB
-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
该应用程序根本不使用rmi。它是“经典” CORBA客户端。尝试解析命名服务的初始引用时崩溃
最佳答案
看来该问题已在项目mailing list上提出。一种解决方法是在jacorb-3.8.jar和sfl4j jars旁边的classpath上添加以下两个代码:
jacorb-omgapi-3.8.jar-来自JacORB发行版
jboss-rmi-api_1.0_spec-1.0.6.Final.jar-来自https://github.com/jboss/jboss-rmi-api_spec。该库提供了Java RMI API,该Java RMI API最初由JRE的JacORB使用。 (Maven)