DEV Community


Posted on


Deployment of EJB server application and client independently

A friend asked me to work on an EJB and EJB client project in an independent separated deployment package for each.

I get used to use Netbeans to do that along time ago, but I decided to do it with maven. Looking for that I found that Apache provided plugins of EAR and EJB application for maven: for deploying artifacts as a Java EE Enterprise Archive (EAR) which generates Java Enterprise JavaBean (EJB) file as well as the associated client jar.
That was almost perfect though the documentation was not clear enough. then I looked for someone how used it and fortunately I found an example on github, it was good to some extent, but wasn’t organized well and I had build issues with maven.

Making some efforts to re-organize the pom structure and fix some configurations I was able to build the EJB application as an isolated EAR file (because of dependencies on Hibernate it should be EAR not JAR).
the plugin also generates EJB jar and EJB client jar for you and with maven you can add it easily as a dependency for your client application.

The build of the EJB client application was straightforward with JSF, primefaces and the created EJB client jar built in the first step. then I used Glassfish server to deploy both artifacts.

This was just a simple try to build isolated Enterprise Java applications but things may go complex with other requirements.

You can check github for sources and build/deploy instructions
and don’t hesitate to contact me for updates or other issues/ queries.

Top comments (0)