2

I'm trying to use Java 9 as client application runtime, to call EJB (EJB 2.0) deployed on JBoss v7 EAP running with Java 8. Following parameter can work with Java 6/7/8.:

-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory

to enable CORBA for Java 9, parameter:

--add-modules ALL-SYSTEM 

is added to command line, first line returns an CORBA object, but second line javax.rmi.PortableRemoteObject.narrow(...) returns an null:

Object ref = mContext.lookup("MyEar/MyEJBModuleName/MyEJBHome"); //OK

MyEJBHome home = (MyEJBHome) 
                  javax.rmi.PortableRemoteObject.narrow(ref, MyEJBHome.class); //KO.

this code fragment can work with Java 6/7/8, but fails with Java 9. I have added ALL-SYSTEM modules, are there any other dependencies or parameters missing?

Edit@2017.11.16:

I got answer to it:

with JDK 8, its IIOP implements try to create dynamic stub, so I don't need provide stub classes, but JDK 9, it try to load 2 stub classes with names: com.ts.uiserver._UIServerHome_Stub & org.omg.stub.com.ts.uiserver._UIServerHome_Stub, my jar doesn't contains them, now I created following 4 stub classes with rmic command:

com.ts.uiserver._UIServerHome_Stub
com.ts.uiserver._UIServer_Stub
org.omg.stub.javax.ejb._EJBHome_Stub
org.omg.stub.javax.ejb._EJBObject_Stub

, with 4 stubs, my program works now.

now I get another question:

  • what's pros and cons of static stub vs. dynamic stub?
  • when static stubs not found why its implementations don't try to generate dynamic stub?

I also explicitly added '-Dcom.sun.CORBA.ORBUseDynamicStub=true' to command line, it seems that this parameter is not used actually, after search source code 'src.zip' of Java 9, this parameter is still mentioned.

Daniel Yang
  • 276
  • 2
  • 11
  • Are there any other logs apart from getting the value as `null`? Did you try and debug to see it the narrowFrom is evaluating to null while creating of loading delegate in the implementaion? – Naman Nov 13 '17 at 07:17
  • It may be that JBoss 7 is not certified to run on JDK 9. One potential issue is that it may override or patch the CORBA API or the JDK ORB, in which case additionally options/configuration will be needed to patch the java.corba module. It may be that it overrides the javax.rmi.* API to use a different delegate for example. The JBoss mailing lists or issue tracker may already have discussion on this. – Alan Bateman Nov 13 '17 at 07:57
  • JBoss EAP 7 implements Java EE 7 and Java EE 7 is based on Java 7. Usually app server implementors like RedHat also make it possible to run Java EE 7 on Java 8 but I currently there is no app server provider that officially supports Java 9 – Simon Martinelli Nov 13 '17 at 09:20

0 Answers0