Large project structure and scalability


Till now I’ve worked with a small war projects, sometimes it was EAR projects with one or more war’s and ejb inside. But now I’m trying to build a quite large project, that has multiple war modules, these war’s are related to one business layer EJB module and all of them to common.jar and entities.jar. Of course I can put all in one EAR module and all will be fine, but I see a big cons - even having a small update in one of war or ejb module, I need to rebuild a whole EAR and redeploy all applications.

So I’m dreaming about solution like in picture that is in the middle between a monolith single app and microservices. Please help me if this concept is acceptable, how to package these modules or point me to the right direction. I’m stuck trying to test the first step - deploy EJB module to Payara5 with 4 dependencies like in picture. When I add remote-api.jar in pom.xml, I get errors Caused by: java.lang.NoClassDefFoundError for all entities from entities.jar and I have now idea why because project compiles with no errors…

Not sure what causes the NoClassDefFoundError but the remote-api.jar might add dependencies on the EJBs that are not included.

And I’m not convinced this is a viable architecture. it certainly brings a lot of complexity like remote EJB calls, clustering the EJBs in the Backend deployment group, etc …

If I would create a similar solution, I would combine the EJBs within each WAR and use them as Local EJBs. This is much more performant, easier to set up and you can still scale by scaling the app1 and my-api war deployments.

thanks, , after a lot of reading I’ve already reconstruct my project to the multi module Maven project and simply added my “backend” EJB as a dependency to every war pom.xml. Unlike having EAR project with 3 war, EJB and other jar’s, now I can rebuild and redeploy single war project and easy scale