0

Is it a good practice to give WAR-WAR dependency in an Application Server. Both the wars belong to the same EAR. Reason: Extend the functionalities of one WAR (by Inheritence).

For a reason(which I dont want to explain for simplicity), both the WARs will be used and will have their own independent context paths. In other words, base WAR is not abstract.

When we use JBOSS modules, the runtime dependency is resolved by mentioning the dependency "deployment..war" in MANIFEST.MF.. is this again a good practice?

  • Is it possible to extract the common functionality in a jar ? May be you can also take a look at overlays http://maven.apache.org/plugins/maven-war-plugin/overlays.html – rangalo Jun 24 '14 at 13:58

1 Answers1

1

I'd consider it a bad practice. Since in many servers by default each war will be loaded by separate class loader, so classes from one war will not be visible unless you will set dependencies in the manifest. If you want to extend some classes, it would be better to separate them in the utility jar and add to ear/lib.

Gas
  • 17,601
  • 4
  • 46
  • 93
  • Thanks for replying. Many say the same as what you said, but I'm trying the understand why its bad. Creating a separate lib should work, but it doesn't appear as a natural solution. I even have the choice of using web-fragments. But they cant have a context of their own :(. – user3484558 Jun 24 '14 at 14:09
  • Usually you create separate web module because it has different purpose. So what, if you decide later on to remove it, or move to other ear? For me more natural is to crate library, I dont see any benefits of extending classes from war, but I might be missing something you are using. – Gas Jun 24 '14 at 15:19
  • Thanks.. I think I understood. I was trying to get this justification as I dont see much on the specification. – user3484558 Jun 25 '14 at 07:05