Utility.loadStub() returns null in OSGi environment
tnagao7 opened this issue · comments
Environment Details
- ORB Version: ORB 4.2.4
- JDK version: OpenJDK 11
- OS: Linux
- Database: None
Problem Description
If the com.sun.corba.ee.impl.util.Utility#loadStub
method is called in an OSGi environment, the method always returns null instead of a stub object, caused by a class loading issue.
orb/orbmain/src/main/java/com/sun/corba/ee/impl/util/Utility.java
Lines 802 to 813 in bec942a
The return value is null since the variable result
remains null at the end of the method.
This is because the following exception is thrown in the statement result = (Remote)sf.makeStub() ;
and caught in the catch
clause:
java.lang.IllegalArgumentException: Cannot load class for type javax.rmi.CORBA.Stub
The cause err.getCause()
of the exception err
is:
java.lang.ClassNotFoundException: javax.rmi.CORBA.Stub not found by org.glassfish.main.common.glassfish-naming [104]
It seems that the commit 471b980#diff-9cebdcf343a6c675195053fd3449dbcaR197 is the cause of the problem, as reported in the issue #75 .
Though the issue is closed, the same problem is still reproduced with GlassFish 7.0.3.
Steps to reproduce
This problem can be reproduced in an OSGi environment e.g. GlassFish.
Running an application including remote EJB calls such as below on GlassFish 7.0.3 (in which ORB 4.2.4 is included) will reproduce the problem.
Properties props = new Properties();
props.put("com.sun.appserv.iiop.endpoints", "localhost:23701");
InitialContext ic = new InitialContext(props);
OrbTestRemote remote = (OrbTestRemote) ic.lookup("OrbTestRemote");
App: orb-test.zip
Getting
$ curl -i http://localhost:28080/orb-test-client/test
HTTP/1.1 200 OK
Server: Eclipse GlassFish 7.0.8
X-Powered-By: Servlet/6.0 JSP/3.1(Eclipse GlassFish 7.0.8 Java/Eclipse Adoptium/11)
Content-Length: 12
Hello, test