本文介绍了Java 11和jacorb. ClassNotFoundException:javax.rmi.CORBA.Stub的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jacorb 3.9执行我的Java 11(openjdk)应用程序.该应用程序开始执行但因抱怨丢失而崩溃:

I am trying to execute my application of java 11 (openjdk) with jacorb 3.9.The application starts executing but crashes complaining about missing :

javax.rmi.CORBA.Stub

我已将所有jacorb库包含在CLASSPATH中

I have included all jacorb libraries in the 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:

I have tried also to set up the JDK_JAVA_OPTIONS with:

--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"

But complains about "Two versions of module slf4j.jdk14 found"

执行程序的命令是:

java -classpath $CLASSPATH myprog.MYPROG

该应用程序最初是为Java 8编写的,可通过jacorb将以下参数传递给Java命令来正常工作:

The application was originally written for Java 8 and working OK with jacorb passing the following parameters to java command:

-Djava.endorsed.dirs=JACORB_PATH
-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB
-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton

该应用程序根本不使用rmi.它是经典" CORBA客户端.尝试解析命名服务的初始引用时会崩溃

The application does not use rmi at all. It is a 'classic' CORBA client. It crashes when trying to resolve the initial reference of the naming Service

推荐答案

似乎在项目邮件列表.一种解决方法是在jacorb-3.8.jar和sfl4j jars旁边的类路径上添加以下2:

It seems that the issue have been raised on the project mailing list. A workaround is to add on the classpath next to jacorb-3.8.jar and the sfl4j jars these 2:

  • jacorb-omgapi-3.8.jar - from JacORB distribution
  • jboss-rmi-api_1.0_spec-1.0.6.Final.jar - from https://github.com/jboss/jboss-rmi-api_spec. This library provides the Java RMI API which was originally used by JacORB from the JRE. (Maven)

这篇关于Java 11和jacorb. ClassNotFoundException:javax.rmi.CORBA.Stub的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 06:24