While doing different ADF 11g projects reviews, I frequently encounter situation when ADF deployment package size is multiplied at least by two, comparing to what it should be. Usually this happens because improper application libraries packaging - source code is duplicated during packaging into multiple identical libraries later included into EAR deployment distribution package. Today I will describe few hints related to this topic.
Download sample application - WebDeploymentWar.zip, where deployment profiles are set as I describe in this blog. This application contains simplistic ADF 11g project structure - one shared resources project with ADF ViewController utility classes together with Model/ViewController implementation projects:
Myself I would recommend to package shared project into ADF Library and consume it, instead of declaring direct dependency - this will improve reusability and will minimize source code duplications across different consuming projects. Shared project contains ADF Library deployment profile:
ViewController contains direct dependency only to Model project:
ViewController consumes shared resources from SharedViewUtils through library reference:
Typical mistake we are doing is inclusion of the same shared resource library into EAR application package assembly. It is enough to reference ADF Library only from consuming ViewController project, no need package it again into EAR - this will include library twice and increase EAR application package size:
If we expand generated EAR package, we will see shared ADF Library is included into WAR package and additionally it is duplicated on EAR level:
This will increase deployment package size and will consume more server resources, no one wants this - so include into EAR only required packages, everything what is referenced from required package itself should not be included again:
Its how EAR deployment package should look - ADF Library is included into WAR package, from where it is referenced:
One more hint - even all resources are referenced correctly, you still should be careful. When running application on embedded WebLogic server, you may get auto generated duplications of different deployment profiles - shared view resources are generated into WAR, even there is no such deplyment profile defined:
Deployment folder contains two WAR packages:
WebLogic is creating two Web application modules and consumes double resources because of this:
The reason of this - web.xml available in shared resources project:
Even there are no WAR deployment profile present, JDeveloper still generates WAR for project, when there is web.xml present. Remove web.xml where it is not needed:
After these fixes, only one WAR package is generated, as expected:
Haven't paid any attention to it before. Thank you, Andrejus. Very helpful.
ReplyDeleteThanks Andrejus.. i'm waiting for more BPM and ADF interaction.
ReplyDeleteThanks for good feedback, definitely will do in near future. Its all under BPM tag: http://andrejusb.blogspot.com/search/label/BPM%2011g
ReplyDeleteAndrejus
Andrejus, once again, it was usefull, keep the good work... Thanks from Brazil!!!
ReplyDelete