Friday, March 23, 2012

Undeployment of composites when soa-infra is down

Did you already have the problem that you couldn’t restart your server because of a certain (maybe broken) composite? Did you ever wish to perform an undeployment of your composites while soa-infra is down? In some of our projects we already had this requirement. Below you’ll find an explanation with a step-by-step example of how-to get rid of your composites – even when the soa-infra is not reachable.

Enterprise Manager with a list of the deployed composites (relevant for this post: HelloWorld 1.0.0)


A restart of the Managed Server failed because one of the composites referred to a file that could not be found. Therefore we received the following error message:
Caused By: oracle.mds.exception.MDSException: MDS-00054: The file to be loaded oramds:/deployed-composites/default/HelloWorld_rev1.0.0/… does not exist.
        at oracle.fabric.common.metadata.MetadataManagerImpl.getInputStreamFromAbsoluteURL(
        at oracle.integration.platform.common.MDSMetadataManagerImpl.getInputStreamFromAbsoluteURL(
        at oracle.integration.platform.common.MDSMetadataManagerImpl.transferFile(
        at oracle.integration.platform.common.MDSMetadataManagerImpl.transferFiles(
        at oracle.integration.platform.common.MDSMetadataManagerImpl.copyTree(

How-to fix it?

Since redeployment is not possible because of a non-reachable soa-infra, we needed to look for the available options to delete the current deployment in an offline mode. This should help us to restart the server again. For this we did some research in the web but unfortunately most of the suggested solutions are only applicable when soa-infra is online. One of these examples is the export / import functionality for the MDS via Enterprise Manager - see the article Undeploy composites manually for more details. The functionality is very useful but it requires a running soa application. After that I tried to export the deployed-composites.xml as described in the above blog using WLST – unfortunately the result wasn’t satisfying:


wls:/domain/serverConfig> exportMetadata(application='soa-infra',server='<MY_MANAGED_ SERVER_SOA>',toLocation='<MY_TO_LOCATION>',docs='/deployed-composites/deployed-composites.xml')



Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)
Executing operation: exportMetadata.

Traceback (innermost last):
  File "<console>", line 1, in ?
  File "/opt/oracle/Middleware/oracle_common/common/wlst/", line 237, in exportMetadata
  File "/opt/oracle/Middleware/oracle_common/common/wlst/", line 727, in executeAppRuntimeMBeanOperation
  File "/opt/oracle/Middleware/oracle_common/common/wlst/", line 697, in getMDSAppRuntimeMBean
UserWarning: MDS-91002: MDS Application runtime MBean for "soa-infra" is not available. "exportMetadata" operation failure.


Besides other options like direct access to MDS via Java (Full access to MDS Repository) or SQL (MDS_PATHS Table) we discovered a new and up-to-date Metalink-Note ([ID 1380835.1]) which described basically what we wanted. Thanks a lot to Markus Lohn (Oracle) for his support! We successfully followed the steps within the note and after that the server came up. Below I describe the approach with the above Hello World example. 

1. Download and copy the ShareSoaInfraPartition.ear from Oracle to access the MDS offline (Download it from the Metalink note). 

2. Connect to WLST and deploy the above application on the AdminServer. Use the WLST under $MIDDLEWARE_HOME/ oracle_common/common/bin.

3. Run the below command to export the metadata from the AdminServer. Change the values appropriate to your environment.


exportMetadata(application='ShareSoaInfraPartition',server='<MY_ADMIN_ SERVER>',toLocation='<MY_TO_LOCATION>',docs='/deployed-composites/deployed-composites.xml')


Executing operation: exportMetadata.
Operation "exportMetadata" completed. Summary of "exportMetadata" operation is:
List of documents successfully transferred:
1 documents successfully transferred.

4. Open the deployed-composites.xml within deployed-composites folder under <MY_TO_LOCATION>.

5. Delete the composite series or revision which is causing the problem and save the file.

<composite-series name="default/HelloWorld" default="default/HelloWorld!1.0.0">
  <composite-revision dn="default/HelloWorld!1.0.0" state="on" mode="active" location="dc/soa_09001e40-be6f-4bc4-8a96-201f3848c38d">
    <composite dn="default/HelloWorld!1.0.0*soa_09001e40-be6f-4bc4-8a96-201f3848c38d" deployedTime="2012-03-09T13:15:14.139+01:00"/>

6. Import the updated file under <MY_FROM_LOCATION> into MDS.


wls:/domain/serverConfig> importMetadata(application='ShareSoaInfraPartition',server='AdminServer',fromLocation='<MY_FROM_LOCATION>',docs='/deployed-composites/deployed-composites.xml')


Executing operation: importMetadata.

Operation "importMetadata" completed. Summary of "importMetadata" operation is:
List of documents successfully transferred:

1 documents successfully transferred.

7. Restart your SOA server or soa-infra.

Enterprise Manager with a list of the deployed composites (note that HelloWorld 1.0.0 is not available)

No comments:

Post a Comment