Wednesday, 6 May 2015

data controls refactor and MDS-00013 exception

There are a lot of questions about MDS-00013 after refactoring DataControl.dcx file - renaming or moving to other locations.

As a starting point I have got ViewController project with one page and custom Model project with sample POJO Data Control. A page is using specified DC by presenting collection as a read-only table.

My class is defined in model package in Model project. After data control creation I've got DataControls.dcx file created in the same package in the same project. Just to make sure that it works fine I'm creating test page with drag'n'dropped read only table there. The project structure looks similar to the screenshot below:

The page works good, so lets change it. The best way to achieve it is to refactor it. I would like to move java class to package and DCX file to model.dc package. Also i'd like to rename java file just to make it more complicated. I've used Refactor menu from the toolbar, so each important thing should be changed. OK, so run the test page one more time and...

an exception... I've digged the Internet for phrase:

oracle.mds.core.MetadataNotFoundException: MDS-00013: no metadata found for metadata object {0}

and the solution is not so obvious. The key to fix the issue is to understand the ADF descriptors. The files that are in the background, contain a lot of magic inside and nobody likes to mix with them too often.

Each project that has got data controls inside, has got such descriptors. DCs are defined in DCX file. Data control registers are pointed by adfm.xml descriptors. In my case after refactoring the project adfm.xml points correctly the register and DCX file points to renamed implementation class:

I'll revert the value of id attribute of AdapterDataControl node to avoid changes in other layers. But even so the result of running the page is the same - MDS-00013 exception is thrown.

So what else needs to be checked? There is CPX file which maches pages or task flow steps with their definitions (pageDefs). It also tells to the ADF framework which data controls are used in the projects and where are they located.

Please look carefully on the dataControlUsages node. There is one definition and a path attribute. From java point of view the path is correct. But the path is not a real path. It should point to the DC id in the registry. So proper value there is:


Please run it one more time and... now it works as it should be!

Meanwhile please also check my other posts about validation and proxying web services for more details about usage of POJO data controls in your projects :)