Sunday, May 15, 2011

Target MDS Repository for ADF Applications Deployment

JDeveloper 11g MDS wizard for ADF application doesn't provide target MDS repository configuration options, you can specify only file based repository location:


Only when deploying ADF application enabled with MDS functionality directly from JDeveloper, wizard asks where we want to target MDS repository and specify partition name:


This works fine, when deploying directly from JDeveloper. However, very often deployments are done from deployment automation (Hudson with OJDeploy, etc.). In those cases, we don't have option to specify target MDS repository through the wizard.

By default, target MDS repository is configured in adf-config.xml as file system repository:


We can try to change this and point to database MDS repository, one that should be used after deployment:


However, OJDeploy fails to locate specified JNDI connection - target MDS location with database details is ignored and not included into deployment package:


If we try to deploy such EAR from Hudson automation, errors for target MDS repository are generated - naturally, because required information is missing. Its same as we would try to deploy EAR through Enterprise Manager, it asks to provide mandatory missing information for target MDS repository:


Possible solutions for automated deployment? Looks like only one - you need to write additional script, which will access packaged EAR and substitute target MDS repository values, right before EAR deployment. This would work, because EAR is already generated - we would simulate target MDS repository wizard action - substitute target MDS repository values in adf-config.xml with database details:


Now EAR contains information about target MDS repository, automated deployment will succeed:


Download sample application - PortalAppMDS.zip. You can find sample adf-config.xml file inside application_root/deploy folder, this file contains target MDS repository configuration with database details.

9 comments:

Unknown said...

Hi Andrejus,

we are using WLST commands to update MDS config of EAR before actually deploying it.

log_info('updating MDS config for '+ app_source)
archive = getMDSArchiveConfig(fromLocation=app_source)
archive.setAppMetadataRepository(repository=..,partition=.., type='File',path=..)
archive.save()
log_info('updating MDS config done!')

http://download.oracle.com/docs/cd/E12839_01/web.1111/e13813/custom_mds.htm

This might also work for Database based MDS repo as well. Is this an option for you? What do you think?

Greetz,
Andreas

Andrej Baranovskij said...

Hi,

Exactly - its what it is needed. I will test this, but from doc it looks good.

Thanks for good pointer.

Andrejus

Anonymous said...

Andrejus,
Thanks for your post.
We use wldeploy. can you pls let me know how to do it, 'write additional script, which will access packaged EAR and substitute target MDS repository values' ???
can we do it in wldeploy?

Andrej Baranovskij said...

You need to use WLST, is described in first comment of this post.

Andrejus

Unknown said...

hello the solution you propose in picture 7 I try to do in my XML code in the adf-conf and it fails, you can give me some solution?

Radha K said...

How to specify the target MDS repository if the application deployed using maven in Hudson

Andrej Flieger said...

We have a CI that automatically deploing our application with maven using wls:deploy.
How can we achieve that mds information is written into the EAR file prior to deployment.

Andrej Baranovskij said...

You would need to call WLST command to add MDS, from CI through ANT, before deploying:

log_info('updating MDS config for '+ app_source)
archive = getMDSArchiveConfig(fromLocation=app_source)
archive.setAppMetadataRepository(repository=..,partition=.., type='File',path=..)
archive.save()
log_info('updating MDS config done!')

srikanth said...

Hi, can I have script which replace the ADF-CONFG file from build to .ear file.