views:

864

answers:

3

I have a webapp with different Dynamic Web Projects, each of them generally containing an EJB Project. We want to keep them interacting, as in using beans and classes from each other's EJBs through JNDI, sharing the same database or using their own. But we also want to be able to keep different projects on different servers.

What would be the right focus for this kind of project in terms of architecture and organization?

How should we use EARs? One EAR to rule them all and in the darkness bind them? (sorry, had to do that LOTR reference), or an EAR per server/web project, etc.?

+2  A: 

Disk space is cheap, but if you throw everything into a single EAR, your app server is liable to run them all, even if all you want is Service A. You're best breaking commonly used EJBs and deploying them in by themselves, and each individual service's components in their own EARs.

Then, using JBoss as an example, you can simply copy the artifacts right into the deploy directory of whatever server you want to run them on.

OrderManagement.ear InventoryManagement.ear StoreFront.ear

You can then have either all, some or nothing on any particular server.

Chris Kaminski
+1  A: 

EJB's are meant to be modular, so depending on the service you want to provide you should provide a proper EAR to be deployed. Also, try using MBeans and deploy them as independent services. Management interfaces help a lot when debugging and testing.

Ubersoldat
+1  A: 

Keep in mind bug fix/upgrade and regression testing scenarios. The more EJB modules you have in the same EAR, the more function points will need regression testing even if you fixed or added a new feature to only one of the modules.

zkarthik