stub = toStubMethod.invoke(null, new java.lang.Object[]{remoteObj});
} catch (InvocationTargetException e) {
Throwable realException = e.getTargetException();
// realException.printStackTrace();
ConfigurationException ce = JacORBMessages.MESSAGES.problemInvokingPortableRemoteObjectToStub();
ce.setRootCause(realException);
throw ce;
} catch (IllegalAccessException e) {
ConfigurationException ce = JacORBMessages.MESSAGES.cannotInvokePortableRemoteObjectToStub();
ce.setRootCause(e);
throw ce;
}
// Next, make sure that the stub is javax.rmi.CORBA.Stub
if (!corbaStubClass.isInstance(stub)) {
return null; // JRMP implementation or JRMP stub
}
// Next, make sure that the stub is connected
// Invoke stub.connect(orb)
try {
connectMethod.invoke(stub, new java.lang.Object[]{orb});
} catch (InvocationTargetException e) {
Throwable realException = e.getTargetException();
// realException.printStackTrace();
if (!(realException instanceof java.rmi.RemoteException)) {
ConfigurationException ce = JacORBMessages.MESSAGES.problemInvokingStubConnect();
ce.setRootCause(realException);
throw ce;
}
// ignore RemoteException because stub might have already
// been connected
} catch (IllegalAccessException e) {
ConfigurationException ce = JacORBMessages.MESSAGES.cannotInvokeStubConnect();
ce.setRootCause(e);
throw ce;
}
// Finally, return stub
return (org.omg.CORBA.Object) stub;
}