In Java Enterprise, the EJB (Enterprise Java Bean) technology is often used to create a service layer of a J2EE application running in an application Server (like Glassfish or Wildfly). While accessing these EJB instance is relatively easy from inside the same application (using @Inject or @EJB annotations for automatic dependency injection), it is sometimes also required to call some methods on the EJBs from outside the application server.
The JavaEE standard provides the “EJB remoting” functionality to do so. In this article I want to show how to access an EJB running in a Wildfly application server from a standalone Java application.
All code examples are also available on our Github page: https://github.com/illucIT/remote-ejb-example