DEV Community

David Harrison
David Harrison

Posted on

3 2

Java 11: Making RMI calls and EJBs work again

As part of a new project, I explored the possibly of re-using an EJB. This is to leverage existing business logic rather than cloning, which would then need to also be maintained separately.

Attempting to Compile the EJB calling code in Java 11 served up a quick reminder. As part of JEP 320, the following are removed from Java.

  • java.corba module
  • javax.rmi.CORBA
  • javax.rmi (RMI-IIOP packages)

Example section of code which would not compile

Context context = new InitialContext();
Object raw = context.lookup(jndiName);
ARemoteType type = (ARemoteType )PortableRemoteObject.narrow(raw, ARemoteType .class);

Luckily, under the Eclipse Foundation's Java EE, the Glassfish implementation of CORBA and RMI-IIOP is available! Including the Gradle snippet below allowed the code to compile and work without any change.

implementation group: 'org.glassfish.corba', name: 'glassfish-corba-orb', version: '4.2.0'

References

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay